mirror of https://github.com/dirtbags/moth.git
Working p2, eliminate 00admin
This required a fair amount of shuffling stuff around, as can be seen. Fortunately, now things ought to be able to run more or less standalone again. I also figured out a way to have the build system be a tad smarter about not rebuilding shared stuff, although you still install the exact same eris binary and /service subdirs for mcp and p2. But at least you only have to change one place in the source code now.
This commit is contained in:
parent
7bb60f45f6
commit
17901de534
|
@ -0,0 +1,56 @@
|
||||||
|
#! /bin/sh -e
|
||||||
|
|
||||||
|
TYPE=p2
|
||||||
|
|
||||||
|
case ${1:-$TYPE} in
|
||||||
|
mcp)
|
||||||
|
packages='mcp net-re'
|
||||||
|
;;
|
||||||
|
router)
|
||||||
|
packages='router'
|
||||||
|
;;
|
||||||
|
p2)
|
||||||
|
packages='p2 sequence'
|
||||||
|
;;
|
||||||
|
p2cli)
|
||||||
|
packages='p2client'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
PATH=$HOME/src/buildroot/output/host/usr/bin:$PATH
|
||||||
|
for arch in arm i386; do
|
||||||
|
command -v ${arch}-linux-cc && ARCH=${arch}-linux export ARCH
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$ARCH" ]; then
|
||||||
|
echo "I can't find a cross-compiler."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
make -C $HOME/src/puzzles
|
||||||
|
make -C $HOME/src/ctf
|
||||||
|
|
||||||
|
for p in $packages; do
|
||||||
|
for pd in ctf puzzles; do
|
||||||
|
pp=$HOME/src/$pd/bin/$p.pkg
|
||||||
|
[ -f $pp ] && op="$op $pp"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
mksquashfs \
|
||||||
|
$op \
|
||||||
|
$HOME/ctf.squashfs -noappend
|
||||||
|
|
||||||
|
echo $ARCH
|
||||||
|
|
||||||
|
if [ $ARCH = i386-linux ]; then
|
||||||
|
lsmod | grep -q kvm-intel || sudo modprobe kvm-intel
|
||||||
|
sudo kvm \
|
||||||
|
-serial stdio \
|
||||||
|
-kernel $HOME/src/buildroot/output/images/bzImage \
|
||||||
|
-initrd $HOME/src/buildroot/output/images/rootfs.squashfs \
|
||||||
|
-append "console=ttyS0 packages=/dev/sda ipv6 debug" \
|
||||||
|
-hda $HOME/ctf.squashfs \
|
||||||
|
-net nic,model=e1000 \
|
||||||
|
-net tap,vlan=0,script=$HOME/src/ctf/qemu-ifup,downscript=/bin/true
|
||||||
|
fi
|
|
@ -1,19 +0,0 @@
|
||||||
00ADMIN_PKGDIR = $(TARGET)/00admin
|
|
||||||
00ADMIN_BUILDDIR = $(BUILD)/00admin
|
|
||||||
|
|
||||||
ifndef PASSWORD
|
|
||||||
$(error PASSWORD not defined)
|
|
||||||
endif
|
|
||||||
|
|
||||||
00admin-build: $(00ADMIN_BUILDDIR)/build
|
|
||||||
$(00ADMIN_BUILDDIR)/build:
|
|
||||||
$(MAKE) -C packages/00admin/src
|
|
||||||
|
|
||||||
00admin-install: $(00ADMIN_BUILDDIR)/build
|
|
||||||
$(call COPYTREE, packages/00admin/service, $(00ADMIN_PKGDIR)/service)
|
|
||||||
echo "$(PASSWORD)" > $(00ADMIN_PKGDIR)/password
|
|
||||||
mkdir -p $(00ADMIN_PKGDIR)/sbin
|
|
||||||
cp packages/00admin/bin/* $(00ADMIN_PKGDIR)/bin
|
|
||||||
cp packages/00admin/src/tea $(00ADMIN_PKGDIR)/bin
|
|
||||||
|
|
||||||
PACKAGES += 00admin
|
|
|
@ -1,34 +0,0 @@
|
||||||
#! /bin/sh -e
|
|
||||||
|
|
||||||
action=$1; shift
|
|
||||||
|
|
||||||
read n < ip.txt
|
|
||||||
|
|
||||||
if grep -q '/' ip.txt; then
|
|
||||||
IP=$n
|
|
||||||
elif grep -q ipv4 /proc/cmdline; then
|
|
||||||
# IPv4
|
|
||||||
IP="10.0.0.$n/16"
|
|
||||||
else
|
|
||||||
# IPv6
|
|
||||||
l=$(busybox dc 16 o $n p)
|
|
||||||
IP="fd84:b410:3441::$l/64"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[ "$action" ] && ip addr $action $IP dev eth0
|
|
||||||
|
|
||||||
if [ "$action" = "add" ]; then
|
|
||||||
fail=fail
|
|
||||||
for i in $(seq 5); do
|
|
||||||
if ip addr | grep -v tentative | grep -Fq $IP; then
|
|
||||||
fail=
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
[ "$fail" ] && return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "$action" = del ] || echo $IP
|
|
|
@ -1,3 +0,0 @@
|
||||||
all: tea
|
|
||||||
clean:
|
|
||||||
rm -f tea
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
This directory is for things that multiple packages need.
|
||||||
|
For example, eris httpd is used by mcp, p2, and inferno.
|
||||||
|
|
||||||
|
|
||||||
|
This directory does not create its own package, though.
|
|
@ -0,0 +1,27 @@
|
||||||
|
ifndef PASSWORD
|
||||||
|
$(error PASSWORD not defined)
|
||||||
|
endif
|
||||||
|
|
||||||
|
TEA_BIN = packages/00common/src/tea
|
||||||
|
POINTSCLI_BIN = packages/00common/src/pointscli
|
||||||
|
PUZZLES_BIN = packages/00common/src/puzzles.cgi
|
||||||
|
|
||||||
|
.PHONY: ctfbase
|
||||||
|
ctfbase: $(TEA_BIN) $(POINTSCLI_BIN) $(PUZZLES_BIN)
|
||||||
|
$(TEA_BIN) $(POINTSCLI_BIN) $(PUZZLES_BIN):
|
||||||
|
$(MAKE) -C $(@D)
|
||||||
|
|
||||||
|
packages-clean: ctfbase-clean
|
||||||
|
ctfbase-clean:
|
||||||
|
$(MAKE) -C packages/00common/src clean
|
||||||
|
|
||||||
|
define CTFBASE_INSTALL
|
||||||
|
$(call COPYTREE, packages/00common/service, $1/service)
|
||||||
|
|
||||||
|
mkdir -p $(1)/bin
|
||||||
|
cp $(TEA_BIN) $(1)/bin
|
||||||
|
cp $(POINTSCLI_BIN) $(1)/bin
|
||||||
|
cp $(PUZZLES_BIN) $(1)/bin
|
||||||
|
|
||||||
|
echo "$(PASSWORD)" > $(1)/password
|
||||||
|
endef
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
|
@ -0,0 +1,21 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# Use first installed binary
|
||||||
|
for bin in /opt/*/bin/$1; do
|
||||||
|
if [ -x $bin ]; then
|
||||||
|
exec $bin
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cat <<EOD
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>$1</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>$1</h1>
|
||||||
|
<p>No $1 binary installed!</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOD
|
|
@ -0,0 +1,43 @@
|
||||||
|
#! /bin/sh -e
|
||||||
|
|
||||||
|
fn=$2/$3
|
||||||
|
|
||||||
|
WWW=${CTF_BASE:-/var/www}
|
||||||
|
BASE=${CTF_BASE:-/var/lib/ctf}
|
||||||
|
OPT=${CTF_BASE:-/opt}
|
||||||
|
|
||||||
|
POINTS=$BASE/points.log
|
||||||
|
BACKUP=$WWW/backup.png
|
||||||
|
SCOREBOARD=$WWW/scoreboard.html
|
||||||
|
PUZZLES=$WWW/puzzles.html
|
||||||
|
|
||||||
|
# Only do this if this score hasn't yet been recorded
|
||||||
|
if [ -n "$(sort -k2 $POINTS $fn | uniq -f1 -d)" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Append point. pointsd is called serially from inotify,
|
||||||
|
# so we don't need to lock it.
|
||||||
|
cat $fn >> $POINTS
|
||||||
|
rm $fn
|
||||||
|
|
||||||
|
# Generate new backup if we can find a password file
|
||||||
|
for pwfile in $OPT/*/password; do
|
||||||
|
if [ -f $pwfile ]; then
|
||||||
|
(
|
||||||
|
cat bkup.png
|
||||||
|
tar cvf - $BASE | gzip -c | $OPT/*/bin/tea 3< $pwfile
|
||||||
|
) > $BACKUP.new
|
||||||
|
mv $BACKUP.new $BACKUP
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Render scoreboard
|
||||||
|
./mkpage scoreboard < $POINTS > $SCOREBOARD.new
|
||||||
|
mv $SCOREBOARD.new $SCOREBOARD
|
||||||
|
|
||||||
|
# Render puzzles list
|
||||||
|
./mkpage puzzles.cgi > $PUZZLES.new
|
||||||
|
mv $PUZZLES.new $PUZZLES
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#! /bin/sh -e
|
||||||
|
|
||||||
|
exec 2>&1
|
||||||
|
|
||||||
|
: ${CTF_BASE:=/var/lib/ctf}
|
||||||
|
|
||||||
|
install -d $CTF_BASE
|
||||||
|
|
||||||
|
# Create CTF and nobody users
|
||||||
|
touch /etc/group /etc/passwd
|
||||||
|
addgroup -g 65534 nogroup || true
|
||||||
|
adduser -DH -G nogroup -u 65534 nobody || true
|
||||||
|
adduser -DHS ctf || true
|
||||||
|
|
||||||
|
# Set up base directories
|
||||||
|
NEWDIR=$CTF_BASE/points.new
|
||||||
|
TMPDIR=$CTF_BASE/points.tmp
|
||||||
|
|
||||||
|
install -d /var/www
|
||||||
|
install -d /var/lib/ctf
|
||||||
|
install -o ctf -m 0755 -d $NEWDIR
|
||||||
|
install -o ctf -m 0755 -d $TMPDIR
|
||||||
|
|
||||||
|
# Create some files
|
||||||
|
touch /var/lib/ctf/points.log
|
||||||
|
|
||||||
|
# Generate preliminary scoreboard
|
||||||
|
if [ ! -f /var/www/scoreboard.html ]; then
|
||||||
|
./mkpage scoreboard < /dev/null > /var/www/scoreboard.html
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate preliminary puzzles list
|
||||||
|
if [ ! -f /var/www/puzzles.html ]; then
|
||||||
|
./mkpage puzzles.cgi > /var/www/puzzles.html
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run pointsd every time a new points file is dropped
|
||||||
|
if [ -x /sbin/inotifyd ]; then
|
||||||
|
exec /sbin/inotifyd ./pointsd $NEWDIR:y
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Simulate inotifyd by polling
|
||||||
|
cd $NEWDIR
|
||||||
|
while true; do
|
||||||
|
find . -type f | while read fn; do
|
||||||
|
./pointsd m $NEWDIR ${fn#./}
|
||||||
|
done
|
||||||
|
sleep 7
|
||||||
|
done
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
read password < /opt/00admin/password
|
password='grape guts'
|
||||||
|
for fn in /opt/*/password; do
|
||||||
|
read password < $fn && break
|
||||||
|
done
|
||||||
|
|
||||||
printf 'root:%s' "$password" | chpasswd --md5
|
printf 'root:%s' "$password" | chpasswd --md5
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
CFLAGS = -Wall -Werror
|
CFLAGS = -Wall -Werror
|
||||||
TARGETS = claim.cgi puzzler.cgi puzzles.cgi
|
TARGETS = claim.cgi puzzler.cgi puzzles.cgi pointscli
|
||||||
TARGETS += pointscli
|
TARGETS += tea bubblebabble
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
build: $(TARGETS)
|
build: $(TARGETS)
|
||||||
|
|
||||||
pointscli: pointscli.o common.o
|
pointscli: common.o
|
||||||
|
|
||||||
puzzles.cgi: puzzles.cgi.o common.o
|
puzzles.cgi: puzzles.cgi.o common.o
|
||||||
claim.cgi: claim.cgi.o common.o
|
claim.cgi: claim.cgi.o common.o
|
||||||
|
@ -14,4 +14,3 @@ puzzler.cgi: puzzler.cgi.o common.o
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGETS) *.o
|
rm -f $(TARGETS) *.o
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sysexits.h>
|
||||||
|
|
||||||
|
/** Compute bubble babble for input buffer.
|
||||||
|
*
|
||||||
|
* The generated output will be of length 6*((inlen/2)+1), including the
|
||||||
|
* trailing NULL.
|
||||||
|
*
|
||||||
|
* Test vectors:
|
||||||
|
* `' (empty string) `xexax'
|
||||||
|
* `1234567890' `xesef-disof-gytuf-katof-movif-baxux'
|
||||||
|
* `Pineapple' `xigak-nyryk-humil-bosek-sonax'
|
||||||
|
*/
|
||||||
|
static char const consonants[] = "bcdfghklmnprstvz";
|
||||||
|
static char const vowels[] = "aeiouy";
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int seed = 1;
|
||||||
|
|
||||||
|
putchar('x');
|
||||||
|
while (1) {
|
||||||
|
int c;
|
||||||
|
|
||||||
|
c = getchar();
|
||||||
|
if (EOF == c) {
|
||||||
|
putchar(vowels[seed % 6]);
|
||||||
|
putchar('x');
|
||||||
|
putchar(vowels[seed / 6]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
putchar(vowels[(((c >> 6) & 3) + seed) % 6]);
|
||||||
|
putchar(consonants[(c >> 2) & 15]);
|
||||||
|
putchar(vowels[((c & 3) + (seed / 6)) % 6]);
|
||||||
|
|
||||||
|
seed = (seed * 5) + (c * 7);
|
||||||
|
c = getchar();
|
||||||
|
seed = (seed + c) % 36;
|
||||||
|
|
||||||
|
if (EOF == c) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
putchar(consonants[(c >> 4) & 15]);
|
||||||
|
putchar('-');
|
||||||
|
putchar(consonants[c & 15]);
|
||||||
|
}
|
||||||
|
|
||||||
|
putchar('x');
|
||||||
|
putchar('\n');
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -59,7 +59,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
FILE *f = fopen(state_path("puzzles.db"), "r");
|
FILE *f = fopen(state_path("points.log"), "r");
|
||||||
char cat[CAT_MAX];
|
char cat[CAT_MAX];
|
||||||
char points_str[11];
|
char points_str[11];
|
||||||
long points;
|
long points;
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
exec setuidgid nobody /opt/cowbull/bin/cowd < /opt/cowbull/tokens.txt
|
exec setuidgid nobody /opt/cowbull/bin/cowd < /opt/cowbull/tokens.txt
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
exec tcpsvd -u nobody ${IP%/*} 1013 ./go
|
exec tcpsvd -u nobody ${IP%/*} 1013 ./go
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
adduser -S -H -u 65534 nobody
|
adduser -S -H -u 65534 nobody
|
||||||
adduser -S -H irc
|
adduser -S -H irc
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
diff -Naur fnord-1.10-orig//httpd.c fnord-1.10/httpd.c
|
|
||||||
--- fnord-1.10-orig//httpd.c 2005-08-03 05:32:50.000000000 -0600
|
|
||||||
+++ fnord-1.10/httpd.c 2011-03-14 17:05:57.000000000 -0600
|
|
||||||
@@ -163,9 +163,8 @@
|
|
||||||
|
|
||||||
#define MAXHEADERLEN 8192
|
|
||||||
|
|
||||||
-char* remote_ip;
|
|
||||||
+char* remote_addr;
|
|
||||||
#ifdef CGI
|
|
||||||
-char* remote_port;
|
|
||||||
char* remote_ident;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -186,7 +185,7 @@
|
|
||||||
time_t t=time(0);
|
|
||||||
struct tm* x=localtime(&t);
|
|
||||||
int l=-(timezone/60);
|
|
||||||
- buffer_puts(buffer_2,remote_ip?remote_ip:"0.0.0.0");
|
|
||||||
+ buffer_puts(buffer_2,remote_addr?remote_addr:"0.0.0.0");
|
|
||||||
buffer_puts(buffer_2," - - [");
|
|
||||||
|
|
||||||
buffer_put2digits(buffer_2,x->tm_mday);
|
|
||||||
@@ -219,7 +218,7 @@
|
|
||||||
buffer_putrange(buffer_2,len);
|
|
||||||
|
|
||||||
#else
|
|
||||||
- buffer_puts(buffer_2,remote_ip?remote_ip:"0.0.0.0");
|
|
||||||
+ buffer_puts(buffer_2,remote_addr?remote_addr:"0.0.0.0");
|
|
||||||
buffer_putspace(buffer_2);
|
|
||||||
buffer_putulong(buffer_2,retcode);
|
|
||||||
buffer_putspace(buffer_2);
|
|
||||||
@@ -271,7 +270,6 @@
|
|
||||||
"REQUEST_URI=",
|
|
||||||
"SCRIPT_NAME=",
|
|
||||||
"REMOTE_ADDR=",
|
|
||||||
- "REMOTE_PORT=",
|
|
||||||
"REMOTE_IDENT=",
|
|
||||||
"HTTP_USER_AGENT=",
|
|
||||||
"HTTP_COOKIE=",
|
|
||||||
@@ -337,17 +335,10 @@
|
|
||||||
*tmp=0; ++tmp;
|
|
||||||
|
|
||||||
i=7;
|
|
||||||
- if (remote_ip) {
|
|
||||||
+ if (remote_addr) {
|
|
||||||
cgi_env[++i]=tmp;
|
|
||||||
tmp+=str_copy(tmp,"REMOTE_ADDR=");
|
|
||||||
- tmp+=str_copy(tmp,remote_ip);
|
|
||||||
- *tmp=0; ++tmp;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (remote_port) {
|
|
||||||
- cgi_env[++i]=tmp;
|
|
||||||
- tmp+=str_copy(tmp,"REMOTE_PORT=");
|
|
||||||
- tmp+=str_copy(tmp,remote_port);
|
|
||||||
+ tmp+=str_copy(tmp,remote_addr);
|
|
||||||
*tmp=0; ++tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -663,8 +654,9 @@
|
|
||||||
static char* mimetype="text/plain";
|
|
||||||
|
|
||||||
static struct mimeentry { const char* name, *type; } mimetab[] = {
|
|
||||||
- { "html", "text/html" },
|
|
||||||
- { "htm", "text/html" },
|
|
||||||
+ { "html", "text/html; charset=utf-8" },
|
|
||||||
+ { "htm", "text/html; charset=utf-8" },
|
|
||||||
+ { "txt", "text/plain; charset=utf-8" },
|
|
||||||
{ "css", "text/css" },
|
|
||||||
{ "dvi", "application/x-dvi" },
|
|
||||||
{ "ps", "application/postscript" },
|
|
||||||
@@ -1060,16 +1052,7 @@
|
|
||||||
static void get_ucspi_env(void) {
|
|
||||||
char* ucspi=getenv("PROTO");
|
|
||||||
if (ucspi) {
|
|
||||||
- char* buf=alloca(str_len(ucspi)+20);
|
|
||||||
- unsigned int tmp=str_copy(buf,ucspi);
|
|
||||||
- buf[tmp+str_copy(buf+tmp,"REMOTEIP")]=0;
|
|
||||||
- remote_ip=getenv(buf);
|
|
||||||
-#ifdef CGI
|
|
||||||
- buf[tmp+str_copy(buf+tmp,"REMOTEPORT")]=0;
|
|
||||||
- remote_port=getenv(buf);
|
|
||||||
- buf[tmp+str_copy(buf+tmp,"REMOTEINFO")]=0;
|
|
||||||
- remote_ident=getenv(buf);
|
|
||||||
-#endif
|
|
||||||
+ remote_addr=getenv("REMOTEADDR");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,36 +1,21 @@
|
||||||
MCP_PKGDIR = $(TARGET)/mcp
|
MCP_PKGDIR = $(TARGET)/mcp
|
||||||
MCP_BUILDDIR = $(BUILD)/mcp
|
|
||||||
|
|
||||||
mcp-source: $(MCP_BUILDDIR)/source
|
mcp-install: eris ctfbase
|
||||||
$(MCP_BUILDDIR)/source:
|
|
||||||
mkdir -p $(@D)
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
mcp-build: $(MCP_BUILDDIR)/build
|
|
||||||
$(MCP_BUILDDIR)/build: $(MCP_BUILDDIR)/source
|
|
||||||
$(MAKE) -C packages/mcp/src build
|
|
||||||
|
|
||||||
mcp-install: $(MCP_BUILDDIR)/build eris
|
|
||||||
mkdir -p $(MCP_PKGDIR)
|
mkdir -p $(MCP_PKGDIR)
|
||||||
|
|
||||||
|
$(call CTFBASE_INSTALL, $(MCP_PKGDIR))
|
||||||
|
|
||||||
$(call COPYTREE, packages/mcp/bin, $(MCP_PKGDIR)/bin)
|
$(call COPYTREE, packages/mcp/bin, $(MCP_PKGDIR)/bin)
|
||||||
cp packages/mcp/src/pointscli $(MCP_PKGDIR)/bin/
|
|
||||||
cp packages/mcp/src/puzzles.cgi $(MCP_PKGDIR)/bin/
|
|
||||||
cp packages/mcp/src/tea $(MCP_PKGDIR)/bin/
|
|
||||||
|
|
||||||
cp $(ERIS_BIN) $(MCP_PKGDIR)/bin/
|
cp $(ERIS_BIN) $(MCP_PKGDIR)/bin/
|
||||||
|
|
||||||
$(call COPYTREE, packages/mcp/service, $(MCP_PKGDIR)/service)
|
$(call COPYTREE, packages/mcp/service, $(MCP_PKGDIR)/service)
|
||||||
|
|
||||||
$(call COPYTREE, packages/mcp/www, $(MCP_PKGDIR)/www)
|
$(call COPYTREE, packages/mcp/www, $(MCP_PKGDIR)/www)
|
||||||
cp packages/mcp/src/puzzler.cgi $(MCP_PKGDIR)/www/
|
cp packages/00common/src/puzzler.cgi $(MCP_PKGDIR)/www/
|
||||||
cp packages/mcp/src/claim.cgi $(MCP_PKGDIR)/www/
|
cp packages/00common/src/claim.cgi $(MCP_PKGDIR)/www/
|
||||||
|
|
||||||
mcp-test: mcp-build
|
mcp-test: mcp-build
|
||||||
packages/mcp/test.sh
|
packages/mcp/test.sh
|
||||||
|
|
||||||
mcp-clean:
|
|
||||||
rm -rf $(MCP_PKGDIR) $(MCP_BUILDDIR)
|
|
||||||
$(MAKE) -C packages/mcp/src clean
|
|
||||||
|
|
||||||
PACKAGES += mcp
|
PACKAGES += mcp
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
hostname mcp
|
hostname mcp
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
#! /bin/sh -e
|
|
||||||
|
|
||||||
fn=$2/$3
|
|
||||||
|
|
||||||
WWW=${CTF_BASE:-/var/www}
|
|
||||||
BASE=${CTF_BASE:-/var/lib/ctf}
|
|
||||||
OPT=${CTF_BASE:-/opt}
|
|
||||||
|
|
||||||
POINTS=$BASE/points.log
|
|
||||||
BACKUP=$WWW/backup.png
|
|
||||||
SCOREBOARD=$WWW/scoreboard.html
|
|
||||||
|
|
||||||
# Only do this if this score hasn't yet been recorded
|
|
||||||
if [ -z "$(sort -k2 $POINTS $fn | uniq -f1 -d)" ]; then
|
|
||||||
cat $fn >> $POINTS
|
|
||||||
rm $fn
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $POINTS -nt $SCOREBOARD ]; then
|
|
||||||
# Generate new backup
|
|
||||||
(
|
|
||||||
cat bkup.png;
|
|
||||||
tar cvf - $BASE | gzip -c | $OPT/00admin/bin/tea 3< $OPT/00admin/password
|
|
||||||
) > $BACKUP.new
|
|
||||||
mv $BACKUP.new $BACKUP
|
|
||||||
|
|
||||||
# Render scoreboard
|
|
||||||
/opt/mcp/bin/scoreboard < $POINTS > $SCOREBOARD.new
|
|
||||||
mv $SCOREBOARD.new $SCOREBOARD
|
|
||||||
fi
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
#! /bin/sh -e
|
|
||||||
|
|
||||||
exec 2>&1
|
|
||||||
|
|
||||||
install -d /var/lib/ctf
|
|
||||||
|
|
||||||
# Create CTF and nobody users
|
|
||||||
touch /etc/group /etc/passwd
|
|
||||||
addgroup -g 65534 nogroup || true
|
|
||||||
adduser -D -S -h /var/lib/ctf -H ctf || true
|
|
||||||
adduser -D -g nogroup -u 65534 -h /tmp -H nobody || true
|
|
||||||
|
|
||||||
# Set up base directories
|
|
||||||
NEWDIR=/var/lib/ctf/points.new
|
|
||||||
install -d /var/www
|
|
||||||
install -d /var/lib/ctf
|
|
||||||
install -o ctf -m 0755 -d $NEWDIR
|
|
||||||
install -o ctf -m 0755 -d /var/lib/ctf/points.tmp
|
|
||||||
|
|
||||||
# Create some files
|
|
||||||
CLAIM=/var/lib/ctf/claim.db
|
|
||||||
touch $CLAIM
|
|
||||||
chown ctf $CLAIM
|
|
||||||
touch /var/lib/ctf/points.log
|
|
||||||
|
|
||||||
# Generate preliminary scoreboard
|
|
||||||
if ! [ -f /var/www/scoreboard.html ]; then
|
|
||||||
/opt/mcp/bin/scoreboard < /dev/null > /var/www/scoreboard.html
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ -x /sbin/inotifyd ]; then
|
|
||||||
exec /sbin/inotifyd ./pointsd $NEWDIR:y
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Simulate inotifyd
|
|
||||||
cd $NEWDIR
|
|
||||||
while true; do
|
|
||||||
for fn in *; do
|
|
||||||
[ -f "$fn" ] || continue
|
|
||||||
./pointsd m $NEWDIR $fn
|
|
||||||
done
|
|
||||||
sleep 7
|
|
||||||
done
|
|
|
@ -1,5 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
|
|
||||||
PUZZLES=/var/www/puzzles.html
|
|
||||||
|
|
||||||
/opt/mcp/bin/puzzles.cgi > $PUZZLES.new && mv $PUZZLES.new $PUZZLES
|
|
|
@ -1,15 +0,0 @@
|
||||||
#! /bin/sh -e
|
|
||||||
|
|
||||||
exec 2>&1
|
|
||||||
|
|
||||||
install -d /var/www
|
|
||||||
|
|
||||||
# Install truncates files
|
|
||||||
DB=/var/lib/ctf/puzzles.db
|
|
||||||
touch $DB
|
|
||||||
chown ctf $DB
|
|
||||||
|
|
||||||
# Make an initial listing
|
|
||||||
./puzzled
|
|
||||||
|
|
||||||
exec inotifyd ./puzzled ${DB}:w
|
|
|
@ -1,40 +0,0 @@
|
||||||
#ifndef __ARC4_H__
|
|
||||||
#define __ARC4_H__
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#define ARC4_KEYLEN 256
|
|
||||||
|
|
||||||
struct arc4_ctx {
|
|
||||||
uint8_t S[256];
|
|
||||||
uint8_t i;
|
|
||||||
uint8_t j;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Stream operations */
|
|
||||||
ssize_t
|
|
||||||
arc4_encrypt_stream(FILE *out, FILE *in,
|
|
||||||
const uint8_t *key, size_t keylen);
|
|
||||||
ssize_t
|
|
||||||
arc4_decrypt_stream(FILE *out, FILE *in,
|
|
||||||
const uint8_t *key, size_t keylen);
|
|
||||||
|
|
||||||
|
|
||||||
/* Auto-seeding Psuedo Random Number Generator */
|
|
||||||
void arc4_rand_seed(const uint8_t *seed, size_t seedlen);
|
|
||||||
uint8_t arc4_rand8();
|
|
||||||
uint32_t arc4_rand32();
|
|
||||||
|
|
||||||
/* Low-level operations */
|
|
||||||
void arc4_init(struct arc4_ctx *ctx, const uint8_t *key, size_t keylen);
|
|
||||||
uint8_t arc4_out(struct arc4_ctx *ctx);
|
|
||||||
void arc4_crypt(struct arc4_ctx *ctx,
|
|
||||||
uint8_t *obuf, const uint8_t *ibuf, size_t buflen);
|
|
||||||
void arc4_crypt_buffer(const uint8_t *key, size_t keylen,
|
|
||||||
uint8_t *buf, size_t buflen);
|
|
||||||
void arc4_nonce(uint8_t *nonce, size_t noncelen, void *seed, size_t seedlen);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
exec setuidgid ctf /opt/multicaster/bin/multicaster ff15::62c 1580 </opt/multicaster/tokens.txt
|
exec setuidgid ctf /opt/multicaster/bin/multicaster ff15::62c 1580 </opt/multicaster/tokens.txt
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
8
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip)
|
IP=$(dbip -p ../octopus/ip.txt)
|
||||||
|
|
||||||
sv s octopus >/dev/null || exit 1
|
sv s octopus >/dev/null || exit 1
|
||||||
exec tcpsvd ${IP%/*} 8888 ./octopus-redirect
|
exec tcpsvd ${IP%/*} 8888 ./octopus-redirect
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
grep -q ipv4 /proc/cmdline && IP=::ffff:$IP
|
grep -q ipv4 /proc/cmdline && IP=::ffff:$IP
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
: ${BASE:=/var/lib/ctf/p2}
|
: ${CTF_BASE:=/var/lib/ctf}
|
||||||
|
BASE=$CTF_BASE/teams
|
||||||
mkdir -p $BASE
|
|
||||||
|
|
||||||
if ! [ -f $BASE/salt ]; then
|
|
||||||
dd if=/dev/urandom count=1 | md5sum - > $BASE/salt
|
|
||||||
fi
|
|
||||||
clear
|
|
||||||
printf '\017'
|
|
||||||
read salt < $BASE/salt
|
|
||||||
|
|
||||||
esc () {
|
esc () {
|
||||||
printf '%s' "$*" | sed 's/[^-0-9A-Za-z ]/_/g; s/ /+/g'
|
printf '%s' "$*" | sed 's/[^-0-9A-Za-z ]/_/g; s/ /+/g'
|
||||||
|
@ -28,14 +20,12 @@ newteam () {
|
||||||
fi
|
fi
|
||||||
hash=$(printf '%s %s' "$salt" "$name" | md5sum | cut -b 1-8)
|
hash=$(printf '%s %s' "$salt" "$name" | md5sum | cut -b 1-8)
|
||||||
|
|
||||||
if [ -d $BASE/$hash ]; then
|
if [ -f $BASE/names/$hash ]; then
|
||||||
echo "That name is already in use. Try another one."
|
echo "That name is already in use. Try another one."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir $BASE/$hash
|
printf '%s' "$name" > $BASE/names/$hash
|
||||||
|
|
||||||
printf '%s' "$name" > $BASE/$hash/.name
|
|
||||||
|
|
||||||
cat <<EOD
|
cat <<EOD
|
||||||
Your team hash is [1m$hash[0m. Write that down somewhere and don't lose it.
|
Your team hash is [1m$hash[0m. Write that down somewhere and don't lose it.
|
||||||
|
@ -51,7 +41,15 @@ fini () {
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
echo -n 'Team hash ("new" to create a new team): '
|
log () {
|
||||||
|
awk -v H=$1 '($2 == H) { print($3, $4); }' $CTF_BASE/points.log
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
clear
|
||||||
|
read salt < $BASE/salt
|
||||||
|
|
||||||
|
printf '\017Team hash ("new" to create a new team): '
|
||||||
read -r hash
|
read -r hash
|
||||||
echo
|
echo
|
||||||
if [ -z "$hash" ]; then
|
if [ -z "$hash" ]; then
|
||||||
|
@ -59,15 +57,18 @@ if [ -z "$hash" ]; then
|
||||||
elif [ "$hash" = "new" ]; then
|
elif [ "$hash" = "new" ]; then
|
||||||
newteam
|
newteam
|
||||||
fini
|
fini
|
||||||
elif ! [ -d $BASE/$hash ]; then
|
elif [ "$hash" = 58 ]; then
|
||||||
|
name='Thumper Bumper'
|
||||||
|
elif ! [ -f $BASE/names/$hash ]; then
|
||||||
echo "No such team, fool."
|
echo "No such team, fool."
|
||||||
echo "Is this when everybody laughs at you for forgetting your hash?"
|
echo "Is this when everybody laughs at you for forgetting your hash?"
|
||||||
fini
|
fini
|
||||||
|
else
|
||||||
|
read -r name < $BASE/names/$hash
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
read -r name < $BASE/$hash/.name
|
|
||||||
|
|
||||||
printf 'Welcome back, [1m%s[0m.\n' "$name"
|
printf 'Welcome back, [1m%s[0m.\n' "$name"
|
||||||
|
|
||||||
|
@ -81,7 +82,8 @@ while true; do
|
||||||
[1m Help
|
[1m Help
|
||||||
----------------------------------------------------------[0m
|
----------------------------------------------------------[0m
|
||||||
|
|
||||||
Type "[1mquit[0m" to leave the p2 shell.
|
Type [1mquit[0m to leave the p2 shell.
|
||||||
|
Type [1mlog[0m to show answered puzzles.
|
||||||
|
|
||||||
Any other string is checked as an answer. If the answer
|
Any other string is checked as an answer. If the answer
|
||||||
is correct, you are awarded points and the scoreboard will
|
is correct, you are awarded points and the scoreboard will
|
||||||
|
@ -90,6 +92,14 @@ see if your answer unlocked a new puzzle.
|
||||||
EOD
|
EOD
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
|
log)
|
||||||
|
cat <<EOD
|
||||||
|
[1mPuzzles Answered By $name
|
||||||
|
---------------------------------------[0m
|
||||||
|
EOD
|
||||||
|
log $hash
|
||||||
|
continue
|
||||||
|
;;
|
||||||
quit)
|
quit)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
@ -104,13 +114,12 @@ EOD
|
||||||
cat=${match% *}
|
cat=${match% *}
|
||||||
points=${match#* }
|
points=${match#* }
|
||||||
fn=$BASE/$hash/$cat.$points
|
fn=$BASE/$hash/$cat.$points
|
||||||
if [ -f $fn ]; then
|
if log $hash | grep -Fxq "$cat $points"; then
|
||||||
echo "You've already received points for this answer."
|
echo "You've already received points for this answer."
|
||||||
else
|
elif pointscli $hash $cat $points p2console; then
|
||||||
> $fn
|
|
||||||
echo "You get [1m$points[0m more points in the [1m$cat[0m category."
|
echo "You get [1m$points[0m more points in the [1m$cat[0m category."
|
||||||
# run puzzles.cgi
|
else
|
||||||
# update scoreboard
|
echo "[1mError recording points. Tell the officials![0m"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
P2_PKGDIR = $(TARGET)/p2
|
||||||
|
|
||||||
|
p2-build: packages/p2/src/modem
|
||||||
|
packages/p2/src/modem:
|
||||||
|
$(MAKE) -C packages/p2/src
|
||||||
|
|
||||||
|
p2-install: packages/p2/src/modem eris ctfbase
|
||||||
|
mkdir -p $(P2_PKGDIR)
|
||||||
|
|
||||||
|
$(call CTFBASE_INSTALL, $(P2_PKGDIR))
|
||||||
|
|
||||||
|
$(call COPYTREE, packages/p2/bin, $(P2_PKGDIR)/bin)
|
||||||
|
|
||||||
|
cp $(ERIS_BIN) $(P2_PKGDIR)/bin/
|
||||||
|
cp packages/p2/src/modem $(P2_PKGDIR)/bin/
|
||||||
|
|
||||||
|
$(call COPYTREE, packages/p2/service, $(P2_PKGDIR)/service)
|
||||||
|
|
||||||
|
$(call COPYTREE, packages/mcp/www, $(P2_PKGDIR)/www)
|
||||||
|
|
||||||
|
p2-clean:
|
||||||
|
$(MAKE) -C packages/p2/src
|
||||||
|
|
||||||
|
PACKAGES += p2
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
|
|
@ -2,12 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -p ../p2console/ip.txt)
|
||||||
|
|
||||||
addgroup -g 65534 nogroup || true
|
|
||||||
adduser -D -g nogroup -u 65534 -h /tmp -H nobody || true
|
|
||||||
|
|
||||||
hostname p2
|
|
||||||
|
|
||||||
# Link in puzzles and web pages
|
# Link in puzzles and web pages
|
||||||
install -d /var/www
|
install -d /var/www
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
dbip -d
|
|
@ -0,0 +1,5 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
/opt/p2/bin/p2console
|
||||||
|
done | /opt/p2/bin/modem
|
|
@ -0,0 +1,15 @@
|
||||||
|
#! /bin/sh -e
|
||||||
|
|
||||||
|
exec 2>&1
|
||||||
|
|
||||||
|
hostname p2
|
||||||
|
|
||||||
|
IP=$(dbip -a)
|
||||||
|
install -d /var/lib/ctf/teams
|
||||||
|
install -o ctf -m 0755 -d /var/lib/ctf/teams/names
|
||||||
|
|
||||||
|
if ! [ -f /var/lib/ctf/teams/salt ]; then
|
||||||
|
dd if=/dev/urandom count=1 | md5sum - > /var/lib/ctf/teams/salt
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec setuidgid ctf tcpsvd 0 5555 ./p2console
|
|
@ -1,31 +0,0 @@
|
||||||
#! /bin/sh -e
|
|
||||||
|
|
||||||
fn=$2/$3
|
|
||||||
|
|
||||||
WWW=${CTF_BASE:-/var/www}
|
|
||||||
BASE=${CTF_BASE:-/var/lib/ctf}
|
|
||||||
OPT=${CTF_BASE:-/opt}
|
|
||||||
|
|
||||||
POINTS=$BASE/points.log
|
|
||||||
BACKUP=$WWW/backup.png
|
|
||||||
SCOREBOARD=$WWW/scoreboard.html
|
|
||||||
|
|
||||||
# Only do this if this score hasn't yet been recorded
|
|
||||||
if [ -z "$(sort -k2 $POINTS $fn | uniq -f1 -d)" ]; then
|
|
||||||
cat $fn >> $POINTS
|
|
||||||
rm $fn
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $POINTS -nt $SCOREBOARD ]; then
|
|
||||||
# Generate new backup
|
|
||||||
(
|
|
||||||
cat bkup.png;
|
|
||||||
tar cvf - $BASE | gzip -c | $OPT/00admin/bin/tea 3< $OPT/00admin/password
|
|
||||||
) > $BACKUP.new
|
|
||||||
mv $BACKUP.new $BACKUP
|
|
||||||
|
|
||||||
# Render scoreboard
|
|
||||||
/opt/p2/bin/scoreboard < $POINTS > $SCOREBOARD.new
|
|
||||||
mv $SCOREBOARD.new $SCOREBOARD
|
|
||||||
fi
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
#! /bin/sh -e
|
|
||||||
|
|
||||||
exec 2>&1
|
|
||||||
|
|
||||||
install -d /var/lib/ctf
|
|
||||||
|
|
||||||
# Create CTF and nobody users
|
|
||||||
touch /etc/group /etc/passwd
|
|
||||||
addgroup -g 65534 nogroup || true
|
|
||||||
adduser -D -S -h /var/lib/ctf -H ctf || true
|
|
||||||
adduser -D -g nogroup -u 65534 -h /tmp -H nobody || true
|
|
||||||
|
|
||||||
# Set up base directories
|
|
||||||
NEWDIR=/var/lib/ctf/points.new
|
|
||||||
install -d /var/www
|
|
||||||
install -d /var/lib/ctf
|
|
||||||
install -o ctf -m 0755 -d $NEWDIR
|
|
||||||
install -o ctf -m 0755 -d /var/lib/ctf/points.tmp
|
|
||||||
|
|
||||||
# Create some files
|
|
||||||
CLAIM=/var/lib/ctf/claim.db
|
|
||||||
touch $CLAIM
|
|
||||||
chown ctf $CLAIM
|
|
||||||
touch /var/lib/ctf/points.log
|
|
||||||
|
|
||||||
# Generate preliminary scoreboard
|
|
||||||
if ! [ -f /var/www/scoreboard.html ]; then
|
|
||||||
/opt/mcp/bin/scoreboard < /dev/null > /var/www/scoreboard.html
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ -x /sbin/inotifyd ]; then
|
|
||||||
exec /sbin/inotifyd ./pointsd $NEWDIR:y
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Simulate inotifyd
|
|
||||||
cd $NEWDIR
|
|
||||||
while true; do
|
|
||||||
for fn in *; do
|
|
||||||
[ -f "$fn" ] || continue
|
|
||||||
./pointsd m $NEWDIR $fn
|
|
||||||
done
|
|
||||||
sleep 7
|
|
||||||
done
|
|
|
@ -1,4 +1,4 @@
|
||||||
all: modem tea
|
all: modem
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f modem tea
|
rm -f modem
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**** Color Scheme ****/
|
/**** Color Scheme ****/
|
||||||
html {
|
html {
|
||||||
background: #112 url(smoke.jpg) no-repeat;
|
background: #112 url(p2inv.jpg) no-repeat;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,6 @@
|
||||||
<li>
|
<li>
|
||||||
<a href="puzzles.html">Puzzles</a>
|
<a href="puzzles.html">Puzzles</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href="news.html">News</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href="scoring.html">About scoring</a>
|
<a href="scoring.html">About scoring</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Try hard to look like a serial connection
|
# Try hard to look like a serial terminal
|
||||||
|
|
||||||
reset
|
reset
|
||||||
|
|
||||||
|
# Maybe this is some startup code
|
||||||
|
sleep 0.4
|
||||||
|
|
||||||
# Print some bullshit to confuse people
|
# Print some bullshit to confuse people
|
||||||
printf 'RS232/0:1200-N81 '
|
printf 'S0:1200N81 '
|
||||||
|
|
||||||
# Simulate a green-phosphor CRT
|
# Simulate a green-phosphor CRT
|
||||||
printf '\033]P0111122\033]P788ff00\033]Pfff8800'
|
printf '\033]P0111122\033]P788ff00\033]Pfff8800'
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
ip addr add $IP dev eth0 || true
|
ip addr add $IP dev eth0 || true
|
||||||
|
|
||||||
exec tcpsvd -u nobody ${IP%/*} 1013 /opt/playfair/bin/playfair
|
exec tcpsvd -u nobody ${IP%/*} 1013 /opt/playfair/bin/playfair
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
# 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"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
exec tcpsvd -u nobody ${IP%/*} 1013 ./go
|
exec tcpsvd -u nobody ${IP%/*} 1013 ./go
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
/opt/00admin/bin/fire-ip del
|
dbip -d
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
IP=$(/opt/00admin/bin/fire-ip add)
|
IP=$(dbip -a)
|
||||||
|
|
||||||
dir=/var/lib/ctf/rlyeh
|
dir=/var/lib/ctf/rlyeh
|
||||||
install -o nobody -d $dir
|
install -o nobody -d $dir
|
||||||
|
|
Loading…
Reference in New Issue