From 8231e8dea37ddecc8b59004912248f3838007869 Mon Sep 17 00:00:00 2001 From: Dobin Rutishauser Date: Fri, 27 May 2022 20:16:50 +0200 Subject: [PATCH] ux: make log output nicer --- analyzer.py | 6 +++--- reducer_rutd.py | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/analyzer.py b/analyzer.py index 20376c5..8e117c8 100644 --- a/analyzer.py +++ b/analyzer.py @@ -17,12 +17,12 @@ def analyzeFile(filename, scanner, newAlgo=True, isolate=False, remove=False, ve for i in matches: size = i.end - i.begin - print(f"[*] Signature between {i.begin} and {i.end} size {size}: ") - logging.info(f"[*] Signature between {i.begin} and {i.end} size {size}: ") data = pe.data[i.begin:i.end] + + print(f"[*] Signature between {i.begin} and {i.end} size {size}: ") print(hexdump.hexdump(data, result='return')) - logging.info("\n" + hexdump.hexdump(data, result='return')) + logging.info(f"[*] Signature between {i.begin} and {i.end} size {size}: " + "\n" + hexdump.hexdump(data, result='return')) if verify: verifyFile(deepcopy(pe), matches, scanner) diff --git a/reducer_rutd.py b/reducer_rutd.py index 0036964..69b91ea 100644 --- a/reducer_rutd.py +++ b/reducer_rutd.py @@ -53,12 +53,10 @@ def scanSection(scanner, fileData, sectionStart, sectionEnd, it): if chunkSize < SIG_SIZE: # Small enough, no more detections logging.debug("No more detection") - logging.info(f"Result: {sectionStart}-{sectionEnd} ({sectionEnd-sectionStart} bytes)") - it.add ( Interval(sectionStart, sectionStart+size) ) - - #print("Result:") data = fileData[sectionStart:sectionStart+size] - logging.info("\n" + hexdump.hexdump(data, result='return')) + + logging.info(f"Result: {sectionStart}-{sectionEnd} ({sectionEnd-sectionStart} bytes)" + "\n" + hexdump.hexdump(data, result='return')) + it.add ( Interval(sectionStart, sectionStart+size) ) else: # make it smaller still. Take complete data (not nulled) logging.debug("--> No detections anymore, but too big. Continue anyway...")