Commit 596489cc by Craig Heffner

Updated status server output, currently only works with signature scans; added MPFS validation.

parent 7852904f
......@@ -379,7 +379,7 @@ class Module(object):
# Reset all dependencies prior to continuing with another file.
# This is particularly important for the extractor module, which must be reset
# in order to reset it's base output directory path for each file, and the
# in order to reset its base output directory path for each file, and the
# list of pending files.
self.reset_dependencies()
......@@ -407,10 +407,12 @@ class Module(object):
if fp is not None:
self.current_target_file_name = fp.path
print "self.status.fp = %s" % fp.path
self.status.fp = fp
else:
self.current_target_file_name = None
self.status.fp = fp
print "self.status.fp = None"
self.status.fp = None
self.previous_next_file_fp = fp
......@@ -462,6 +464,7 @@ class Module(object):
if r.offset and r.file and self.AUTO_UPDATE_STATUS:
self.status.total = r.file.length
self.status.completed = r.offset
self.status.fp = r.file
if r.display:
display_args = self._build_display_args(r)
......@@ -609,7 +612,7 @@ class Modules(object):
self.arguments = []
self.executed_modules = {}
self.default_dependency_modules = {}
self.status = Status(completed=0, total=0, file=None)
self.status = Status(completed=0, total=0, fp=None)
self.status_server_started = False
self.status_service = None
......
# Provides scan status information via a TCP socket service.
import sys
import time
import threading
import SocketServer
......@@ -7,7 +8,7 @@ import SocketServer
class StatusRequestHandler(SocketServer.BaseRequestHandler):
def handle(self):
message_format = 'Binwalk scan progress: %3d%% Currently at byte %d of %d total bytes in file %s'
message_format = "%s %3d%% [ %d / %d ]"
last_status_message_len = 0
status_message = ''
......@@ -20,16 +21,17 @@ class StatusRequestHandler(SocketServer.BaseRequestHandler):
self.request.send('\b' * last_status_message_len)
percentage = ((float(self.server.binwalk.status.completed) / float(self.server.binwalk.status.total)) * 100)
status_message = message_format % (percentage,
status_message = message_format % (self.server.binwalk.status.fp.path,
percentage,
self.server.binwalk.status.completed,
self.server.binwalk.status.total,
self.server.binwalk.status.fp.path)
self.server.binwalk.status.total)
last_status_message_len = len(status_message)
self.request.send(status_message)
except KeyboardInterrupt as e:
raise e
except Exception as e:
#sys.stderr.write(str(e) + "\n")
pass
return
......
......@@ -68,8 +68,11 @@
# MPFS file system
0 string MPFS MPFS filesystem, Microchop,
>4 byte <0 {invalid}
>5 byte <0 {invalid}
>4 byte x version %d.
>5 byte x \b%d,
>6 leshort <0 {invalid}
>6 leshort x %d file entries
# cramfs filesystem - russell@coker.com.au
......
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