Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

usage() { echo "Usage: $0 -h <IP/domain string> [-p DB password]" 1>&2; exit 1; }

if ! [ -x "$(command -v docker)" ]; then
echo "Please install docker before continuing"
exit 1
fi

if ! [ -x "$(command -v docker-compose)" ]; then
echo "Please install docker-compose before continuing"
exit 1
fi

while getopts ":h:p:" o; do
case "${o}" in
h)
h=${OPTARG}
;;
p)
p=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))

if [ -z "${h}" ]; then
usage
fi

s=$(python -c "import random;secret=''.join('%02x' % random.randrange(256) for i in xrange(32));print secret")

echo "Setting up with the following parameters:"
echo "IP/Domain: ${h}"
if ! [ -z "${p}" ]; then
echo "DB Password: ${p}"
fi
echo "App Secret: ${s}"

sed -i '' "s/SECRET HERE/$s/g" main.py

if ! [ -z "${p}" ]; then
sed -i '' "s/dbpassword/$p/g" docker-compose.yml
sed -i '' "s/dbpassword/$p/g" model.py
fi

sed -i '' "s/ssrftest.com/$h/g" handlers/target.py
sed -i '' "s/ssrftest.com/$h/g" templates/target/index.html

./build-docker.sh

docker-compose up