Commit 56f5f34b by heffnercj

Fixed setup.py bug in setting python2 interpreter over multiple runs of setup.py

parent 1901cfdd
...@@ -108,13 +108,14 @@ class PrettyPrint: ...@@ -108,13 +108,14 @@ class PrettyPrint:
else: else:
self.fp.write(data) self.fp.write(data)
def _pprint(self, data): def _pprint(self, data, nolog=False, noprint=False):
''' '''
Print data to stdout and the log file. Print data to stdout and the log file.
''' '''
if not self.quiet: if not self.quiet and not noprint:
sys.stdout.write(data) sys.stdout.write(data)
self._log(data) if not nolog:
self._log(data)
def _file_md5(self, file_name): def _file_md5(self, file_name):
''' '''
...@@ -214,11 +215,19 @@ class PrettyPrint: ...@@ -214,11 +215,19 @@ class PrettyPrint:
Returns None. Returns None.
''' '''
nolog = False
md5sum = self._file_md5(file_name)
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
if self.log_csv:
nolog = True
self._pprint("%s %s %s" % (file_name, md5sum, timestamp), noprint=True)
self._pprint("\n") self._pprint("\n")
self._pprint("Scan Time: %s\n" % datetime.now().strftime("%Y-%m-%d %H:%M:%S")) self._pprint("Scan Time: %s\n" % timestamp, nolog=nolog)
self._pprint("Signatures: %d\n" % self.binwalk.parser.signature_count) self._pprint("Signatures: %d\n" % self.binwalk.parser.signature_count, nolog=nolog)
self._pprint("Target File: %s\n" % file_name) self._pprint("Target File: %s\n" % file_name, nolog=nolog)
self._pprint("MD5 Checksum: %s\n" % self._file_md5(file_name)) self._pprint("MD5 Checksum: %s\n" % md5sum, nolog=nolog)
def header(self, file_name=None, header=None, description=DEFAULT_DESCRIPTION_HEADER): def header(self, file_name=None, header=None, description=DEFAULT_DESCRIPTION_HEADER):
''' '''
......
...@@ -112,7 +112,7 @@ if python2_path and binwalk_path: ...@@ -112,7 +112,7 @@ if python2_path and binwalk_path:
for line in open(binwalk_path, 'rb').readlines(): for line in open(binwalk_path, 'rb').readlines():
if i == 0: if i == 0:
line = line.replace("python", "python2") line = "#!/usr/bin/env python2\n"
data += line data += line
i += 1 i += 1
......
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