Commit 5860c32d by devttys0

Fixed graphing bugs

parent afc5ad77
......@@ -54,13 +54,15 @@ class Option(object):
if self.type and (self.type.__name__ == self.dtype):
# Be sure to specify a base of 0 for int() so that the base is auto-detected
if self.type == int:
return self.type(value, 0)
t = self.type(value, 0)
else:
return self.type(value)
elif default_value:
return default_value
t = self.type(value)
elif default_value is not None:
t = default_value
else:
return value
t = value
return t
class Kwarg(object):
'''
......@@ -766,6 +768,7 @@ class Modules(object):
except Exception as e:
raise ModuleException("Invalid usage: %s" % str(e))
binwalk.core.common.debug("%s :: %s => %s" % (module.TITLE, str(argv), str(kwargs)))
return kwargs
def kwargs(self, obj, kwargs):
......
......@@ -156,6 +156,7 @@ class Entropy(Module):
def plot_entropy(self, fname):
import numpy as np
import binwalk.pyqtgraph as pg
import binwalk.pyqtgraph.exporters as exporters
i = 0
x = []
......@@ -195,7 +196,7 @@ class Entropy(Module):
# TODO: legend is not displayed properly when saving plots to disk
if self.save_plot:
exporter = pg.exporters.ImageExporter.ImageExporter(plt.plotItem)
exporter = exporters.ImageExporter.ImageExporter(plt.plotItem)
exporter.parameters()['width'] = self.FILE_WIDTH
exporter.export(binwalk.core.common.unique_file_name(os.path.basename(fname), self.FILE_FORMAT))
else:
......
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