mcsema icon indicating copy to clipboard operation
mcsema copied to clipboard

mcsema-disass --disassembler dyninst fails on Python 2: "'module' object has no attribute 'run'"

Open zhuowei opened this issue 5 years ago • 2 comments

Python 2 doesn't have the subprocess.run method, so running mcsema-disass with Dyninst fails on Python 2:

https://github.com/lifting-bits/mcsema/blob/2d55d02cc3f5026f15247ce457e36eb045db6ed7/tools/mcsema_disass/main.py#L179

To reproduce:

Download prebuilt McSema v3.0.3 (mcsema-llvm1000-ubuntu20.04-amd64.tar.xz) to Ubuntu 20.04, then run:

PYTHONPATH=$PWD/lib/python2.7/site-packages python2 bin/mcsema-disass --disassembler dyninst --arch x86 --os linux --output ../gzip_disass.cfg --binary ../gzip --log_file ../gzip_disass.log
Traceback (most recent call last):
  File "bin/mcsema-disass", line 11, in <module>
    load_entry_point('mcsema-disass==2.0', 'console_scripts', 'mcsema-disass')()
  File "/home/zhuowei/lift/mcsema/lib/python2.7/site-packages/mcsema_disass-2.0-py2.7.egg/mcsema_disass/__main__.py", line 179, in main
    subprocess.run(pass_args)
AttributeError: 'module' object has no attribute 'run'

zhuowei avatar Aug 16 '20 19:08 zhuowei

@zhuowei Can you submit a PR that changes the code to use subprocess.Popen?

pgoodman avatar Aug 16 '20 20:08 pgoodman

Or perhaps using subprocess.check_call, like the IDA entrypoint uses here: https://github.com/lifting-bits/mcsema/blob/6b272184336c11e7246769bbc188880695578bc7/tools/mcsema_disass/ida7/disass.py#L71-L78

pgoodman avatar Aug 16 '20 20:08 pgoodman