Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest version of retdec does not seem to work with GEF-Extras #95

Open
0DAYBROKER opened this issue Oct 25, 2023 · 0 comments
Open

Latest version of retdec does not seem to work with GEF-Extras #95

0DAYBROKER opened this issue Oct 25, 2023 · 0 comments

Comments

@0DAYBROKER
Copy link

Hi, I'm using the latest version of GEF and GEF-Extras on x86-64 Arch Linux (WSL). The first Issue I'm having is that GEF-Extras is looking for a retdec-decompiler.py file inside the retdec/bin directory but in the latest release of retdec, the decompiler file is not a Python file, but an ELF binary simply called retdec-decompiler. It was easy to circumvent though. I just renamed the file from retdec-decompiler to retdec-decompiler.py but then an other issue occurred. When I ran retdec -a inside an active debug session, I got the following output:

gef➤  retdec -a
[*] retdec.py:L52 'is_big_endian' is deprecated and will be removed in a feature release. Prefer `gef.arch.endianness == Endianness.BIG_ENDIAN`
[+] Saved as '/tmp/gef/test.c'
[!] Command 'retdec' failed to execute properly, reason: [Errno 2] No such file or directory: '/tmp/gef/test.c'

I checked the log file saved in /tmp/gef/test.log which looked like this:

/home/hakur/RetDec/bin/retdec-decompiler.py:
Mandatory arguments:
	INPUT_FILE File to decompile.
General arguments:
	[-o|--output FILE] Output file (default: INPUT_FILE.c if OUTPUT_FORMAT is plain, INPUT_FILE.c.json if OUTPUT_FORMAT is json|json-human).
	[-s|--silent] Turns off informative output of the decompilation.
	[-f|--output-format OUTPUT_FORMAT] Output format [plain|json|json-human] (default: plain).
	[-m|--mode MODE] Force the type of decompilation mode [bin|raw] (default: bin).
	[-p|--pdb FILE] File with PDB debug information.
	[-k|--keep-unreachable-funcs] Keep functions that are unreachable from the main function.
	[--cleanup] Removes temporary files created during the decompilation.
	[--config] Specify JSON decompilation configuration file.
	[--disable-static-code-detection] Prevents detection of statically linked code.
Selective decompilation arguments:
	[--select-ranges RANGES] Specify a comma separated list of ranges to decompile (example: 0x100-0x200,0x300-0x400,0x500-0x600).
	[--select-functions FUNCS] Specify a comma separated list of functions to decompile (example: fnc1,fnc2,fnc3).
	[--select-decode-only] Decode only selected parts (functions/ranges). Faster decompilation, but worse results.
Raw or Intel HEX decompilation arguments:
	[-a|--arch ARCH] Specify target architecture [mips|pic32|arm|thumb|arm64|powerpc|x86|x86-64].
	                 Required if it cannot be autodetected from the input (e.g. raw mode, Intel HEX).
	[-e|--endian ENDIAN] Specify target endianness [little|big].
	                     Required if it cannot be autodetected from the input (e.g. raw mode, Intel HEX).
	[-b|--bit-size SIZE] Specify target bit size [16|32|64] (default: 32).
	                     Required if it cannot be autodetected from the input (e.g. raw mode).
	[--raw-section-vma ADDRESS] Virtual address where section created from the raw binary will be placed.
	[--raw-entry-point ADDRESS] Entry point address used for raw binary (default: architecture dependent).
Archive decompilation arguments:
	[--ar-index INDEX] Pick file from archive for decompilation by its zero-based index.
	[--ar-name NAME] Pick file from archive for decompilation by its name.
	[--static-code-sigfile FILE] Adds additional signature file for static code detection.
Backend arguments:
	[--backend-disabled-opts LIST] Prevents the optimizations from the given comma-separated list of optimizations to be run.
	[--backend-enabled-opts LIST] Runs only the optimizations from the given comma-separated list of optimizations.
	[--backend-call-info-obtainer NAME] Name of the obtainer of information about function calls [optim|pessim] (Default: optim).
	[--backend-var-renamer STYLE] Used renamer of variables [address|hungarian|readable|simple|unified] (Default: readable).
	[--backend-no-opts] Disables backend optimizations.
	[--backend-emit-cfg] Emits a CFG for each function in the backend IR (in the .dot format).
	[--backend-emit-cg] Emits a CG for the decompiled module in the backend IR (in the .dot format).
	[--backend-keep-all-brackets] Keeps all brackets in the generated code.
	[--backend-keep-library-funcs] Keep functions from standard libraries.
	[--backend-no-time-varying-info] Do not emit time-varying information, like dates.
	[--backend-no-var-renaming] Disables renaming of variables in the backend.
	[--backend-no-compound-operators] Do not emit compound operators (like +=) instead of assignments.
	[--backend-no-symbolic-names] Disables the conversion of constant arguments to their symbolic names.
Decompilation process arguments:
	[--timeout SECONDS]
	[--max-memory MAX_MEMORY] Limits the maximal memory used by the given number of bytes.
	[--no-memory-limit] Disables the default memory limit (half of system RAM).
LLVM IR debug arguments:
	[--print-after-all] Dump LLVM IR to stderr after every LLVM pass.
	[--print-before-all] Dump LLVM IR to stderr before every LLVM pass.
Other arguments:
	[-h|--help] Show this help.
	[--version] Show RetDec version.

The log doesn't seem to help a lot. Though, it does seem like the decompiler is missing some mandatory command-line arguments or something along those lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant