mirror of https://github.com/dirtbags/moth.git
Finish Makefiles for badmath and tanks.
This commit is contained in:
parent
2034591fb6
commit
b840cb03f6
|
@ -0,0 +1,26 @@
|
|||
FAKE = fakeroot -s fake -i fake
|
||||
INSTALL = $(FAKE) install
|
||||
|
||||
all: badmath.tce
|
||||
|
||||
badmath.tce: target
|
||||
$(FAKE) sh -c 'cd target && tar -czf - --exclude=placeholder --exclude=*~ .' > $@
|
||||
|
||||
|
||||
target:
|
||||
$(INSTALL) -d target/usr/lib/ctf/badmath
|
||||
$(INSTALL) Gyopi.py badmath.py target/usr/lib/ctf/badmath
|
||||
|
||||
$(INSTALL) -d target/var/lib/badmath
|
||||
|
||||
$(INSTALL) -d target/var/service/badmath
|
||||
$(INSTALL) run target/var/service/badmath/run
|
||||
|
||||
$(INSTALL) -d target/var/service/badmath/log
|
||||
$(INSTALL) log.run target/var/service/badmath/log/run
|
||||
|
||||
clean:
|
||||
rm -rf target badmath.tce fake
|
||||
|
||||
%.pyc: %.py
|
||||
python3 -c 'import $*'
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
dev=16,ino=87557208,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557227,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557231,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557232,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557233,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557234,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557235,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557237,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557238,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557239,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87557240,mode=40755,uid=0,gid=0,nlink=2,rdev=0
|
||||
dev=16,ino=87573208,mode=100755,uid=0,gid=0,nlink=1,rdev=0
|
||||
dev=16,ino=87573433,mode=100755,uid=0,gid=0,nlink=1,rdev=0
|
||||
dev=16,ino=87573456,mode=100755,uid=0,gid=0,nlink=1,rdev=0
|
|
@ -0,0 +1,3 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec logger -t badmath
|
|
@ -1,5 +1,5 @@
|
|||
FAKE = fakeroot -s fake -i fake
|
||||
INSTALL = $(fake) install
|
||||
INSTALL = $(FAKE) install -o 100
|
||||
|
||||
all: tanks.tce
|
||||
|
||||
|
@ -19,7 +19,7 @@ target:
|
|||
|
||||
$(INSTALL) -d target/var/lib/www/tanks/
|
||||
$(INSTALL) www/* target/var/lib/www/tanks/
|
||||
# $(FAKE) ln -s target/var/lib/tanks/ target/var/lib/www/data
|
||||
$(FAKE) ln -s target/var/lib/tanks/ target/var/lib/www/data
|
||||
|
||||
$(INSTALL) -d target/usr/lib/python2.6/site-packages/tanks/
|
||||
$(INSTALL) lib/* target/usr/lib/python2.6/site-packages/tanks/
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec logger -t tanks
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/python3.0
|
||||
|
||||
from ctf.flagd import Flagger
|
||||
|
||||
key = 'tanks:::2bac5e912ff2e1ad559b177eb5aeecca'
|
||||
|
||||
f = Flagger.Flagger('localhost', key)
|
||||
|
||||
while 1:
|
||||
time.sleep(1)
|
||||
try:
|
||||
winner = open('/var/lib/tanks/winner').read()
|
||||
except:
|
||||
winner = None
|
||||
|
||||
f.set_flag(winner)
|
|
@ -0,0 +1,6 @@
|
|||
#! /bin/sh
|
||||
|
||||
[ -f /var/lib/ctf/disabled/tanks ] && exit 0
|
||||
|
||||
envuidgid ctf python2.6 run_tanks.py /var/lib/tanks/ easy 100 &
|
||||
envuidgid ctf report_score.py
|
|
@ -0,0 +1,20 @@
|
|||
import time
|
||||
from tanks import Pflanzarr
|
||||
import sys
|
||||
|
||||
T = 60*5
|
||||
|
||||
try:
|
||||
while 1:
|
||||
start = time.time()
|
||||
p = Pflanzarr(sys.argv[1], sys.argv[2])
|
||||
p.run(int(sys.argv[3]))
|
||||
|
||||
diff = time.time() - start
|
||||
if diff - T > 0:
|
||||
time.sleep( diff - T )
|
||||
|
||||
except:
|
||||
print 'Usage: python2.6 run_tanks.py data_dir easy|medium|hard max_turns'
|
||||
|
||||
|
Loading…
Reference in New Issue