From 2d9857cf28bd80bce3c8fee612959adacf488911 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 24 Jan 2011 12:46:18 -0700 Subject: [PATCH] Add team listing to tokend --- Makefile | 2 +- doc/2010-10-NMT/email1.txt | 67 +++++++++++++++++++++--------------- packages/mcp/src/in.tokend.c | 37 ++++++++++++++++++++ 3 files changed, 78 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index bef9f96..19afd28 100644 --- a/Makefile +++ b/Makefile @@ -19,4 +19,4 @@ clean: packages-clean scrub: clean rm -rf $(CACHE) -include packages/packages.mk +-include */*.mk diff --git a/doc/2010-10-NMT/email1.txt b/doc/2010-10-NMT/email1.txt index 2685869..dee8079 100644 --- a/doc/2010-10-NMT/email1.txt +++ b/doc/2010-10-NMT/email1.txt @@ -11,48 +11,61 @@ There are 5 tokens hidden in this message. Can you find them all? --eJwryC8uSS0qtqpIzc1P1i3OT86vAABObgfA Content-type: text/plain; charset=UTF-8 -Are you ready for CTF? +CTF starts TOMORROW! Do you have sufficient stores of Mountain Dew? -The teams are in and it looks like this year's CTF is going to be about -double the size of last year. I've posted teams at -. +This is CMU's first ever CTF, so please be ready for a couple of +hiccups. Likewise, we expect you to be totally lost for a while, as you +get your bearings. While we tried to cover everything in the +registration web page, here are some points worth repeating: -If you came last year, there are some changes in store for you. I've -done away with the weird boxes at each table, so there's no need to -bring a monitor or keyboard. What you really need to be a sysadmin this -year is netcat and nmap. We will *not* provide an Internet connection, -so figure out now how you're going to get onto the Internet (you will -need it). +Your machine really ought to have netcat and nmap, and whatever +programming language(s) you prefer. An Ubuntu live CD has, at past +contests, not been sufficient. It's also a good idea to make sure your +computer works before you show up. Time is precious, don't spend yours +installing an operating system. + +We will have a switch at each table with gobs of ports, but you should +bring your own network cable. We will *not* provide an Internet +connection, so figure out now how you're going to get onto the Internet +(you will need it). If you have any questions, or would just like to hang out and shoot the breeze, feel free to hop on IRC (server woozle.org, channel #ctf). -I hope you all have as much fun playing this as I've had building it! +We hope you have as much fun playing this as we're going to have +watching you work! -zephyr +The Dirtbags + +PS: are you aware of how much data can be hidden in a single email? --eJwryC8uSS0qtqpIzc1P1i3OT86vAABObgfA Content-type: text/html; charset=UTF-8 -

Are you ready for CTF?

+

CTF starts TOMORROW! Do you have sufficient stores of Mountain Dew?

-

The teams are in and it looks like this year's CTF is going to be -about double the size of last year. I've posted teams at -http://dirtbags.net/ctf.

+

This is CMU's first ever CTF, so please be ready for a couple of +hiccups. Likewise, we expect you to be totally lost for a while, as you +get your bearings. While we tried to cover everything in the +registration web page, here are some points worth repeating:

-

If you came last year, there are some changes in store for you. I've -done away with the weird boxes at each table, so there's no need to -bring a monitor or keyboard. What you really need to be a sysadmin this -year is netcat and nmap. We will not provide an -Internet connection, so figure out now how you're going to get onto the -Internet (you will need it).

+

Your machine really ought to have netcat and nmap, and whatever +programming language(s) you prefer. An Ubuntu live CD has, at past +contests, not been sufficient. It's also a good idea to make sure your +computer works before you show up. Time is precious, don't spend yours +installing an operating system.

-

If you have any questions, or would just like to hang out and shoot -the breeze, feel free to -hop on IRC (server woozle.org, channel #ctf).

+

We will have a switch at each table with gobs of ports, but you should +bring your own network cable. We will *not* provide an Internet +connection, so figure out now how you're going to get onto the Internet +(you will need it).

-

I hope you all have as much fun playing this as I've had building it!

+

If you have any questions, or would just like to hang out and shoot the +breeze, feel free to hop on IRC (server woozle.org, channel #ctf).

-

zephyr

+

We hope you have as much fun playing this as we're going to have +watching you work!

+ +

The Dirtbags

--eJwryC8uSS0qtqpIzc1P1i3OT86vAABObgfA-- cbfgref:krzbp-fbpbk diff --git a/packages/mcp/src/in.tokend.c b/packages/mcp/src/in.tokend.c index b94183a..7b1f044 100644 --- a/packages/mcp/src/in.tokend.c +++ b/packages/mcp/src/in.tokend.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -10,9 +11,36 @@ #include #include #include +#include #include "common.h" #include "arc4.h" +void +list_teams() +{ + struct dirent *ent; + DIR *dir; + + dir = opendir(state_path("teams/names")); + if (! dir) return; + while ((ent = readdir(dir))) { + struct stat buf; + + if ((0 == stat(state_path("teams/names/%s", ent->d_name), &buf)) && + (S_ISREG(buf.st_mode))) { + uint8_t hash[ARC4_HASHLEN]; + int i; + + arc4_hash((uint8_t *)ent->d_name, strlen(ent->d_name), hash); + for (i=0; i < ARC4_HASHLEN; i += 1) { + printf("%02x", hash[i]); + } + printf("\n"); + } + } + closedir(dir); +} + int main(int argc, char *argv[]) { @@ -29,11 +57,20 @@ main(int argc, char *argv[]) len = read(0, category, sizeof(category)); if (0 >= len) return 0; + + /* Category name of "?" lists arc4 hashes of all teams */ + if ((1 == len) && ('?' == category[0])) { + list_teams(); + return 0; + } + + /* Strip invalid characters */ for (categorylen = 0; (categorylen < len) && isalnum(category[categorylen]); categorylen += 1); } + /* Read in that category's key. */ { int fd;