mirror of https://github.com/dirtbags/moth.git
Packages set their own IPs
This commit is contained in:
parent
c6456f8a00
commit
352ed1639e
|
@ -1,6 +1,7 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
# Get new tokens
|
||||||
for dn in /opt/*/tokens/*; do
|
for dn in /opt/*/tokens/*; do
|
||||||
[ -d $dn ] || continue
|
[ -d $dn ] || continue
|
||||||
puzzle=$(basename $dn)
|
puzzle=$(basename $dn)
|
||||||
|
@ -9,5 +10,16 @@ while true; do
|
||||||
-e /opt/tokens/bin/tokencli $category $dn/category.key 3>&1 | \
|
-e /opt/tokens/bin/tokencli $category $dn/category.key 3>&1 | \
|
||||||
/opt/tokens/bin/arc4 $dn/enc.key > /var/lib/ctf/tokens/$puzzle
|
/opt/tokens/bin/arc4 $dn/enc.key > /var/lib/ctf/tokens/$puzzle
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Fetch list of teams
|
||||||
|
wget -q -P /var/lib/ctf http://10.0.0.2/teams.txt &
|
||||||
|
|
||||||
|
# Archive state
|
||||||
|
state=/var/www/state.tar.gz.rc4
|
||||||
|
tar cf - /var/lib/ctf | \
|
||||||
|
gzip -c | \
|
||||||
|
KEY='crashmaster' arc4 > $state.tmp
|
||||||
|
mv $state.tmp $state
|
||||||
|
|
||||||
sleep 60
|
sleep 60
|
||||||
done
|
done
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
# Set up networking for all CTF packages
|
# Set up networking for all CTF ip
|
||||||
ip link set eth0 up
|
ip link set eth0 up
|
||||||
if ! ip route | grep -q default; then
|
if ! ip route | grep -q default; then
|
||||||
ip route add default via 10.0.0.1 || exit 1
|
ip route add default via 10.0.0.1 || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install -o root -m 0755 -d /var/lib/ctf/tokens
|
install -o root -m 0755 -d /var/lib/ctf/tokens
|
||||||
exec ./update-tokens
|
exec ./ctfd
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
IP=$(cat ip.txt)
|
IP=$(cat ip.txt)
|
||||||
ip addr add $IP dev eth0
|
ip addr add $IP label eth0:logger dev eth0
|
||||||
exec tcpsvd ${IP#/*} 1958 /opt/logger/bin/logger
|
exec tcpsvd ${IP#/*} 1958 /opt/logger/bin/logger
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
ip addr add 10.0.0.2/24 dev eth0
|
ip addr add 10.0.0.2/24 label eth0:mcp dev eth0
|
||||||
|
|
||||||
DB=/var/lib/ctf/tokens.db
|
DB=/var/lib/ctf/tokens.db
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
IP=$(cat ip.txt)
|
IP=$(cat ip.txt)
|
||||||
ip addr add $IP dev eth0
|
ip addr add $IP label eth0:octopus dev eth0
|
||||||
exec /opt/octopus/bin/octopus ${IP%/*}
|
exec /opt/octopus/bin/octopus ${IP%/*}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(cat ip.txt)
|
IP=$(cat ip.txt)
|
||||||
ip addr add $IP dev eth0
|
ip addr add $IP label eth0:printf dev eth0
|
||||||
|
|
||||||
# So I say to him, "Alex, what's a good high port number for a CTF category?"
|
# So I say to him, "Alex, what's a good high port number for a CTF category?"
|
||||||
# And he says, "6"
|
# And he says, "6"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Configure IP address
|
# Configure IP address
|
||||||
IP=$(cat ip.txt)
|
IP=$(cat ip.txt)
|
||||||
ip addr add $IP dev eth0
|
ip addr add $IP label eth0:pwnables dev eth0
|
||||||
|
|
||||||
# Set up chroot environment
|
# Set up chroot environment
|
||||||
# We never umount any of this since it's all just in RAM
|
# We never umount any of this since it's all just in RAM
|
||||||
|
|
Loading…
Reference in New Issue