Commit 07c05626 authored by Chris Lamb's avatar Chris Lamb 💬

Improve names in output of "internal" binwalk members. (Closes: #877525)

parent 59a2042f
......@@ -89,7 +89,10 @@ class BinwalkFile(File):
)
members = {
os.path.basename(x): x
'{} file embedded at offset {}'.format(
os.path.splitext(x)[1],
os.path.basename(os.path.splitext(x)[0]),
): x
for x in glob.glob(os.path.join(unpacked.name, '*/*'))
}
......@@ -103,3 +106,13 @@ class BinwalkFile(File):
file._unpacked = unpacked
return True
def compare(self, other, source=None):
difference = super().compare(other, source)
if difference is not None:
difference.add_comment(
"comprises of {} embedded members".format(len(self._members))
)
return difference
......@@ -50,8 +50,9 @@ def comparison(binwalk1, binwalk2):
@skip_unless_module_exists('binwalk')
def test_listing(comparison):
differences = comparison.details
assert differences[0].source1 == '0.cpio'
assert differences[1].source2 == '600.cpio'
assert comparison.comments == ["comprises of 2 embedded members"]
assert differences[0].source1 == '.cpio file embedded at offset 0'
assert differences[1].source2 == '.cpio file embedded at offset 600'
expected_diff = get_data('binwalk_expected_diff')
assert differences[0].details[0].unified_diff == expected_diff
......
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