Commit 35fb045b by devttys0

Added plot3d method to Binwalk class.

parent 7736d903
......@@ -56,8 +56,12 @@ Diffing multiple files:
\t$ %s -W firmware1.bin firmware2.bin firmware3.bin
Generating a 3D plot:
\t$ %s --3D firmware.bin
See http://binwalk.org/wiki/usage for more.
""" % (name, name, name, name, name, name, name, name))
""" % (name, name, name, name, name, name, name, name, name))
sys.exit(0)
def main():
......@@ -434,7 +438,9 @@ def main():
elif scan_type == binwalk.Binwalk.BINVIS:
binwalk.plotter.Plotter3D(target_files, offset=offset, length=length, weight=weight, verbose=True).plot()
# Always enable verbose mode; generating the plot can take some time for large files,
# and without verbose mode enabled it looks like binwalk is just sitting there doing nothing.
bwalk.plot3d(target_files, offset=offset, length=length, weight=weight, verbose=True)
elif scan_type == binwalk.Binwalk.ENTROPY:
......
......@@ -10,6 +10,7 @@ from binwalk.update import *
from binwalk.filter import *
from binwalk.parser import *
from binwalk.plugins import *
from binwalk.plotter import *
from binwalk.hexdiff import *
from binwalk.entropy import *
from binwalk.extractor import *
......@@ -287,6 +288,23 @@ class Binwalk(object):
return data
def plot3d(self, target_files, offset=0, length=0, weight=None, verbose=False):
'''
Generates a 3D data plot of the specified target files.
@target_files - File or list of files to scan.
@offset - Starting offset at which to start the scan.
@length - Number of bytes to scan. Specify 0 to scan the entire file(s).
@weight - A data point must occur at least this many times before being plotted (default: auto-detect).
@verbose - Set to True to enable verbose output.
Returns None.
'''
if not isinstance(target_files, type([])):
target_files = [target_files]
Plotter3D(target_files, offset=offset, length=length, weight=weight, verbose=verbose).plot()
def scan(self, target_files, offset=0, length=0, show_invalid_results=False, callback=None, start_callback=None, end_callback=None, base_dir=None, matryoshka=1, plugins_whitelist=[], plugins_blacklist=[]):
'''
Performs a binwalk scan on a file or list of files.
......
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