Add team listing to tokend

This commit is contained in:
Neale Pickett 2011-01-24 12:46:18 -07:00
parent 07fcf382b4
commit 2d9857cf28
3 changed files with 78 additions and 28 deletions

View File

@ -19,4 +19,4 @@ clean: packages-clean
scrub: clean scrub: clean
rm -rf $(CACHE) rm -rf $(CACHE)
include packages/packages.mk -include */*.mk

View File

@ -11,48 +11,61 @@ There are 5 tokens hidden in this message. Can you find them all?
--eJwryC8uSS0qtqpIzc1P1i3OT86vAABObgfA --eJwryC8uSS0qtqpIzc1P1i3OT86vAABObgfA
Content-type: text/plain; charset=UTF-8 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 This is CMU's first ever CTF, so please be ready for a couple of
double the size of last year. I've posted teams at hiccups. Likewise, we expect you to be totally lost for a while, as you
<http://dirtbags.net/ctf>. 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 Your machine really ought to have netcat and nmap, and whatever
done away with the weird boxes at each table, so there's no need to programming language(s) you prefer. An Ubuntu live CD has, at past
bring a monitor or keyboard. What you really need to be a sysadmin this contests, not been sufficient. It's also a good idea to make sure your
year is netcat and nmap. We will *not* provide an Internet connection, computer works before you show up. Time is precious, don't spend yours
so figure out now how you're going to get onto the Internet (you will installing an operating system.
need it).
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 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). 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 --eJwryC8uSS0qtqpIzc1P1i3OT86vAABObgfA
Content-type: text/html; charset=UTF-8 Content-type: text/html; charset=UTF-8
<p>Are you ready for CTF?</p> <p>CTF starts TOMORROW! Do you have sufficient stores of Mountain Dew?</p>
<p>The teams are in and it looks like this year's CTF is going to be <p>This is CMU's first ever CTF, so please be ready for a couple of
about double the size of last year. I've posted teams at hiccups. Likewise, we expect you to be totally lost for a while, as you
<a href="http://dirtbags.net/ctf" class="posters">http://dirtbags.net/ctf</a>.</p> get your bearings. While we tried to cover everything in the
registration web page, here are some points worth repeating:</p>
<p>If you came last year, there are some changes in store for you. I've <p>Your machine really ought to have netcat and nmap, and whatever
done away with the weird boxes at each table, so there's no need to programming language(s) you prefer. An Ubuntu live CD has, at past
bring a monitor or keyboard. What you really need to be a sysadmin this contests, not been sufficient. It's also a good idea to make sure your
year is netcat and nmap. We will <i class="xalep">not</i> provide an computer works before you show up. Time is precious, don't spend yours
Internet connection, so figure out now how you're going to get onto the installing an operating system.</p>
Internet (you will need it).</p>
<p>If you have any questions, or would just like to hang out and shoot <p>We will have a switch at each table with gobs of ports, but you should
the breeze, feel free to bring your own network cable. We will *not* provide an Internet
<a href="irc://woozle.org/ctf" class="mikex">hop on IRC (server woozle.org, channel #ctf)</a>.</p> connection, so figure out now how you're going to get onto the Internet
(you will need it).</p>
<p>I hope you all have as much fun playing this as I've had building it!</p> <p>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).</p>
<p>zephyr</p> <p>We hope you have as much fun playing this as we're going to have
watching you work!</p>
<p><a href="http://dirtbags.net/#have_you_examined_the_email_closely?">The Dirtbags</a></p>
--eJwryC8uSS0qtqpIzc1P1i3OT86vAABObgfA-- --eJwryC8uSS0qtqpIzc1P1i3OT86vAABObgfA--
cbfgref:krzbp-fbpbk cbfgref:krzbp-fbpbk

View File

@ -1,4 +1,5 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@ -10,9 +11,36 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sysexits.h> #include <sysexits.h>
#include <dirent.h>
#include "common.h" #include "common.h"
#include "arc4.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 int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -29,11 +57,20 @@ main(int argc, char *argv[])
len = read(0, category, sizeof(category)); len = read(0, category, sizeof(category));
if (0 >= len) return 0; 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; for (categorylen = 0;
(categorylen < len) && isalnum(category[categorylen]); (categorylen < len) && isalnum(category[categorylen]);
categorylen += 1); categorylen += 1);
} }
/* Read in that category's key. */ /* Read in that category's key. */
{ {
int fd; int fd;