Skip to content

Instantly share code, notes, and snippets.

@ThisIsNotTheUserYouAreLookingFor
Last active October 13, 2015 08:25
Show Gist options
  • Save ThisIsNotTheUserYouAreLookingFor/f5aaa1a8970a74406ffa to your computer and use it in GitHub Desktop.
Save ThisIsNotTheUserYouAreLookingFor/f5aaa1a8970a74406ffa to your computer and use it in GitHub Desktop.
MYSQLROOT_PASS="random_password"
DOFLER_ROOT="dbUser"
DOFLER_PASS="dbUser_pass"
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install pkg-config libpng12-dev libjpeg-dev libgif-dev git-core libpcap-dev python-dev ettercap-text-only tshark build-essential libmysqlclient-dev mysql-server sqlite3 python-pip python-setuptools
mysqladmin -u root password $MYSQLROOT_PASS
mysql -u root --password=$MYSQLROOT_PASS -e "create database dofler;"
mysql -u root --password=$MYSQLROOT_PASS -e "create user '$DOFLER_ROOT'@'localhost' identified by '$DOFLER_PASS';"
mysql -u root --password=$MYSQLROOT_PASS -e "grant all privileges on dofler.* to '$DOFLER_ROOT'@'localhost';"
cd /usr/src
git clone https://github.com/bldewolf/driftnet.git
cd driftnet
sed -i "/#CFLAGS += -DNO_DISPLAY_WINDOW/ s/#//" Makefile
make
cp driftnet /usr/local/bin/
pip install dofler MySQL-python #necessary for sqlalchemy towards mysql, should be included in the pip install file of dofler i think
cat <<EOF > /etc/init/dofler.conf
description "Dofler"
author "steve@chigeek.com"
respawn
respawn limit 15 5
start on runlevel [2345]
stop on runlevel [016]
exec /usr/local/bin/dofler run
EOF
initctl reload-configuration
# Now we need to start it up to create the databases, config files, etc.
initctl start dofler
sleep 1 # needs to create files, otherwise a bit too snappy :)
sqlite3 /var/lib/dofler/settings.db "update settings set value='0.0.0.0' where name='api_host'"
sed -i.bak "s/^db =.*/db = mysql\:\/\/"$DOFLER_ROOT"\:"$DOFLER_PASS"\@localhost\/dofler/g" /etc/dofler.conf
initctl restart dofler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment