From bc159a2d24b8299309863a46102899f3899e7703 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 14 Sep 2023 17:35:20 +0200 Subject: [PATCH] force dump --- src/hexdumper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hexdumper.py b/src/hexdumper.py index d5ef472..dc5c72d 100755 --- a/src/hexdumper.py +++ b/src/hexdumper.py @@ -37,6 +37,7 @@ def main(): ) parser.add_argument("file") parser.add_argument("-c", "--chars", action="store_true") + parser.add_argument("-f", "--force", action="store_true") # ignore set limits args = parser.parse_args() # open file @@ -78,6 +79,9 @@ def main(): if 0 != os.path.getsize(args.file) > MAX_SIZE: print(f"""The file you are trying to dump is larger than 1M.\n\ Actual size: {humanbytes(os.path.getsize(args.file))}\nrefusing to dump""") + if (0 != os.path.getsize(args.file) > MAX_SIZE) and not args.force: + print(f"The file you are trying to dump is larger than {humanbytes(MAX_SIZE)}.\n\n\ + Actual size: {humanbytes(os.path.getsize(args.file))}\n\nrefusing to dump. You can force dump the file with --force.") sys.exit(2) # print header if args.chars: