phantomjs tests yay

This commit is contained in:
George Hotz 2014-11-23 01:43:08 +00:00
parent 3392bd55fd
commit 4671570b02
8 changed files with 42 additions and 7 deletions

View File

@ -42,10 +42,8 @@ cp -av middleware/*.py distrib/qira/middleware/
# static2
echo "copying static2"
mkdir -p distrib/qira/static2
cp -av static2/*.py distrib/qira/static2/
# is this worth it?
cp -av static2/bw_* distrib/qira/static2/
pyclean static2/
cp -av static2/* distrib/qira/static2/
# built for ida 6.6
# perhaps build for older IDA as well, ie 6.1

View File

@ -10,6 +10,8 @@ if [[ "$unamestr" == 'Linux' ]]; then
if [ $(which apt-get) ]; then
echo "installing apt packages"
sudo apt-get -y install build-essential python-dev python-pip debootstrap libjpeg-dev zlib1g-dev unzip wget graphviz
# grr, capstone should be a ubuntu package
if [ ! -f /usr/lib/libcapstone.so ]; then
# now we need capstone so the user can see assembly
if [[ $(uname -m) == 'i386' ]]; then
@ -20,6 +22,8 @@ if [[ "$unamestr" == 'Linux' ]]; then
sudo dpkg -i /tmp/cs.deb
rm /tmp/cs.deb
fi
# only python package we install globally
sudo $PIP install virtualenv
elif [ $(which pacman) ]; then
echo "installing pip"
@ -44,7 +48,6 @@ echo "installing pip packages"
virtualenv venv
source venv/bin/activate
$PIP install --upgrade -r requirements.txt
$PIP install --upgrade ./qiradb
echo "making symlink"
sudo ln -sf $(pwd)/qira /usr/local/bin/qira
@ -53,6 +56,6 @@ echo "***************************************"
echo " Thanks for installing QIRA"
echo " Check out README for more info"
echo " Or just dive in with 'qira /bin/ls'"
echo " And point chrome to localhost:3002"
echo " And point Chrome to localhost:3002"
echo " ~geohot"

View File

@ -355,6 +355,9 @@ def do_search(b64search):
@app.route('/', defaults={'path': 'index.html'})
@app.route('/<path:path>')
def serve(path):
if 'Firefox' in request.headers.get('User-Agent'):
return "<pre>WTF you use Firefox?!?\n\nGo download a real web browser, like Chrome, and try this again"
# best security?
if ".." in path:
return

2
qira
View File

@ -1,5 +1,5 @@
#!/bin/bash -e
DIR=$(dirname $(readlink -f $0))
source $DIR/venv/bin/activate
python $DIR/middleware/qira.py $*
exec python $DIR/middleware/qira.py $*

17
qira_tests/load_page.js Normal file
View File

@ -0,0 +1,17 @@
var page = require('webpage').create();
page.settings.javascriptEnabled = true;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open('http://localhost:3002/', function() {
var title = page.evaluate(function() { return document.title; });
if (title !== "qira") {
console.log("BAD TITLE");
phantom.exit(-1);
}
phantom.exit();
});

View File

@ -9,3 +9,4 @@ ipaddr
capstone==2.1
hexdump
nose
./qiradb

View File

@ -2,3 +2,15 @@
source venv/bin/activate
nosetests
# integration test
qira qira_tests/bin/loop &
QIRA_PID=$!
echo "qira pid is $QIRA_PID"
sleep 2
# phantomjs
phantomjs qira_tests/load_page.js
kill $QIRA_PID

View File

@ -21,6 +21,7 @@
<script type="text/javascript" src="/client/haddrline.js"></script>
<script type="text/javascript" src="/client/static/static.js"></script>
<script type="text/javascript" src="/client/static/graph.js"></script>
<script> console.log("welcome to qira"); </script>
<title>qira</title>
</head>