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

decompile.sh: "retdec/scripts/fileinfo: No such file or directory" #5

Closed
mewmew opened this issue Dec 12, 2017 · 5 comments
Closed

Comments

@mewmew
Copy link

mewmew commented Dec 12, 2017

I really wanted to try out retdec, the compile finished successfully -- without any manual intervention -- after 1.5 hours.

[100%] Built target llvmir2hlltool
real 5700.87
user 5640.37
sys 320.04

However, when trying to use decompile.sh on a test binary, I got the following error:

##### Gathering file information...
RUN: /home/u/Desktop/retdec_play/retdec/scripts/fileinfo -c /home/u/Desktop/foo.c.json --similarity /home/u/Desktop/foo.exe --no-hashes=all --crypto /home/u/Desktop/retdec_play/retdec/scripts/../share/generic/yara_patterns/signsrch/signsrch.yara
/home/u/Desktop/retdec_play/retdec/scripts/decompile.sh: line 667: /home/u/Desktop/retdec_play/retdec/scripts/fileinfo: No such file or directory
@mewmew
Copy link
Author

mewmew commented Dec 12, 2017

With the following patch, it runs further.

diff --git a/scripts/config.sh b/scripts/config.sh
old mode 100644
new mode 100755
index 3db20e5..5f3a2b4
--- a/scripts/config.sh
+++ b/scripts/config.sh
@@ -78,7 +78,7 @@ BIN2LLVMIR_PARAMS="$BIN2LLVMIR_PARAMS_DISABLES -inst-opt -verify $BIN2LLVMIR_VOL
 # The following options are useful during debugging of bin2llvmirl optimizations.
 #BIN2LLVMIR_PARAMS+="-print-after-all -debug-only=idioms -print-before=idioms -print-after=idioms"
 
-FILEINFO="$INSTALL_BIN_DIR/fileinfo"
+FILEINFO="$INSTALL_BIN_DIR/fileinfo.sh"
 FILEINFO_EXTERNAL_YARA_PRIMARY_CRYPTO_DATABASES=(
        "$INSTALL_SHARE_YARA_DIR/signsrch/signsrch.yara"
 )

But stops with the following error:

##### Gathering file information...
RUN: /home/u/Desktop/retdec_play/retdec/scripts/fileinfo.sh -c /home/u/Desktop/foo.c.json --similarity /home/u/Desktop/foo.exe --no-hashes=all --crypto /home/u/Desktop/retdec_play/retdec/scripts/../share/generic/yara_patterns/signsrch/signsrch.yara
/home/u/Desktop/retdec_play/retdec/scripts/utils.sh: line 55: /home/u/Desktop/retdec_play/retdec/scripts/ar-extractor: No such file or directory

Is there something in the installation step I'm missing?

I installed retdec with the following command sequence:

$ git clone --recursive https://github.com/avast-tl/retdec
$ cd retdec
$ mkdir build && cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=<path>
$ make

And invoke retdec/scripts/decompile.sh foo.exe.

@mewmew
Copy link
Author

mewmew commented Dec 12, 2017

For reference, ar-extractor is located in build/deps/fileformat/src/ar-extractortool/ar-extractor on my system:

u@x220 ~/D/r/retdec> find . -type f -name 'ar-extractor*'
./build/deps/fileformat/src/ar-extractortool/ar-extractor

Should there be a symlink or should this file be copied to the scripts directory?

@mewmew
Copy link
Author

mewmew commented Dec 12, 2017

And, after a manual copy of ar-extractor to the scripts directory, the following error surfaced.

##### Gathering file information...
RUN: /home/u/Desktop/retdec_play/retdec/scripts/fileinfo.sh -c /home/u/Desktop/foo.c.json --similarity /home/u/Desktop/foo.exe --no-hashes=all --crypto /home/u/Desktop/retdec_play/retdec/scripts/../share/generic/yara_patterns/signsrch/signsrch.yara
Error: Invalid argument '/home/u/Desktop/retdec_play/retdec/scripts/../share/generic/yara_patterns/signsrch/signsrch.yara'.

@s3rvac
Copy link
Member

s3rvac commented Dec 13, 2017

Thank you for your report. It seems to me that you forgot to install the decompiler via make install. You cannot run decompile.sh from the scripts directory. Instead, you have to run the script from the bin directory, which is created after you install the decompiler.

For example, if you did

cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/retdec-install
make
make install

then you would decompile files via

/path/to/retdec-install/bin/decompile.sh file.exe

No manual patching is needed.

@mewmew
Copy link
Author

mewmew commented Dec 13, 2017

Thanks! Now it works.

I put a retdec-git package up on AUR for Arch Linux users.

Cheers,
/u

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

3 participants