geohot / qira

QEMU Interactive Runtime Analyser
MIT License
3.92k stars 471 forks source link

Howto install Qira on ubuntu 20.04 #258

Open smurfd opened 3 years ago

smurfd commented 3 years ago

This is done on a fresh install of ubuntu 20.04 with installed git. grab these : qira-qemu.txt qira.txt

git clone https://github.com/geohot/qira.git cd qira patch -p1 < ../qira.txt

install.sh will end in error : util/memfd.c:43:12: error: static declaration of ‘memfd_create’ follows non-static declaration

cd tracers/qemu/qemu patch -p1 < ../../../../qira-qemu.txt

cd ../../.. ./install.sh Booom :)

Wgmlgz commented 3 years ago

I tried to use this but I get this error:

ERROR: Command errored out with exit status 1:
 command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-D2fxo9/filelock/setup.py'"'"'; __file__='"'"'/tmp/pip-install-D2fxo9/filelock/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-NbW9l7                                                                                         
     cwd: /tmp/pip-install-D2fxo9/filelock/                                                                                                                      
Complete output (8 lines):                                                                                                                                       
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_suite'                                                                 
  warnings.warn(msg)                                                                                                                                             
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]                                                                                            
   or: setup.py --help [cmd1 cmd2 ...]                                                                                                                           
   or: setup.py --help-commands                                                                                                                                  
   or: setup.py cmd --help                                                                                                                                       

error: invalid command 'egg_info'                                                                                                                                
----------------------------------------                                                                                                                         

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Can you please help me, I am n00b(

smurfd commented 3 years ago

weird, try to in the qira folder: mv venv venv1 then rerun the install.sh

if that does not work, im not sure ...maby you had installed pip2 already!?

Wgmlgz commented 3 years ago

Yes, a have pip2 installed (I comment pip2 installation lines), but now I am getting another error:

util/memfd.c:43:12: error: static declaration of ‘memfd_create’ follows non-static declaration 43 | static int memfd_create(const char name, unsigned int flags) | ^~~~ In file included from /usr/include/x86_64-linux-gnu/bits/mman-linux.h:113, from /usr/include/x86_64-linux-gnu/bits/mman.h:34, from /usr/include/x86_64-linux-gnu/sys/mman.h:41, from /home/wgmlgz/qira/tracers/qemu/qemu/include/qemu/osdep.h:142, from util/memfd.c:28: /usr/include/x86_64-linux-gnu/bits/mman-shared.h:50:5: note: previous declaration of ‘memfd_create’ was here 50 | int memfd_create (const char name, unsigned int flags) __THROW; | ^~~~ make: [/home/wgmlgz/qira/tracers/qemu/qemu/rules.mak:57: util/memfd.o] Error 1 make: Waiting for unfinished jobs....

smurfd commented 3 years ago

from my 1st post :

install.sh will end in error : util/memfd.c:43:12: error: static declaration of ‘memfd_create’ follows non-static declaration

cd tracers/qemu/qemu
patch -p1 < ../../../../qira-qemu.txt

cd ../../..
./install.sh
Wgmlgz commented 3 years ago

I ended up just reinstalling my ubuntu vm and your patches are working! By the way, can you please make patch for kali?

smurfd commented 3 years ago

same works for kali linux also, u just need to grab these and install them before ... since they seem to have screwed up something about their python2 install. http://ftp.us.debian.org/debian/pool/main/p/python-scandir/python-scandir_1.9.0-2_amd64.deb http://ftp.us.debian.org/debian/pool/main/p/python-filelock/python-filelock_3.0.10-1_all.deb

Wgmlgz commented 3 years ago

Man, that's works for kali! Thanks you a lot!

smurfd commented 3 years ago

These will not force python2, but use python3 only

Grab and save to a folder. had to update some stuff in the requirements.txt

qira-py39.txt qira-qemu-py39.txt

Then :

git clone https://github.com/geohot/qira
cd qira/tracers/qemu
git clone https://github.com/geohot/qemu.git --depth 1 --branch qira
cd qemu
patch -p1 < ../../../../qira-qemu-py39.patch
cd ../../..
patch -p1 < ../qira-py39.patch
./install.sh

OBVIOUSLY there might be some subtleties that im missing or have broken. use at own risk, same ofcourse goes for previously pasted patches...

Sidenote: Also tried to build against qemu git main. the trick to building that was to remove the --cpu=unknown and rearrange the symlinks in tracers/qemu to point to point like : qira-aarch64 -> qemu/build/aarch64-linux-user/qemu-aarch64

Something with the webserver/client/update part did not like this however :/ pretty sure it is some python2 to python3 junk that breakts things.

hopinheimer commented 3 years ago

Apparently python-pip has been removed from the repositories for Ubuntu 20.04 and according to the install.sh script python-pip is being used may be that's the reason Ubuntu 20.04

williams4564 commented 3 years ago

Thank you @smurfd your patch works on my Ubuntu 20.04 VM

a1eaiactaest commented 3 years ago

works on Ubuntu 21.04 as well.

a1eaiactaest commented 3 years ago

I created a fork with all patches applied. if someone doesn't want to manually patch qira and qemu just clone a1eaiactaest/qira and normally run ./install.sh. i think everything should be fine.

IdanBanani commented 2 years ago

I created a fork with all patches applied. if someone doesn't want to manually patch qira and qemu just clone a1eaiactaest/qira and normally run ./install.sh. i think everything should be fine.

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv ./install.sh: line 15: tracers/qemu/qira-i386: No such file or directory building QEMU ./qemu_build.sh: line 10: ./configure: No such file or directory

IdanBanani commented 11 months ago

@smurfd Do you have any idea if the integration (synchronization) with IDA requires an IDA PRO version (to use the plugin) to be installed on Linux or it is possible to use an IDA PRO on Windows which uses remote debugging connection? Nevertheless, even without IDA this could be useful (too bad the project is kind of dead).

smurfd commented 11 months ago

@smurfd Do you have any idea if the integration (synchronization) with IDA requires an IDA PRO version (to use the plugin) to be installed on Linux or it is possible to use an IDA PRO on Windows which uses remote debugging connection? Nevertheless, even without IDA this could be useful (too bad the project is kind of dead).

sorry i do not have a clue unfortunately. :(