Commit e59b1483 by devttys0

Fixed python3 bug

parent 325b4424
......@@ -3,12 +3,13 @@
import sys
import binwalk
from threading import Thread
from binwalk.core.compat import user_input
def display_status(m):
# Display the current scan progress when the enter key is pressed.
while True:
try:
raw_input()
user_input()
sys.stderr.write("Progress: %.2f%% (%d / %d)\n\n" % (((float(m.status.completed) / float(m.status.total)) * 100), m.status.completed, m.status.total))
except KeyboardInterrupt as e:
raise e
......@@ -31,9 +32,7 @@ def main():
if len(sys.argv) == 1:
usage(modules)
elif not modules.execute():
for module in modules.execute(*sys.argv[1:], signature=True):
for result in module.results:
print result.description
modules.execute(*sys.argv[1:], signature=True)
except binwalk.ModuleException as e:
sys.exit(1)
......@@ -47,4 +46,5 @@ if __name__ == '__main__':
else:
main()
except KeyboardInterrupt:
print("")
sys.stdout.write("\n")
......@@ -7,10 +7,7 @@ import string
PY_MAJOR_VERSION = sys.version_info[0]
if PY_MAJOR_VERSION > 2:
import urllib.request as urllib2
string.letters = string.ascii_letters
else:
import urllib2
def iterator(dictionary):
'''
......@@ -66,3 +63,12 @@ def string_decode(string):
else:
return string.decode('string_escape')
def user_input(prompt=''):
'''
For getting raw user input in Python 2 and 3.
'''
if PY_MAJOR_VERSION > 2:
return input(prompt)
else:
return raw_input(prompt)
......@@ -2,7 +2,7 @@ import ctypes
import ctypes.util
from binwalk.core.common import *
class Plugin:
class Plugin(object):
'''
Searches for and validates compress'd data.
'''
......
class Plugin:
class Plugin(object):
'''
Ensures that ASCII CPIO archive entries only get extracted once.
'''
......
......@@ -3,7 +3,7 @@ import shutil
from binwalk.core.compat import *
from binwalk.core.common import BlockFile
class Plugin:
class Plugin(object):
'''
Finds and extracts modified LZMA files commonly found in cable modems.
Based on Bernardo Rodrigues' work: http://w00tsec.blogspot.com/2013/11/unpacking-firmware-images-from-cable.html
......
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