Skip to content
Snippets Groups Projects
Commit 07c05626 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

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

parent 59a2042f
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment