forked from ReFirmLabs/binwalk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed cpio jump offset error; updated testing scripts
- Loading branch information
Showing
12 changed files
with
88 additions
and
14,078 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
|
||
import os | ||
import binwalk | ||
from os.path import dirname | ||
from nose.tools import eq_, ok_ | ||
|
||
def test_firmware_gzip(): | ||
''' | ||
Test: Open firmware.gzip, scan for signatures | ||
verify that all (and only) expected signatures are detected | ||
''' | ||
expected_results = [ | ||
[0, 'uImage header, header size: 64 bytes, header CRC: 0x29953343, created: 2011-06-27 07:33:02, image size: 6395843 bytes, Data Address: 0x40100000, Entry Point: 0x408A6270, data CRC: 0x3D73C1BC, OS: Linux, image type: OS Kernel Image, compression type: gzip, image name: "Unknown - IP7160_DIR855_F_Board"'], | ||
[64, 'gzip compressed data, maximum compression, from Unix, last modified: 2011-06-27 07:33:00'], | ||
input_vector_file = os.path.join(os.path.dirname(__file__), | ||
"input-vectors", | ||
"firmware.gzip") | ||
|
||
] | ||
|
||
scan_result = binwalk.scan(dirname(__file__) + '/input-vectors/firmware.gzip', | ||
scan_result = binwalk.scan(input_vector_file, | ||
signature=True, | ||
quiet=True) | ||
|
||
# Test number of modules used | ||
eq_(len(scan_result), 1) | ||
|
||
# Test number of results for that module | ||
eq_(len(scan_result[0].results), len(expected_results)) | ||
# There should be only one result | ||
eq_(len(scan_result[0].results), 1) | ||
|
||
# That result should be at offset 0 | ||
eq_(scan_result[0].results[0].offset, 0) | ||
|
||
# Test result-description | ||
for i in range(0, len(scan_result[0].results)): | ||
eq_(scan_result[0].results[i].offset, expected_results[i][0]) | ||
eq_(scan_result[0].results[i].description, expected_results[i][1]) | ||
# That result should be a gzip file | ||
ok_(scan_result[0].results[0].description.startswith("gzip compressed data")) |
Oops, something went wrong.