Commit 9420878d by devttys0

Fixed entropy sys.exit bug

parent 32f91494
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
^ext2 filesystem:ext2:mkdir ext2-root && mount -t ext2 '%e' ext2-root ^ext2 filesystem:ext2:mkdir ext2-root && mount -t ext2 '%e' ext2-root
^romfs filesystem:romfs:mkdir romfs-root && mount -t romfs '%e' romfs-root ^romfs filesystem:romfs:mkdir romfs-root && mount -t romfs '%e' romfs-root
# Use sviehb's jefferson.py tool for JFFS2 extraction
^jffs2 filesystem:jffs2:jefferson.py -d '%%jffs2-root%%' '%e'
# These were extractors used from FMK that still need suitable replacements. # These were extractors used from FMK that still need suitable replacements.
#^bff volume entry:bff:/opt/firmware-mod-kit/src/bff/bffxtractor.py '%e' #^bff volume entry:bff:/opt/firmware-mod-kit/src/bff/bffxtractor.py '%e'
#^wdk file system:wdk:/opt/firmware-mod-kit/src/firmware-tools/unwdk.py '%e' #^wdk file system:wdk:/opt/firmware-mod-kit/src/firmware-tools/unwdk.py '%e'
......
...@@ -135,7 +135,10 @@ class Entropy(Module): ...@@ -135,7 +135,10 @@ class Entropy(Module):
if not self.save_plot: if not self.save_plot:
from pyqtgraph.Qt import QtGui from pyqtgraph.Qt import QtGui
QtGui.QApplication.instance().exec_() QtGui.QApplication.instance().exec_()
pg.exit() # Calling pg.exit causes a sys.exit. If using the binwalk module
# from a script, this is probably undesirable. Are there any negative
# side effect to *not* calling pg.exit?
#pg.exit()
def calculate_file_entropy(self, fp): def calculate_file_entropy(self, fp):
# Tracks the last displayed rising/falling edge (0 for falling, 1 for rising, None if nothing has been printed yet) # Tracks the last displayed rising/falling edge (0 for falling, 1 for rising, None if nothing has been printed yet)
......
...@@ -120,14 +120,13 @@ class Extractor(Module): ...@@ -120,14 +120,13 @@ class Extractor(Module):
else: else:
size = r.size size = r.size
if r.valid:
binwalk.core.common.debug("Extractor callback for %s:%d [%s & %s & %s]" % (r.file.name, r.offset, str(r.valid), str(r.display), str(r.extract)))
# Only extract valid results that have been marked for extraction and displayed to the user. # Only extract valid results that have been marked for extraction and displayed to the user.
# Note that r.display is still True even if --quiet has been specified; it is False if the result has been # Note that r.display is still True even if --quiet has been specified; it is False if the result has been
# explicitly excluded via the -y/-x options. # explicitly excluded via the -y/-x options.
if r.valid and r.extract and r.display: if r.valid and r.extract and r.display:
# Attempt extraction # Attempt extraction
binwalk.core.common.debug("Extractor callback for %s @%d [%s]" % (r.file.name, r.offset, r.description))
(extraction_directory, dd_file) = self.extract(r.offset, r.description, r.file.path, size, r.name) (extraction_directory, dd_file) = self.extract(r.offset, r.description, r.file.path, size, r.name)
# If the extraction was successful, self.extract will have returned the output directory and name of the dd'd file # If the extraction was successful, self.extract will have returned the output directory and name of the dd'd file
......
...@@ -151,7 +151,7 @@ class UnJFFS2Plugin(binwalk.core.plugin.Plugin): ...@@ -151,7 +151,7 @@ class UnJFFS2Plugin(binwalk.core.plugin.Plugin):
MODULES = ['Signature'] MODULES = ['Signature']
def init(self): def init(self):
if self.module.extractor.enabled: if False: #self.module.extractor.enabled:
self.module.extractor.add_rule(txtrule=None, self.module.extractor.add_rule(txtrule=None,
regex='^jffs2 filesystem', regex='^jffs2 filesystem',
extension='jffs2', extension='jffs2',
......
...@@ -11,3 +11,5 @@ try: ...@@ -11,3 +11,5 @@ try:
print ("\t%s 0x%.8X %s [%s]" % (result.file.name, result.offset, result.description, str(result.valid))) print ("\t%s 0x%.8X %s [%s]" % (result.file.name, result.offset, result.description, str(result.valid)))
except binwalk.ModuleException as e: except binwalk.ModuleException as e:
pass pass
print "Done."
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