Unverified Commit 5c9c935f by devttys0 Committed by GitHub

Merge pull request #391 from nmatt0/update-api-docs

make API example python3 compliant
parents f42a200b 2d311188
...@@ -86,12 +86,12 @@ Each module object will also have an additional `extractor` attribute, which is ...@@ -86,12 +86,12 @@ Each module object will also have an additional `extractor` attribute, which is
```python ```python
for module in binwalk.scan(sys.argv[1], signature=True, quiet=True, extract=True): for module in binwalk.scan(sys.argv[1], signature=True, quiet=True, extract=True):
for result in module.results: for result in module.results:
if module.extractor.output.has_key(result.file.path): if result.file.path in module.extractor.output:
# These are files that binwalk carved out of the original firmware image, a la dd # These are files that binwalk carved out of the original firmware image, a la dd
if module.extractor.output[result.file.path].carved.has_key(result.offset): if result.offset in module.extractor.output[result.file.path].carved:
print "Carved data from offset 0x%X to %s" % (result.offset, module.extractor.output[result.file.path].carved[result.offset]) print "Carved data from offset 0x%X to %s" % (result.offset, module.extractor.output[result.file.path].carved[result.offset])
# These are files/directories created by extraction utilities (gunzip, tar, unsquashfs, etc) # These are files/directories created by extraction utilities (gunzip, tar, unsquashfs, etc)
if module.extractor.output[result.file.path].extracted.has_key(result.offset): if result.offset in module.extractor.output[result.file.path].extracted:
print "Extracted %d files from offset 0x%X to '%s' using '%s'" % (len(module.extractor.output[result.file.path].extracted[result.offset].files), print "Extracted %d files from offset 0x%X to '%s' using '%s'" % (len(module.extractor.output[result.file.path].extracted[result.offset].files),
result.offset, result.offset,
module.extractor.output[result.file.path].extracted[result.offset].files[0], module.extractor.output[result.file.path].extracted[result.offset].files[0],
......
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