Commit 0726deb5 by devttys0

Fixed outout alignment bug in hashmatch module

parent a6a6322c
...@@ -86,7 +86,7 @@ class HashMatch(Module): ...@@ -86,7 +86,7 @@ class HashMatch(Module):
FUZZY_MIN_FILE_SIZE = 4096 FUZZY_MIN_FILE_SIZE = 4096
HEADER_FORMAT = "\n%s" + " " * 11 + "%s\n" HEADER_FORMAT = "\n%s" + " " * 11 + "%s\n"
RESULT_FORMAT = "%.3d%%" + " " * 17 + "%s\n" RESULT_FORMAT = "%d%%" + " " * 17 + "%s\n"
HEADER = ["SIMILARITY", "FILE NAME"] HEADER = ["SIMILARITY", "FILE NAME"]
RESULT = ["percentage", "description"] RESULT = ["percentage", "description"]
...@@ -103,6 +103,13 @@ class HashMatch(Module): ...@@ -103,6 +103,13 @@ class HashMatch(Module):
def _show_result(self, match, fname): def _show_result(self, match, fname):
if self.abspath: if self.abspath:
fname = os.path.abspath(fname) fname = os.path.abspath(fname)
# Add description string padding for alignment
if match < 100:
fname = ' ' + fname
if match < 10:
fname = ' ' + fname
self.result(percentage=match, description=fname) self.result(percentage=match, description=fname)
def _compare_files(self, file1, file2): def _compare_files(self, file1, file2):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment