Merge branch 'master' of ssh://fozzie/home/neale/projects/ctf

Conflicts:
	packages/00common/src/claim.cgi.c
	packages/mcp/bin/scoreboard
	packages/mcp/www/register.cgi
	packages/wopr/www/wopr/wopr.cgi
This commit is contained in:
Neale Pickett 2013-06-17 13:15:13 -06:00
commit 831170e95e
6 changed files with 1023 additions and 496 deletions

View File

@ -58,6 +58,7 @@ main(int argc, char *argv[])
/* Pull category name out of the token */
for (q = category; *p && (*p != ':'); p += 1) {
*p = tolower(*p);
*(q++) = *p;
}
*q = '\0';

8
packages/host/host.mk Normal file
View File

@ -0,0 +1,8 @@
HOST_PKGDIR = $(TARGET)/host
host-install:
mkdir -p $(HOST_PKGDIR)
cp packages/host/tokens.txt $(HOST_PKGDIR)
PACKAGES += host

500
packages/host/tokens.txt Normal file
View File

@ -0,0 +1,500 @@
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

View File

@ -8,152 +8,150 @@
##
function qsort(A, left, right, i, last) {
if (left >= right)
return
swap(A, left, left+int((right-left+1)*rand()))
last = left
for (i = left+1; i <= right; i++)
if (A[i] < A[left])
swap(A, ++last, i)
swap(A, left, last)
qsort(A, left, last-1)
qsort(A, last+1, right)
if (left >= right)
return
swap(A, left, left+int((right-left+1)*rand()))
last = left
for (i = left+1; i <= right; i++)
if (A[i] < A[left])
swap(A, ++last, i)
swap(A, left, last)
qsort(A, left, last-1)
qsort(A, last+1, right)
}
function swap(A, i, j, t) {
t = A[i]; A[i] = A[j]; A[j] = t
t = A[i]; A[i] = A[j]; A[j] = t
}
function escape(s) {
gsub("&", "&amp;", s)
gsub("<", "&lt;", s)
gsub(">", "&gt;", s)
return s
gsub("&", "&amp;", s)
gsub("<", "&lt;", s)
gsub(">", "&gt;", s)
return s
}
function head() {
print "<!DOCTYPE html>"
print "<html><head><title>Project 2 Scoreboard</title>"
print "<meta http-equiv=\"refresh\" content=\"60\">"
print "<link rel=\"stylesheet\" href=\"ctf.css\" type=\"text/css\">"
print "<style>"
print "body {opacity: 0.9; margin: 0; padding: 0; max-width: inherit;}"
print "p {margin: 0; padding:0; line-height: inherit;}"
print "span {display: inline-block; margin: 0; border: 0; padding: 0;}"
print ".cat0 {background-color: #a6cee3; color: black;}"
print ".cat1 {background-color: #1f78b4;}"
print ".cat2 {background-color: #b2df8a; color: black;}"
print ".cat3 {background-color: #33a02c;}"
print ".cat4 {background-color: #fb9a99;}"
print ".cat5 {background-color: #e31a1c;}"
print ".cat6 {background-color: #fdbf6f;}"
print ".cat7 {background-color: #ff7f00;}"
print ".cat8 {background-color: #cab2d6;}"
print "<!DOCTYPE html>"
print "<html><head><title>Project 2 Scoreboard</title>"
print "<meta http-equiv=\"refresh\" content=\"60\">"
print "<link rel=\"stylesheet\" href=\"ctf.css\" type=\"text/css\">"
print "<style>"
print "body {opacity: 0.9; margin: 0; padding: 0; max-width: inherit;}"
print "p {margin: 0; padding:0; line-height: inherit;}"
print "span {display: inline-block; margin: 0; border: 0; padding: 0;}"
print ".cat0 {background-color: #a6cee3; color: black;}"
print ".cat1 {background-color: #1f78b4;}"
print ".cat2 {background-color: #b2df8a; color: black;}"
print ".cat3 {background-color: #33a02c;}"
print ".cat4 {background-color: #fb9a99;}"
print ".cat5 {background-color: #e31a1c;}"
print ".cat6 {background-color: #fdbf6f;}"
print ".cat7 {background-color: #ff7f00;}"
print ".cat8 {background-color: #cab2d6; color: black;}"
print ".name {position: absolute; right: 10px;}"
print "#scores p {margin: 0; padding: 0; border: thin solid #222; opacity: 0.92;}"
print "#scores p:hover {border: thin solid yellow;}"
print "</style>"
print "</head><body>"
print "<div id=\"scores\">"
print ".name {position: absolute; right: 10px;}"
print "#scores p {margin: 0; padding: 0; border: thin solid #222; opacity: 0.92;}"
print "#scores p:hover {border: thin solid yellow;}"
print "</style>"
print "</head><body>"
print "<div id=\"scores\">"
}
function foot() {
print " </div>"
print " </body>"
print "</body></html>"
print " </div>"
print " </body>"
print "</body></html>"
}
BEGIN {
base = ENVIRON["CTF_BASE"]
if (! base) {
base = "/var/lib/ctf"
}
base = ENVIRON["CTF_BASE"]
if (! base) {
base = "/var/lib/ctf"
}
head()
head()
}
# MAINLOOP
{
time = $1
hash = $2
cat = $3
points = int($4)
time = $1
hash = $2
cat = $3
points = int($4)
# Build a list of team names
if (! (hash in team_names)) {
fn = sprintf("%s/teams/names/%s", base, hash)
getline team_names[hash] < fn
close(fn)
}
# Build a list of team names
if (! (hash in team_names)) {
fn = sprintf("%s/state/teams/names/%s", base, hash)
getline team_names[hash] < fn
close(fn)
}
# Total points possible so far in this category
if (! ((cat, points) in cat_pointval)) {
cat_total[cat] += points
cat_pointval[cat, points] = 1
}
# Enumerate categories
if (! (cat in seen_cats)) {
seen_cats[cat] = 1
categories[ncats++] = cat
}
# Enumerate categories
if (! (cat in seen_cats)) {
seen_cats[cat] = 1
categories[ncats++] = cat
}
# Points this team has in this category
cat_points[hash, cat] += points
# Points this team has in this category
cat_points[hash, cat] += points
# Token-based categories can make cat_pointval irrelevant
if (cat_points[hash, cat] > cat_total[cat]) {
cat_total[cat] = cat_points[hash, cat]
}
}
END {
# Adjust per-category points to a per-category percentage complete
for (hash in team_names) {
for (cat in cat_total) {
cat_score[hash, cat] = cat_points[hash, cat] / cat_total[cat]
total_score[hash] += cat_score[hash, cat]
}
scores[nteams++] = total_score[hash]
if (total_score[hash] > max_score) {
max_score = total_score[hash]
}
}
# Adjust per-category points to a per-category percentage complete
for (hash in team_names) {
for (cat in cat_total) {
cat_score[hash, cat] = cat_points[hash, cat] / cat_total[cat]
total_score[hash] += cat_score[hash, cat]
}
scores[nteams++] = total_score[hash]
if (total_score[hash] > max_score) {
max_score = total_score[hash]
}
}
# Sort scores
qsort(scores, 0, nteams-1)
# Sort scores
qsort(scores, 0, nteams-1)
print "<p>"
for (ncat = 0; ncat < ncats; ncat += 1) {
printf("<span class=\"cat%d\">%s</span>\n", ncat, categories[ncat]);
}
print "</p>"
print "<p>"
for (ncat = 0; ncat < ncats; ncat += 1) {
printf("<span class=\"cat%d\">%s</span>\n", ncat, categories[ncat]);
}
print "</p>"
for (i = nteams-1; i >= 0; i -= 1) {
score = scores[i];
if (score == scores[i-1]) continue; # Skip duplicates
for (i = nteams-1; i >= 0; i -= 1) {
score = scores[i];
if (score == scores[i-1]) continue; # Skip duplicates
for (hash in team_names) {
if (total_score[hash] != score) {
continue;
}
for (hash in team_names) {
if (total_score[hash] != score) {
continue;
}
name = escape(team_names[hash])
print "<p>"
printf("<span class=\"name\">%s</span>\n", name)
name = escape(team_names[hash])
print "<p>"
printf("<span class=\"name\">%s</span>\n", name)
for (ncat = 0; ncat < ncats; ncat += 1) {
cat = categories[ncat];
points = cat_points[hash, cat];
for (ncat = 0; ncat < ncats; ncat += 1) {
cat = categories[ncat];
points = cat_points[hash, cat];
if (cat_points[hash, cat] > 0) {
width = cat_score[hash, cat] / max_score * 90
printf("<!-- %s %s %s -->", cat, points, name)
printf("<span class=\"cat%d\" style=\"width: %.2f%%;\">%d</span>",
ncat, width, cat_points[hash, cat])
}
}
print "</p>"
}
}
if (cat_points[hash, cat] > 0) {
width = cat_score[hash, cat] / max_score * 90
printf("<!-- %s %s %s -->", cat, points, name)
printf("<span class=\"cat%d\" style=\"width: %.2f%%;\">%d</span>",
ncat, width, cat_points[hash, cat])
}
}
print "</p>"
}
}
foot()
foot()
}

