Closed khaoticdude closed 3 years ago
Just pushed the fix
Do something like this
diff --git a/scripts/retdec.py b/scripts/retdec.py
index df17fdf..b735084 100644
--- a/scripts/retdec.py
+++ b/scripts/retdec.py
@@ -48,9 +48,6 @@ class RetDecCommand(GenericCommand):
"raw_endian": "big" if is_big_endian() else "little",
}
- raw_cmd = "{} -m {} --raw-section-vma {} --raw-entry-point {} -e {} -f plain -a {} -o {} -l {} {} --cleanup"
- bin_cmd = "{} -m {} -e {} -f plain -a {} -o {} -l {} {} --cleanup"
-
opts = getopt.getopt(argv, "r:s:ah")[0]
if not opts:
self.usage()
@@ -94,9 +91,32 @@ class RetDecCommand(GenericCommand):
fname = "{}/{}.{}".format(path, os.path.basename(params["input_file"]), params["target_language"])
logfile = "{}/{}.log".format(path, os.path.basename(params["input_file"]))
if params["mode"] == "bin":
- cmd = bin_cmd.format(retdec_decompiler, params["mode"], params["raw_endian"], params["architecture"], fname, params["target_language"], params["input_file"])
+ cmd = [
+ retdec_decompiler,
+ "-m", params["mode"],
+ "-e", params["raw_endian"],
+ "-f", "plain",
+ "-a", params["architecture"],
+ "-o", fname,
+ "-l", params["target_language"],
+ params["input_file"],
+ "--cleanup"
+ ]
else:
- cmd = raw_cmd.format(retdec_decompiler, params["mode"], params["raw_section_vma"], params["raw_entry_point"], params["raw_endian"], params["architecture"], fname, params["target_language"], params["input_file"])
+ cmd = [
+ retdec_decompiler,
+ "-m", params["mode"],
+ "--raw-section-vma", params["raw_section_vma"],
+ "--raw-entry-point", params["raw_entry_point"],
+ "-e", params["raw_endian"],
+ "-f", "plain",
+ "-a", params["architecture"],
+ "-o", fname,
+ "-l", params["target_language"],
+ params["input_file"],
+ "--cleanup"
+ ]
+
if self.send_to_retdec(params, cmd, logfile) is False:
return
@@ -121,7 +141,7 @@ class RetDecCommand(GenericCommand):
def send_to_retdec(self, params, cmd, logfile):
try:
with open(logfile, "wb") as log:
- subprocess.run(cmd, shell=True, stdout=log)
+ subprocess.run(cmd, stdout=log)
except Exception:
msg = "Error encountered during decompilation. Check the log file at {}".format(logfile)
err(msg)
Just pushed the fix. Should have done this from the beginning!
Sorry about that. Cleaned up the code.
Thanks for the help everyone!
Fixed issue with handing paths that contain spaces, and the issue setting the symbol address for the range_from variable with the -s option