Skip to content

Commit

Permalink
ux: make log output nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobin Rutishauser committed May 27, 2022
1 parent daca1b2 commit 8231e8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions reducer_rutd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...")
Expand Down

0 comments on commit 8231e8d

Please sign in to comment.