lifting-bits / mcsema

Framework for lifting x86, amd64, aarch64, sparc32, and sparc64 program binaries to LLVM bitcode
https://www.trailofbits.com/expertise/mcsema
GNU Affero General Public License v3.0
2.64k stars 342 forks source link

WSLv1 + Windows IDA Pro Path Issues #738

Open SaifRushdHadad opened 3 years ago

SaifRushdHadad commented 3 years ago

To my understanding: the documentation for building McSema on windows natively is out of date, no documentation about cross compilation, and no precompiled windows binaries. I have a Windows IDA Pro license and am running McSema (v3.0.22) on WSLv1. Issues arise due to the mcsema-disass-3 script passing arguments to IDA Pro that contain 'Linux format' paths.

  1. mcsema-disass-3 passes the path to get_cfg.py in Linux 'format' to a Windows native install of IDA Pro, due to pathing IDA is unable to locate the script.
  2. mcsema-disass-3 also makes a temporary copy of the target binary in /tmp/tmp<> and passes the path in Linux 'format' to IDA, which due to pathing, is unable to locate it.
export PYTHONPATH="/mnt/c/mcsema/mcsema/lib/python3/site-packages"
export IDA_PATH="/mnt/c/idapro"
vagrant@vagrant:/mnt/c/mcsema-test$ /mnt/c/mcsema/mcsema/bin/mcsema-disass-3 \
>     --disassembler "${IDA_PATH}/idat.exe" \
>     --arch x86 \
>     --os windows \
>     --entrypoint wWinMain \
>     --binary helloworld.exe \
>     --output helloworld.cfg \
>     --log_file log
Traceback (most recent call last):
  File "/mnt/c/mcsema/mcsema/lib/python3/site-packages/mcsema_disass-3.1.3.6-py3.6.egg/mcsema_disass/ida7/disass.py", line 81, in execute
    cwd=os.path.dirname(__file__))
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/mnt/c/idapro/idat.exe -B -S"/mnt/c/mcsema/mcsema/lib/python3/site-packages/mcsema_disass-3.1.3.6-py3.6.egg/mcsema_disass/ida7/get_cfg.py --output /mnt/c/mcsema-test/helloworld.cfg --log_file /mnt/c/mcsema-test/log --arch x86 --os windows --entrypoint wWinMain" /tmp/tmpc802_hvj/helloworld.exe' returned non-zero
 exit status 1.
Could not generate a CFG. Try using the --log_file option to see an error log.
Frankenstein-bit commented 3 years ago

hi,have you solved the problem?