Scripting With the Python API

devttys0 edited this page Nov 20, 2014 · 12 revisions

The Binwalk API in 10 Lines of Code

import binwalk

# Equivalent to: 'binwalk --signature firmware1.bin firmware2.bin'.
# Note the use of 'quiet=True' to suppress normal binwalk output.
for module in binwalk.scan('firmware1.bin',
                           'firmware2.bin',
                           signature=True,
                           quiet=True):

    # binwalk.scan returns a module object for every executed
    # module; in this case, there should be only one, which is
    # the signature module.
    print ("%s Results:" % module.name)

    # Each module has a list of result objects, describing
    # the results returned from the executed module.
    for result in module.results:
        print ("\t%s    0x%.8X    %s" % (result.file.name, 
                                         result.offset, 
                                         result.description))

See the API documentation for more details.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.