From e1f8c0d97874aea3133a789613a3e3077e1558ac Mon Sep 17 00:00:00 2001
From: devttys0 <heffnercj@gmail.com>
Date: Mon, 25 Aug 2014 14:19:49 -0400
Subject: [PATCH] Fixed extraction bug

---
 src/binwalk/core/module.py       | 6 ------
 src/binwalk/modules/extractor.py | 8 +++++---
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/binwalk/core/module.py b/src/binwalk/core/module.py
index e5f66d1..803e747 100644
--- a/src/binwalk/core/module.py
+++ b/src/binwalk/core/module.py
@@ -400,12 +400,6 @@ class Module(object):
                 if display_args:
                     self.config.display.format_strings(self.HEADER_FORMAT, self.RESULT_FORMAT)
                     self.config.display.result(*display_args)
-            else:
-                # If this specific result has been marked to not be displayed to the user (e.g., 
-                # it has been excluded via a -x or -y option), then disable extraction as well.
-                # Note that this does not effect results that are not displayed globally (i.e.,
-                # if --quiet was specified).
-                r.extract = False
 
         return r
 
diff --git a/src/binwalk/modules/extractor.py b/src/binwalk/modules/extractor.py
index 669e7c8..e83bb6a 100644
--- a/src/binwalk/modules/extractor.py
+++ b/src/binwalk/modules/extractor.py
@@ -116,9 +116,11 @@ class Extractor(Module):
 
         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
-        if r.valid and r.extract:
+       
+        # 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
+        # explicitly excluded via the -y/-x options.
+        if r.valid and r.extract and r.display:
             # Do the extraction
             binwalk.core.common.debug("Attempting extraction...")
             (extraction_directory, dd_file) = self.extract(r.offset, r.description, r.file.name, size, r.name)
--
libgit2 0.26.0