Commit 8e52d4b1 by devttys0

Extract module creates separate output directories; fixed bug in BlockFile.seek

parent cfedd0ff
......@@ -358,7 +358,7 @@ class BlockFile(io.FileIO):
def seek(self, n, whence=os.SEEK_SET):
if whence == os.SEEK_SET:
self.total_read = n
self.total_read = n - self.offset
elif whence == os.SEEK_CUR:
self.total_read += n
elif whence == os.SEEK_END:
......
......@@ -462,14 +462,12 @@ class Modules(object):
def load(self, module):
kwargs = self.argv(module, argv=self.arguments)
kwargs.update(self.dependencies(module))
print "Loading", module
return module(**kwargs)
def dependencies(self, module):
import binwalk.modules
kwargs = {}
print "Loading dependency:", module
if hasattr(module, "DEPENDS"):
for (kwarg, dependency) in iterator(module.DEPENDS):
......
......@@ -112,13 +112,15 @@ class Signature(binwalk.module.Module):
r.valid = False
def scan_file(self, fp):
current_file_offset = 0
while True:
(data, dlen) = fp.read_block()
if not data:
break
current_block_offset = 0
block_start = fp.total_read - dlen
block_start = fp.offset + fp.total_read - dlen
self.status.completed = block_start - fp.offset
for candidate_offset in self.parser.find_signature_candidates(data, dlen):
......
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