hugsy / gef-extras

Extra goodies for GEF to (try to) make GDB suck even less
https://hugsy.github.io/gef-extras
MIT License
148 stars 50 forks source link

retdec does not decompile binary from path that contains a space #32

Closed khaoticdude closed 3 years ago

khaoticdude commented 3 years ago

Step 1: Describe your environment

Step 2: Describe your problem

The decompile -a command does not appear to handle the path to the binary well

Steps to reproduce

  1. Try to decompile a binary that is within a path with spaces

This "canary" binary is located at: "/home/khaotic/labs/Linux Exploit Development/Test_Linux_Program/" image

khaoticdude commented 3 years ago

Just realized I posed on the wrong repo and not the get-extras one. Should I reopen it there?

hugsy commented 3 years ago

Just realized I posed on the wrong repo and not the get-extras one. Should I reopen it there?

Done.

Also I've never used this plugin, I'll let someone who has help you out.

hugsy commented 3 years ago

At first sight, it looks like an easy bug to fix: in https://github.com/hugsy/gef-extras/blob/master/scripts/retdec.py#L94 try replacing:

fname = "{}/{}.{}".format(path, os.path.basename(params["input_file"]), params["target_language"])

with

fname = "'{}/{}.{}'".format(path, os.path.basename(params["input_file"]), params["target_language"])
khaoticdude commented 3 years ago

That did not fix the issue.

image

Grazfather commented 3 years ago

This is an easy fix, but I am not in a position to fix/test right now.

Do you know python? You just need to use shlex.quote on the fname when building the command, but NOT until after line 105, though the proper solution would be to not use shell=True in the subprocess invocation.

hugsy commented 3 years ago

See PR #33