2014-07-28 14:55:25 -07:00
|
|
|
#!/bin/bash -e
|
2014-07-02 18:19:26 -07:00
|
|
|
|
2014-07-28 14:48:14 -07:00
|
|
|
# default is just pip, but on things like arch where python 3 is default, it's pip2
|
|
|
|
PIP="pip"
|
2014-07-14 16:56:30 -07:00
|
|
|
|
2014-09-07 01:39:40 -04:00
|
|
|
unamestr=$(uname)
|
|
|
|
if [[ "$unamestr" == 'Linux' ]]; then
|
|
|
|
# we need pip to install python stuff
|
|
|
|
# build for building qiradb and stuff for flask like gevent
|
|
|
|
if [ $(which apt-get) ]; then
|
|
|
|
echo "installing apt packages"
|
Add BAP as backend.
This PR introduces bap as a backend for QIRA.
The backend is made optional, but is enabled by default.
This backend allows one to disassemble instructions for all platforms,
supported by LLVM (at the time of writing it is about 25 targets).
Also, to some platforms BAP will provide BIL and/or target specific
instructions, lifted to first class python values, as opposed to
strings.
A new instruction class is introduces, that will use BIL if available to
infer destinations, as well as to infer registers touched or modified by
the instruction. Using, BIL allows us to determine instructions like
`pop {r0, pc}` as calls, that, as a consequence, allows us to build a
more correct CFG. As a drawback on ARM platform the built CFG is so big,
that it takes a considerable amount of time just to draw it.
Since BAP can provide a reasonable analysis for all platforms, including
those that at the time of writing still doesn't have a BIL support, the
static analysis in QIRA will be always turned on.
BAP is installed using opam, and BAP Python bindings a downloaded
directly from the git repository using pip.
As a free bonus, this PR will also fix Travis CI issue.
2015-01-13 14:00:40 -05:00
|
|
|
sudo apt-get update -qq
|
2014-09-25 10:18:35 -04:00
|
|
|
sudo apt-get -y install build-essential python-dev python-pip debootstrap libjpeg-dev zlib1g-dev unzip wget graphviz
|
2014-11-23 01:43:08 +00:00
|
|
|
|
|
|
|
# only python package we install globally
|
2014-11-23 01:06:58 +00:00
|
|
|
sudo $PIP install virtualenv
|
2014-09-07 01:39:40 -04:00
|
|
|
elif [ $(which pacman) ]; then
|
|
|
|
echo "installing pip"
|
|
|
|
sudo pacman -S base-devel python2-pip
|
|
|
|
PIP="pip2"
|
|
|
|
elif [ $(which yum) ]; then
|
2014-11-29 11:02:45 +01:00
|
|
|
sudo yum install python-pip python-devel gcc gcc-c++ python-virtualenv glib2-devel
|
2014-09-07 01:39:40 -04:00
|
|
|
fi
|
2014-07-02 18:19:26 -07:00
|
|
|
|
2014-09-07 01:39:40 -04:00
|
|
|
if [ $(qemu/qira-i386 > /dev/null; echo $?) == 1 ]; then
|
|
|
|
echo "QIRA QEMU appears to run okay"
|
|
|
|
else
|
|
|
|
echo "building QEMU"
|
|
|
|
./qemu_build.sh
|
|
|
|
fi
|
2014-07-31 11:47:11 -07:00
|
|
|
fi
|
2014-07-30 16:02:23 -07:00
|
|
|
|
2014-08-03 03:30:55 +00:00
|
|
|
# we install more than we strictly need here, because pip is so easy
|
2014-11-19 22:22:08 +00:00
|
|
|
# should this use sudo?
|
|
|
|
# can ./qiradb go in requirements?
|
|
|
|
echo "installing pip packages"
|
2014-11-23 01:06:58 +00:00
|
|
|
virtualenv venv
|
|
|
|
source venv/bin/activate
|
Add BAP as backend.
This PR introduces bap as a backend for QIRA.
The backend is made optional, but is enabled by default.
This backend allows one to disassemble instructions for all platforms,
supported by LLVM (at the time of writing it is about 25 targets).
Also, to some platforms BAP will provide BIL and/or target specific
instructions, lifted to first class python values, as opposed to
strings.
A new instruction class is introduces, that will use BIL if available to
infer destinations, as well as to infer registers touched or modified by
the instruction. Using, BIL allows us to determine instructions like
`pop {r0, pc}` as calls, that, as a consequence, allows us to build a
more correct CFG. As a drawback on ARM platform the built CFG is so big,
that it takes a considerable amount of time just to draw it.
Since BAP can provide a reasonable analysis for all platforms, including
those that at the time of writing still doesn't have a BIL support, the
static analysis in QIRA will be always turned on.
BAP is installed using opam, and BAP Python bindings a downloaded
directly from the git repository using pip.
As a free bonus, this PR will also fix Travis CI issue.
2015-01-13 14:00:40 -05:00
|
|
|
$PIP install --upgrade -r requirements.txt
|
2014-07-02 18:19:26 -07:00
|
|
|
|
2014-12-09 18:07:41 +00:00
|
|
|
# build capstone if we don't have it
|
|
|
|
if [ $(python -c "import capstone; exit(69 if (capstone.cs_version() == capstone.version_bind() and capstone.cs_version()[0] == 3) else 0)"; echo $?) == 69 ]; then
|
|
|
|
echo "capstone already installed, skipping"
|
|
|
|
else
|
|
|
|
./capstone_build.sh
|
|
|
|
fi
|
|
|
|
|
Add BAP as backend.
This PR introduces bap as a backend for QIRA.
The backend is made optional, but is enabled by default.
This backend allows one to disassemble instructions for all platforms,
supported by LLVM (at the time of writing it is about 25 targets).
Also, to some platforms BAP will provide BIL and/or target specific
instructions, lifted to first class python values, as opposed to
strings.
A new instruction class is introduces, that will use BIL if available to
infer destinations, as well as to infer registers touched or modified by
the instruction. Using, BIL allows us to determine instructions like
`pop {r0, pc}` as calls, that, as a consequence, allows us to build a
more correct CFG. As a drawback on ARM platform the built CFG is so big,
that it takes a considerable amount of time just to draw it.
Since BAP can provide a reasonable analysis for all platforms, including
those that at the time of writing still doesn't have a BIL support, the
static analysis in QIRA will be always turned on.
BAP is installed using opam, and BAP Python bindings a downloaded
directly from the git repository using pip.
As a free bonus, this PR will also fix Travis CI issue.
2015-01-13 14:00:40 -05:00
|
|
|
if [ -d bap -o "x$BAP" = "xdisable" ]; then
|
|
|
|
echo "Skipping BAP"
|
|
|
|
else
|
|
|
|
echo "Installing BAP"
|
|
|
|
export OPAMYES=1
|
|
|
|
export OPAMVERBOSE=1
|
|
|
|
export OPAMJOBS=4
|
|
|
|
|
|
|
|
echo 'yes' | sudo add-apt-repository ppa:avsm/ocaml42+opam12
|
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get install -qq ocaml ocaml-native-compilers camlp4-extra opam
|
|
|
|
sudo apt-get install libgmp-dev llvm-3.4-dev time
|
|
|
|
|
|
|
|
opam init
|
|
|
|
opam install bap
|
|
|
|
|
|
|
|
$PIP install --upgrade git+git://github.com/BinaryAnalysisPlatform/bap.git
|
|
|
|
fi
|
|
|
|
|
2014-07-28 14:55:25 -07:00
|
|
|
echo "making symlink"
|
2014-07-02 19:52:14 -07:00
|
|
|
sudo ln -sf $(pwd)/qira /usr/local/bin/qira
|
2014-08-18 11:26:33 -07:00
|
|
|
|
2014-08-21 11:01:50 -07:00
|
|
|
echo "***************************************"
|
|
|
|
echo " Thanks for installing QIRA"
|
|
|
|
echo " Check out README for more info"
|
|
|
|
echo " Or just dive in with 'qira /bin/ls'"
|
2014-11-23 01:43:08 +00:00
|
|
|
echo " And point Chrome to localhost:3002"
|
Add BAP as backend.
This PR introduces bap as a backend for QIRA.
The backend is made optional, but is enabled by default.
This backend allows one to disassemble instructions for all platforms,
supported by LLVM (at the time of writing it is about 25 targets).
Also, to some platforms BAP will provide BIL and/or target specific
instructions, lifted to first class python values, as opposed to
strings.
A new instruction class is introduces, that will use BIL if available to
infer destinations, as well as to infer registers touched or modified by
the instruction. Using, BIL allows us to determine instructions like
`pop {r0, pc}` as calls, that, as a consequence, allows us to build a
more correct CFG. As a drawback on ARM platform the built CFG is so big,
that it takes a considerable amount of time just to draw it.
Since BAP can provide a reasonable analysis for all platforms, including
those that at the time of writing still doesn't have a BIL support, the
static analysis in QIRA will be always turned on.
BAP is installed using opam, and BAP Python bindings a downloaded
directly from the git repository using pip.
As a free bonus, this PR will also fix Travis CI issue.
2015-01-13 14:00:40 -05:00
|
|
|
echo " ~geohot"
|