forked from p34709852/monkey
Update scripts
This commit is contained in:
parent
a594bd11c2
commit
d30f2cf8dc
|
@ -1,33 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
MONKEY_FOLDER=/var/monkey_island
|
||||
INSTALLATION_FOLDER=/var/monkey_island/installation
|
||||
PYTHON_FOLDER=/var/monkey_island/bin/python
|
||||
|
||||
cp -f ${MONKEY_FOLDER}/monkey.sh /usr/bin/monkey
|
||||
chmod 755 /usr/bin/monkey
|
||||
MONKEY_FOLDER=/var/monkey
|
||||
INSTALLATION_FOLDER=/var/monkey/installation
|
||||
PYTHON_FOLDER=/var/monkey/monkey_island/bin/python
|
||||
|
||||
# Prepare python virtualenv
|
||||
pip2 install virtualenv --no-index --find-links file://$INSTALLATION_FOLDER
|
||||
virtualenv -p python2.7 ${PYTHON_FOLDER}
|
||||
|
||||
# install pip requirements
|
||||
${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER
|
||||
${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER
|
||||
|
||||
# remove installation folder and unnecessary files
|
||||
rm -rf ${INSTALLATION_FOLDER}
|
||||
rm -f ${MONKEY_FOLDER}/pip_requirements.txt
|
||||
rm -f ${MONKEY_FOLDER}/monkey_island/pip_requirements.txt
|
||||
|
||||
cp ${MONKEY_FOLDER}/ubuntu/* /etc/init/
|
||||
cp ${MONKEY_FOLDER}/monkey_island/ubuntu/* /etc/init/
|
||||
if [ -d "/etc/systemd/network" ]; then
|
||||
cp ${MONKEY_FOLDER}/ubuntu/systemd/*.service /lib/systemd/system/
|
||||
chmod +x ${MONKEY_FOLDER}/ubuntu/systemd/start_server.sh
|
||||
cp ${MONKEY_FOLDER}/monkey_island/ubuntu/systemd/*.service /lib/systemd/system/
|
||||
chmod +x ${MONKEY_FOLDER}/monkey_island/ubuntu/systemd/start_server.sh
|
||||
systemctl daemon-reload
|
||||
systemctl enable monkey-mongo
|
||||
systemctl enable monkey-island
|
||||
fi
|
||||
|
||||
${MONKEY_FOLDER}/create_certificate.sh
|
||||
${MONKEY_FOLDER}/monkey_island/create_certificate.sh
|
||||
|
||||
service monkey-island start
|
||||
service monkey-mongo start
|
||||
|
|
|
@ -8,6 +8,6 @@ rm -f /etc/init/monkey-mongo.conf
|
|||
[ -f "/lib/systemd/system/monkey-island.service" ] && rm -f /lib/systemd/system/monkey-island.service
|
||||
[ -f "/lib/systemd/system/monkey-mongo.service" ] && rm -f /lib/systemd/system/monkey-mongo.service
|
||||
|
||||
rm -r -f /var/monkey_island
|
||||
rm -r -f /var/monkey
|
||||
|
||||
exit 0
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
service monkey-mongo stop
|
||||
cd /var/monkey_island
|
||||
cd /var/monkey/monkey_island
|
||||
rm -rf ./db/*
|
||||
service monkey-mongo start
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd /var/monkey_island
|
||||
cd /var/monkey/monkey_island
|
||||
openssl genrsa -out cc/server.key 1024
|
||||
openssl req -new -key cc/server.key -out cc/server.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com"
|
||||
openssl x509 -req -days 366 -in cc/server.csr -signkey cc/server.key -out cc/server.crt
|
||||
|
|
|
@ -10,5 +10,5 @@ else
|
|||
fi
|
||||
|
||||
MONKEY_FILE=monkey-linux-$ARCH
|
||||
cp -f /var/monkey_island/cc/binaries/$MONKEY_FILE /tmp
|
||||
cp -f /var/monkey/monkey_island/cc/binaries/$MONKEY_FILE /tmp
|
||||
/tmp/$MONKEY_FILE m0nk3y $@
|
||||
|
|
|
@ -10,5 +10,5 @@ else
|
|||
fi
|
||||
|
||||
MONKEY_FILE=monkey-linux-$ARCH
|
||||
cp -f /var/monkey_island/cc/binaries/$MONKEY_FILE /tmp
|
||||
cp -f /var/monkey/monkey_island/cc/binaries/$MONKEY_FILE /tmp
|
||||
/tmp/$MONKEY_FILE m0nk3y $@
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd /var/monkey_island/cc
|
||||
/var/monkey_island/bin/mongodb/bin/mongod --quiet --dbpath /var/monkey_island/db &
|
||||
/var/monkey_island/bin/python/bin/python main.py
|
||||
cd /var/monkey
|
||||
/var/monkey/monkey_island/bin/mongodb/bin/mongod --quiet --dbpath /var/monkey/monkey_island/db &
|
||||
/var/monkey/monkey_island/bin/python/bin/python monkey_island/cc/main.py
|
|
@ -7,8 +7,8 @@ respawn
|
|||
respawn limit unlimited
|
||||
|
||||
script
|
||||
chdir /var/monkey_island/cc
|
||||
exec python main.py
|
||||
chdir /var/monkey
|
||||
exec python monkey_island/cc/main.py
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
|
|
|
@ -7,8 +7,8 @@ respawn
|
|||
respawn limit unlimited
|
||||
|
||||
script
|
||||
chdir /var/monkey_island/
|
||||
exec /var/monkey_island/bin/mongodb/bin/mongod --dbpath db
|
||||
chdir /var/monkey/monkey_island/
|
||||
exec /var/monkey/monkey_island/bin/mongodb/bin/mongod --dbpath db
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
|
|
|
@ -5,7 +5,7 @@ After=network.target
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/var/monkey_island/ubuntu/systemd/start_server.sh
|
||||
ExecStart=/var/monkey/monkey_island/ubuntu/systemd/start_server.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -3,10 +3,10 @@ Description=Monkey Island Mongo Service
|
|||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/var/monkey_island/bin/mongodb/bin/mongod --quiet --dbpath /var/monkey_island/db
|
||||
ExecStart=/var/monkey/monkey_island/bin/mongodb/bin/mongod --quiet --dbpath /var/monkey/monkey_island/db
|
||||
KillMode=process
|
||||
Restart=always
|
||||
ExecStop=/var/monkey_island/bin/mongodb/bin/mongod --shutdown
|
||||
ExecStop=/var/monkey/monkey_island/bin/mongodb/bin/mongod --shutdown
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd /var/monkey_island/cc
|
||||
/var/monkey_island/bin/python/bin/python main.py
|
||||
cd /var/monkey
|
||||
/var/monkey/monkey_island/bin/python/bin/python monkey_island/cc/main.py
|
|
@ -1,4 +1,4 @@
|
|||
@title C^&C Server
|
||||
@pushd cc
|
||||
@..\bin\Python27\python main.py
|
||||
@pushd ..
|
||||
@monkey_island\bin\Python27\python monkey_island\cc\main.py
|
||||
@popd
|
Loading…
Reference in New Issue