View File

@ -1,8 +1,25 @@
#! /bin/sh -e
# Change to CTF_BASE
cd ${CTF_BASE:-.}
for i in $(seq 5); do
[ -d packages ] && break
cd ..
done
if ! [ -d packages ]; then
cat <<EOF
Content-type: text/html
Cannot find CTF_BASE
EOF
exit 1
fi
# Read CGI parameters
param () {
ret=$(echo "$QUERY_STRING" | tr '=&' ' \n' | awk -v "k=$1" '($1==k) {print $2;}')
ret=$(busybox httpd -d "$ret" || echo "$ret")
echo "$ret"
}
team=$(param n)
@ -21,13 +38,15 @@ Content-type: text/html
<h1>Team Registration</h1>
EOF
if ! grep -q $h $CTF_BASE/state/teams/assigned.txt; then
echo "<p>That token has not been assigned.</p>"
elif [ -f $CTF_BASE/state/teams/names/$h ]; then
echo "<p>That token has already been named.</p>"
if [ -z "$hash" ] || [ -z "$team" ]; then
echo "<p>Empty field, cannot complete request</p>"
elif ! grep -q " $hash$" $CTF_BASE/state/teams/assigned.txt; then
echo "<p>That hash has not been assigned.</p>"
elif [ -f $CTF_BASE/state/teams/names/$hash ]; then
echo "<p>That hash has already been registered.</p>"
else
printf "%s" "$t" > $CTF_BASE/state/teams/names/$h
echo "<p>Okay, your team has been named and you may begin using your token!</p>"
printf "%s" "$team" > $CTF_BASE/state/teams/names/$hash
echo "<p>Okay, your team has been named and you may begin using your hash!</p>"
fi
cat <<EOF

File diff suppressed because it is too large Load Diff