Commit 283b1ee2 by devttys0

Fixed hexdiff colorization bug

parent 15a1d97a
...@@ -82,21 +82,26 @@ class HexDiff(Module): ...@@ -82,21 +82,26 @@ class HexDiff(Module):
return False return False
def hexascii(self, target_data, byte, offset): def hexascii(self, target_data, byte, offset):
diff_count = 0 color = "green"
for (fp, data) in iterator(target_data): for (fp_i, data_i) in iterator(target_data):
try: diff_count = 0
if data[offset] != byte:
for (fp_j, data_j) in iterator(target_data):
if fp_i == fp_j:
continue
try:
if data_i[offset] != data_j[offset]:
diff_count += 1
except IndexError as e:
diff_count += 1 diff_count += 1
except IndexError as e:
diff_count += 1
if diff_count == len(target_data)-1: if diff_count == len(target_data)-1:
color = "red" color = "red"
elif diff_count > 0: elif diff_count > 0:
color = "blue" color = "blue"
else: break
color = "green"
hexbyte = self.colorize("%.2X" % ord(byte), color) hexbyte = self.colorize("%.2X" % ord(byte), color)
......
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