Skip to content

Commit

Permalink
Merge pull request #759 from kayarre/python_scripts
Browse files Browse the repository at this point in the history
fix: mislabeled scripts and writing strings versus bytes
  • Loading branch information
s3rvac authored May 3, 2020
2 parents 7719bed + 8fc10d9 commit 46b13c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions scripts/retdec-archive-decompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,17 @@ def decompile_archive(self):
# We have to use indexes instead of names because archives can contain multiple files with same name.
log_file = self.library_path + '.file_' + str(file_index) + '.log.verbose'

# Do not escape!
output, rc, timeouted = CmdRunner.run_cmd([sys.executable, config.DECOMPILER, '--ar-index=' + str(i), '-o',
arg_list_ = [sys.executable, config.DECOMPILER, '--ar-index=' + str(i), '-o',
self.library_path + '.file_' + str(file_index) + '.c',
self.library_path] + self.decompiler_args,
self.library_path]
if self.decompiler_args:
arg_list_.append(self.decompiler_args)
# Do not escape!
output, rc, timeouted = CmdRunner.run_cmd(arg_list_,
timeout=self.timeout,
buffer_output=True)

with open(log_file, 'wb') as f:
with open(log_file, 'w') as f:
f.write(output)

if timeouted:
Expand Down
8 changes: 4 additions & 4 deletions scripts/retdec-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@
PAT2YARA = os.path.join(INSTALL_BIN_DIR, 'retdec-pat2yara')
CONFIGTOOL = os.path.join(INSTALL_BIN_DIR, 'retdec-config')
EXTRACT = os.path.join(INSTALL_BIN_DIR, 'retdec-macho-extractor')
DECOMPILER = os.path.join(INSTALL_BIN_DIR, 'retdec_decompiler.py')
ARCHIVE_DECOMPILER = os.path.join(INSTALL_BIN_DIR, 'retdec_archive_decompiler.py')
SIG_FROM_LIB = os.path.join(INSTALL_BIN_DIR, 'retdec_signature_from_library_creator.py')
UNPACK = os.path.join(INSTALL_BIN_DIR, 'retdec_unpacker.py')
DECOMPILER = os.path.join(INSTALL_BIN_DIR, 'retdec-decompiler.py')
ARCHIVE_DECOMPILER = os.path.join(INSTALL_BIN_DIR, 'retdec-archive-decompiler.py')
SIG_FROM_LIB = os.path.join(INSTALL_BIN_DIR, 'retdec-signature-from-library-creator.py')
UNPACK = os.path.join(INSTALL_BIN_DIR, 'retdec-unpacker.py')
LLVMIR2HLL = os.path.join(INSTALL_BIN_DIR, 'retdec-llvmir2hll')
BIN2LLVMIR = os.path.join(INSTALL_BIN_DIR, 'retdec-bin2llvmir')
UNPACKER = os.path.join(INSTALL_BIN_DIR, 'retdec-unpacker')
Expand Down

0 comments on commit 46b13c1

Please sign in to comment.