Commit a442dc7e by Craig Heffner

Recursive binwalk scans no longer support block/character devices

parent 31632a32
...@@ -135,11 +135,21 @@ class Extractor(Module): ...@@ -135,11 +135,21 @@ class Extractor(Module):
return return
# Only add this to the pending list of files to scan # Only add this to the pending list of files to scan
# if the file is a regular file or a block/character device. # if the file is a regular file. Special files (block/character
if (stat.S_ISREG(file_mode) or # devices) can be tricky; they may fail to open, or worse, simply
stat.S_ISBLK(file_mode) or # hang when an attempt to open them is made. So for recursive
stat.S_ISCHR(file_mode)): # extraction purposes, they are ignored, albeit with a warning to
# the user.
if stat.S_ISREG(file_mode):
# Make sure we can open the file too...
try:
fp = binwalk.core.common.BlockFile(f)
fp.close()
self.pending.append(f) self.pending.append(f)
except IOError as e:
binwalk.core.common.warning("Ignoring file '%s': %s" % (f, str(e)))
else:
binwalk.core.common.warning("Ignoring file '%s': Not a regular file" % f)
def reset(self): def reset(self):
# Holds a list of pending files that should be scanned; only populated if self.matryoshka == True # Holds a list of pending files that should be scanned; only populated if self.matryoshka == True
......
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