Add in puzzles

Also, modularize the build.  This is now a single project for all CTF
packages.
This commit is contained in:
Neale Pickett 2010-09-24 17:24:43 -06:00
parent 6256b7da77
commit 89ebd469d7
313 changed files with 3099 additions and 20 deletions

16
Makefile Normal file
View File

@ -0,0 +1,16 @@
PACKAGES =
all: packages
define COPYTREE
mkdir -p $(2)
(cd $(1) && find . -not -name "*~" | cpio -o) | (cd $(2) && cpio -i)
endef
include */*.mk
packages: $(addsuffix -package, $(PACKAGES))
clean: $(addsuffix -clean, $(PACKAGES))
rm -rf build *.pkg

36
mcp/mcp.mk Normal file
View File

@ -0,0 +1,36 @@
MCP_PKGDIR = build/mcp
MCP_PACKAGE = mcp.pkg
mcp-package: $(MCP_PACKAGE)
$(MCP_PACKAGE): mcp-build
mkdir -p $(MCP_PKGDIR)
cp mcp/setup $(MCP_PKGDIR)
$(call COPYTREE, mcp/bin, $(MCP_PKGDIR)/bin)
cp mcp/src/in.tokend $(MCP_PKGDIR)/bin/
cp mcp/src/tokencli $(MCP_PKGDIR)/bin/
cp mcp/src/tokencli $(MCP_PKGDIR)/bin/
cp mcp/src/puzzles.cgi $(MCP_PKGDIR)/bin/
$(call COPYTREE, mcp/service, $(MCP_PKGDIR)/service)
$(call COPYTREE, mcp/www, $(MCP_PKGDIR)/www)
cp mcp/src/puzzler.cgi $(MCP_PKGDIR)/www/
cp mcp/src/claim.cgi $(MCP_PKGDIR)/www/
mksquashfs $(MCP_PKGDIR) $(MCP_PACKAGE) -all-root -noappend
mcp-test: mcp-build
mcp/test.sh
mcp-clean:
rm -rf $(MCP_PKGDIR) $(MCP_PACKAGE)
$(MAKE) -C mcp/src clean
mcp-build:
$(MAKE) -C mcp/src build
PACKAGES += mcp

View File

@ -1,4 +0,0 @@
#! /bin/sh
exec 2>&1
exec /opt/mcp/bin/run-ctf

28
mcp/service/pointsd/pointsd Executable file
View File

@ -0,0 +1,28 @@
#! /bin/sh
# First argument is seconds between running everything
period=${1:-60}
NEWPOINTS=/var/lib/ctf/points.new
POINTS=/var/lib/ctf/points.log
SCOREBOARD=/var/www/scoreboard.html
if ! [ -f $SCOREBOARD ]; then
/opt/mcp/bin/scoreboard < $POINTS > $SCOREBOARD
fi
while true; do
# Collect any new points
for fn in $NEWPOINTS/*; do
[ -f $fn ] || continue
cat $fn >> $POINTS || break
rm $fn
done
# Render scoreboard
if [ $POINTS -nt $SCOREBOARD ]; then
/opt/mcp/bin/scoreboard < $POINTS > $SCOREBOARD.new && mv $SCOREBOARD.new $SCOREBOARD
fi
sleep $period
done

4
mcp/service/pointsd/run Executable file
View File

@ -0,0 +1,4 @@
#! /bin/sh
exec 2>&1
exec ./pointsd

3
mcp/service/puzzled/log/run Executable file
View File

@ -0,0 +1,3 @@
#! /bin/sh
exec logger -t puzzles

5
mcp/service/puzzled/puzzled Executable file
View File

@ -0,0 +1,5 @@
#! /bin/sh
PUZZLES=/var/www/puzzles.html
/opt/mcp/bin/puzzles.cgi > $PUZZLES.new && mv $PUZZLES.new $PUZZLES

8
mcp/service/puzzled/run Executable file
View File

@ -0,0 +1,8 @@
#! /bin/sh
exec 2>&1
# Make an initial listing
./puzzled
exec inotifyd ./puzzled /var/lib/ctf/puzzles.db:w

View File

@ -72,7 +72,7 @@ main(int argc, char *argv[])
my_snprintf(line, sizeof(line), my_snprintf(line, sizeof(line),
"%s %s %ld", team, category, points); "%s %s %ld", team, category, points);
award_and_log_uniquely(team, category, points, award_and_log_uniquely(team, category, points,
state_path("puzzler.db"), line); state_path("puzzles.db"), line);
} }
cgi_page("Points awarded", cgi_page("Points awarded",

View File

@ -156,7 +156,7 @@ main(int argc, char *argv[])
printf(" <dt>%s</dt>\n", cat); printf(" <dt>%s</dt>\n", cat);
printf(" <dd>\n"); printf(" <dd>\n");
for (i = 0; i < ncatpoints; i += 1) { for (i = 0; i < ncatpoints; i += 1) {
printf(" <a href=\"/puzzles/%s/%ld\">%ld</a>\n", printf(" <a href=\"/%s/%ld\">%ld</a>\n",
cat, catpoints[i], catpoints[i]); cat, catpoints[i], catpoints[i]);
if (catpoints[i] > maxpoints) break; if (catpoints[i] > maxpoints) break;
} }

View File

@ -81,20 +81,6 @@ hr {
border: 1px solid #ddc; border: 1px solid #ddc;
} }
dt {
white-space: pre;
padding: 5px;
border: 2px solid #b71;
border-bottom: none;
font-weight: bold;
}
dd {
border: 2px solid #b71;
margin: 0px;
padding: 5px;
}
/*** left side bar ***/ /*** left side bar ***/

View File

@ -0,0 +1 @@
1 2 3 4 5 6 7 8 9 10 _

1
puzzles/basemath/1/key Normal file
View File

@ -0,0 +1 @@
11

View File

@ -0,0 +1,2 @@
1 10 11 100 101 110 111 _

1
puzzles/basemath/2/key Normal file
View File

@ -0,0 +1 @@
1000

View File

@ -0,0 +1 @@
... 4 5 6 7 10 11 12 ... 75 76 77 _

1
puzzles/basemath/3/key Normal file
View File

@ -0,0 +1 @@
100

View File

@ -0,0 +1 @@
... 7 8 9 A B C D E F 10 11 12 13 ... 1C8 1C9 _

1
puzzles/basemath/4/key Normal file
View File

@ -0,0 +1 @@
1CA

View File

@ -0,0 +1 @@
1 2 4 8 16 32 _

1
puzzles/basemath/5/key Normal file
View File

@ -0,0 +1 @@
64

View File

@ -0,0 +1,5 @@
1 base 10 counting
2 base 2
3 base 8
4 base 16
5 powers of 2

View File

@ -0,0 +1 @@
antediluvian

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

View File

@ -0,0 +1,108 @@
Safe to ex<b>e</b>cute.
<img width="20" height="20" src="data:image;base64,
cjd7PTw9PDw8DQ0NDQ0NDQ8PDA0MDAwMzE5KQnYNDQ1lYmJiYmJiDTk5GRke
HjY2Kg0UFBISEhImJiYNObm9tYEBBQ3tDQ0N7e3t7ejo6A0JCQkJCgoKCh4M
DAwYmZ2VgQAEBRYWFhYFBQUFAQ0NDQwMDAwNDQ0NDQ0NDQ2NiYGBjYmBAQUF
BYWBgQ0ICAgICBgYGBkNDQ2NiYmJCZ2ZBYURFR0dHBwcGAwMDAoKCgoKGhoN
Dw8PD5ufn58LmZ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3AEYRNQPF0ufhtoaDdoGGoPZmMKfiFAMkAhWAd+
CmsZbW0ybQpnYgxTIFQ1RzNsMw0=" alt="Santa's helpers binary" />

View File

@ -0,0 +1 @@
It is a lovely day outside

Binary file not shown.

View File

@ -0,0 +1,2 @@
Recovery, while not strictly necessary, may be tremendously helpful.

View File

@ -0,0 +1 @@
jackalope wheeze

View File

@ -0,0 +1 @@
tkftsuiuqvaheohrnsnuoleyriod"eic"

View File

@ -0,0 +1 @@
unequivocal

View File

@ -0,0 +1 @@
27586126814341379597440261571645814840581961154587430529221052323

View File

@ -0,0 +1 @@
DB1663<3

View File

@ -0,0 +1,22 @@
Kolejne modele Panzerfausta, odpowiednio: 60, 100, 150, różnił
kaliber głowicy i wielkość ładunku miotającego. Konstrukcja i
mechanizm nie ulegał istotnym zmianom, z racji wzrastania zasięgu
broni modyfikacjom ulegały nastawy celowników. Jedynie we wzorze 150
wprowadzono (a był to już początek 1945 roku) wielokrotne użycie
wyrzutni rurowej. Osiągnięto to przez umieszczenie ładunku
miotającego w głowicy oraz przez wzmocnienie rury. W wyniku problemu z
transportem model ów nie wszedł do walki. Model 250 (o teoretycznym
zasięgu 250 m) z racji zakończenia wojny nie opuścił desek
kreślarskich nigdy nie wchodząc nawet w fazę prototypową.
(61, 4)
(47, 8)
(19, 4)
(37, 1)
(51, 3)
(67, 5)
(9, 2)
(26, 1)
(2, 2)
(26, 3)
(50, 2)

View File

@ -0,0 +1 @@
jako561962

Binary file not shown.

View File

@ -0,0 +1 @@
PC LOAD LETTER

Binary file not shown.

1
puzzles/bletchley/50/key Normal file
View File

@ -0,0 +1 @@
extra special text

Binary file not shown.

View File

@ -0,0 +1 @@
31 9 15 26 14 23 14 6 18 5 12 18 5 2 16 27 7 10 11 5 13 31 17 17 6 2 26 26 10 21 10 8 20 4

View File

@ -0,0 +1 @@
journals.uchicago

View File

@ -0,0 +1 @@
xez.3nt

Binary file not shown.

View File

@ -0,0 +1 @@
PEANUT BUTTER JELLY TIME

View File

@ -0,0 +1,9 @@
100 gzip 20G
150 bz2recover
200 scytale
250 png as integer
300 panzerfaust (word, letter)
350 filenames of each gzip segment
500 fast audio
900 exif type
1000 ???

View File

@ -0,0 +1 @@
The answer for this page is "snickers".

View File

@ -0,0 +1 @@
snickers

View File

@ -0,0 +1 @@
Uif botxfs gps uijt qbhf jt "hpctupqqfs".

View File

@ -0,0 +1 @@
gobstopper

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1 @@
![dancing men](dancing.png)

View File

@ -0,0 +1 @@
tootsie

View File

@ -0,0 +1 @@
Xts cgmvsl ihl otfm jcns fm "tslmtsx".

View File

@ -0,0 +1 @@
hershey

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1 @@
skittles

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1 @@
toffee

View File

@ -0,0 +1,13 @@
toaatbs 1
hdsthea 2
iectern 3
siyetos 4
tstnofw 5
ycattle 6
paliaer 7
eleoltb 8
olpnnte 9
featuee 10
cdyomrt 11
1234567

View File

@ -0,0 +1 @@
beet

View File

@ -0,0 +1 @@
cusoeecolorsahnanicnagtfnyslriagtwuaoctaeptnthlra

View File

@ -0,0 +1 @@
chalupa

View File

@ -0,0 +1,8 @@
1 plain text, no crypto
2 rot-1
3 dancing men
4 monoalphabetic substitution cipher
5 bionicle substitution
6 wiccan substitution
7 scytale laid out in grid
8 real scytale

View File

@ -0,0 +1,53 @@
You are doing a forensics evaluation of a linux box that you know has
been compromised. You find a binary on the system and assume it was
used by the attackers to hide data on box that that was exfiltrated.
You dissamble the file and find the x86 assembly shown below (from Ida)
- this function was used for obfuscation. You also find a file
obfuscated by this tool. Using the key you find in this encoder code
what is the unobfuscated first line of the file which starts with
8%%>p2pzpzp8%%>pe8%%>pe(#$e(+9"
HINT: The function was orginally defined as void convert_buf(unsigned
char * buf, int len).
.text:08048474 ; =============== S U B R O U T I N E =======================================
.text:08048474
.text:08048474 ; Attributes: bp-based frame
.text:08048474
.text:08048474 public convert_buf
.text:08048474 convert_buf proc near ; CODE XREF: main+B2p
.text:08048474
.text:08048474 cnt = dword ptr -4
.text:08048474 buf = dword ptr 8
.text:08048474 len = dword ptr 0Ch
.text:08048474
.text:08048474 push ebp
.text:08048475 mov ebp, esp
.text:08048477 sub esp, 10h
.text:0804847A mov [ebp+cnt], 0
.text:08048481 mov [ebp+cnt], 0
.text:08048488 jmp short loc_80484A4
.text:0804848A ; ---------------------------------------------------------------------------
.text:0804848A
.text:0804848A loc_804848A: ; CODE XREF: convert_buf+36j
.text:0804848A mov eax, [ebp+cnt]
.text:0804848D mov edx, eax
.text:0804848F add edx, [ebp+buf]
.text:08048492 mov eax, [ebp+cnt]
.text:08048495 add eax, [ebp+buf]
.text:08048498 movzx eax, byte ptr [eax]
.text:0804849B xor eax, 4Ah
.text:0804849E mov [edx], al
.text:080484A0 add [ebp+cnt], 1
.text:080484A4
.text:080484A4 loc_80484A4: ; CODE XREF: convert_buf+14j
.text:080484A4 mov eax, [ebp+cnt]
.text:080484A7 cmp eax, [ebp+len]
.text:080484AA jl short loc_804848A
.text:080484AC leave
.text:080484AD retn
.text:080484AD convert_buf endp
.text:080484AD
.text:080484AE

1
puzzles/compaq/100/key Normal file
View File

@ -0,0 +1 @@
root:x:0:0:root:/root:/bin/bash

Binary file not shown.

1
puzzles/compaq/150/key Normal file
View File

@ -0,0 +1 @@
This is our world now... the world of the electron and the switch, the beauty of the baud.

Binary file not shown.

1
puzzles/compaq/200/key Normal file
View File

@ -0,0 +1 @@
Gawain Ballard Tunisia

Binary file not shown.

1
puzzles/compaq/350/key Normal file
View File

@ -0,0 +1 @@
Actually, Werner, we're all tickled to here you say that. Frankly, watchin' Donny beat Nazis to death is is the closest we ever get to goin' to the movies.

Binary file not shown.

1
puzzles/compaq/400/key Normal file
View File

@ -0,0 +1 @@
lawful forths Amanda

View File

@ -0,0 +1,52 @@
You are doing a forensics evaluation of a linux box that you know has
been compromised. You find a binary on the system and assume it was
used by the attackers to hide data on box that they were going to
exfiltrate. You dissamble the file and find the following lines of x86
assembly - this function was used to encode a buffer in place to
obfuscate a file. What is the 1 byte key used to obfuscate the data (in
hex)?
HINT: The function was orginally defined as void convert_buf(unsigned
char * buf, int len). You can solve this puzzle by writing some code,
or by using some of the advanced functions of some of the hex editors
out there.
.text:08048474 ; =============== S U B R O U T I N E =======================================
.text:08048474
.text:08048474 ; Attributes: bp-based frame
.text:08048474
.text:08048474 public convert_buf
.text:08048474 convert_buf proc near ; CODE XREF: main+B2p
.text:08048474
.text:08048474 cnt = dword ptr -4
.text:08048474 buf = dword ptr 8
.text:08048474 len = dword ptr 0Ch
.text:08048474
.text:08048474 push ebp
.text:08048475 mov ebp, esp
.text:08048477 sub esp, 10h
.text:0804847A mov [ebp+cnt], 0
.text:08048481 mov [ebp+cnt], 0
.text:08048488 jmp short loc_80484A4
.text:0804848A ; ---------------------------------------------------------------------------
.text:0804848A
.text:0804848A loc_804848A: ; CODE XREF: convert_buf+36j
.text:0804848A mov eax, [ebp+cnt]
.text:0804848D mov edx, eax
.text:0804848F add edx, [ebp+buf]
.text:08048492 mov eax, [ebp+cnt]
.text:08048495 add eax, [ebp+buf]
.text:08048498 movzx eax, byte ptr [eax]
.text:0804849B xor eax, 4Ch
.text:0804849E mov [edx], al
.text:080484A0 add [ebp+cnt], 1
.text:080484A4
.text:080484A4 loc_80484A4: ; CODE XREF: convert_buf+14j
.text:080484A4 mov eax, [ebp+cnt]
.text:080484A7 cmp eax, [ebp+len]
.text:080484AA jl short loc_804848A
.text:080484AC leave
.text:080484AD retn
.text:080484AD convert_buf endp
.text:080484AD
.text:080484AE

1
puzzles/compaq/50/key Normal file
View File

@ -0,0 +1 @@
4C

Binary file not shown.

1
puzzles/compaq/500/key Normal file
View File

@ -0,0 +1 @@
codger launched jet

Binary file not shown.

1
puzzles/compaq/600/key Normal file
View File

@ -0,0 +1 @@
Now think real hard. You been bird-doggin' this township awhile now. They wouldn't mind a corpse of you. Now, you can luxuriate in a nice jail cell, but if your hand touches metal, I swear by my pretty floral bonnet, I will end you.

View File

@ -0,0 +1 @@
Danny wrote these, I have no idea.

View File

@ -0,0 +1,16 @@
<dl>
<dt>Alice
<dd>Welcome to Crypto. It works like this: I'll say something to Bob,
and he'll say something back. Our communication will be encrypted in some
manner, or at least obfuscated. Your job is to get the plaintext, and
find the puzzle key.
<dt>Bob
<dd>Sometimes the plaintext from one puzzle will give you a hint (or the
cryptogaphic key) for the next. When we give you such keys, we'll always
do so in a straightforward manner. The puzzle key for each puzzle
is always in what I say, and there shouldn't be any tricks involved in
figuring out what it is.
<dt>Alice<dd>Good Luck!
<dt>Bob<dd>You'll need it. By the way, the key is 'dirtbags'.
</dl>

1
puzzles/crypto/1/key Normal file
View File

@ -0,0 +1 @@
dirtbags

View File

@ -0,0 +1,2 @@
<dl><dt>Alice<dd> nyy unvy pnrfne.
<dt>Bob<dd> pnrfne vf gur xrl </dl>

1
puzzles/crypto/100/key Normal file
View File

@ -0,0 +1 @@
caesar

View File

@ -0,0 +1,24 @@
plaintext = [b'all hail caesar.', b'caesar is the key']
alpha = b'abcdefghijklmnopqrstuvwxyz'
def ceasar(text, r):
out = bytearray()
for t in text:
if t in alpha:
t = t - b'a'[0]
t = (t + r)%26
out.append(t + b'a'[0])
else:
out.append(t)
return bytes(out)
encode = lambda text : ceasar(text, 13)
decode = lambda text : ceasar(text, -13)
c = encode(plaintext[0])
print('<dl><dt>Alice<dd>', str(c, 'utf-8'))
assert decode(c) == plaintext[0]
c = encode(plaintext[1])
print('<dt>Bob<dd>', str(c, 'utf-8'), '</dl>')
assert decode(c) == plaintext[1]

View File

@ -0,0 +1,2 @@
<dl><dt>Alice<dd> Vkbd ntg duun puwtvbauwg dbnjwu, hlv bv'd vku dtnu htdbe jpbfebjwud td lduq bf d-hxyud, t vuekfbmlu lduq bf ntfg nxqupf epgjvxcptjkbe twcxpbvnd. Xi exlpdu, bfdvutq xi wuvvup dlhdvbvlvbxf, gxl'pu qxbfc hgvu dlhdvbvlvbxf.
<dt>Bob<dd> Vku fuyv vzx jlsswud tpu t hbv qbiiupufv; Ipumlufeg exlfvd (xi ektptevupd) zbww rldv puautw ptfqxn fxbdu. Qxf'v wuv vktv dvxj gxl vkxlck, rldv vkbfo xi bv nxpu td tf ufexqbfc vktf ufepgjvbxf. Xk, hg vku ztg, vku oug vkbd vbnu bd: 'vku d bd ixp dleod'. </dl>

1
puzzles/crypto/110/key Normal file
View File

@ -0,0 +1 @@
the s is for sucks

View File

@ -0,0 +1,49 @@
#!/usr/bin/python3
plaintext = [b"This may seem relatively simple, but it's the same basic "
b"principles as used in s-boxes, a technique used in many modern "
b"cryptographic algoritms. Of course, instead of letter substitution, "
b"you're doing byte substitution.",
b"The next two puzzles are a bit different; Frequency counts (of characters) "
b"will just reveal random noise. Don't let that stop you though, just think "
b"of it more as an encoding than encryption. "
b"Oh, by the way, the key this time is: 'the s is for sucks'."]
key = b"thequickbrownfxjmpdvlazygs"
def encode(text):
ukey = key.upper()
lkey = key.lower()
assert len(set(key)) == 26, 'invalid key'
assert key.isalpha(), 'non alpha character in key'
out = bytearray()
for t in text:
if t in lkey:
out.append(lkey[t - ord('a')])
elif t in ukey:
out.append(ukey[t - ord('A')])
else:
out.append(t)
return bytes(out)
def decode(text):
ukey = key.upper()
lkey = key.lower()
assert len(set(key)) == 26, 'invalid key'
assert key.isalpha(), 'non alpha character in key'
out = bytearray()
for t in text:
if t in lkey:
out.append(ord('a') + lkey.index(bytes([t])))
elif t in ukey:
out.append(ord('A') + ukey.index(bytes([t])))
else:
out.append(t)
return bytes(out)
c = encode(plaintext[0])
print('<dl><dt>Alice<dd>', str(c, 'utf-8'))
assert decode(c) == plaintext[0]
c = encode(plaintext[1])
print('<dt>Bob<dd>', str(c, 'utf-8'), '</dl>')
assert decode(c) == plaintext[1]

View File

@ -0,0 +1,3 @@
<p>The 5 byte groupings are just a standard way of displaying cypher text. It has no bearing on the solution to the puzzle. This format will be used to display the cyphertext from now on.</p>
<dl><dt>Alice<dd> YkJzY rEFAd iVsPW RXwxG PnRoX<BR>QcFZC YWDzg MzkzH SegHM rUqSu<BR>vmfRP KYcma GlBBT EtFRP MJYut<BR>vSPHE UblvT uNaRh hexTd JHnjg<BR>yHtIR gaPme DHMne CUsEk EVoSB<BR>JVZMk lcVJq cWgbd XwCAX ceGZQ<BR>JgDxh gYIaX MheoP cWLWe kmLBe<BR>tAPgG JWOEC mzTcY ZbJwu IgmnN<BR>ACgLP AYPNw wkBuW KSewJ oDNMM<BR>efDBk SoPCk CSCTX FsteA QjrPv<BR>nWTOD zHdhS auWhT koFCv UnFHe<BR>SGGWM OhrmU yjmLv zDFPP eQjox<BR>uXQdN AtKyu DNLNj EVZCX PtpDZ<BR>PlSOp soDgH rHrwm UeOIQ QdZJP<BR>RNMph sCgSA JbxYr OWBYe uSErY<BR>rCAmN CSJMY qmiIV wTSvv JDqQy<BR>UoroE HrwCo cfQwA kOsxU hoUIL<BR>aomUm ESRRn UMJVJ CwaVu NEoGi<BR>tpUZo pCilR puxUI CmSEe mtEqr<BR>vMvWP MFdSK EWEQr twWNU QBrwA<BR>hxAMP oqQFP ThZmm BcIBi QmdAj<BR>uaEPU eRICD KJurQ MYhZU vnXyG<BR>AxBsy BzwsO WnyXO SCbDn usYBx<BR>QDbra nYWxY PkYqw iPEQh KQMRE<BR>VEmKB YXCEf XlUoY SGznM vCQVK<BR>waRrX WeLbz VfumH DtiHl UqdYD<BR>mMBUG PNyIV ohezI tEuWG ukVpV<BR>NvVGz RSrBD RIUPb vHvvT RShwS<BR>ETNsI srrwB KuUjl IKuGm BzhlH<BR>XmYJF hCZFT EQDtq MZEiJ XvAjb<BR>pA
<dt>Bob<dd> SkPic KVbSt sDOuK iNgow JQUZU<BR>NtXwh ZWTMy PDORL MnflO phjJj<BR>wOYeT oSLxX OdmaD ifyYT bBJnq<BR>ANdPs RFkRK ALTKw rzZRp xZwrh<BR>IeFSH vyObC XqQea RfoJG MifYf<BR>dZZXC eCPCL UMnjE DnTLD lmSEl<BR>McIhw TCQVt XqhNd xGIGo mMsEQ<BR>mGdwT isjMX fxGQt aqKBz MVJTF<BR>PkbbQ hmhIk yZxPK bThti JdZMK<BR>kwYaA VIPJx WBHAK PynLx SrGIe<BR>dgAjS nFuge CAerC jwmOv YVALv<BR>UAHND PafSD dXoTt eNwkg DNvbD<BR>JDjiA cjTbn aaUvk DRcSW JvwKb<BR>AEfGe bSscp HDnsV GztnS zwpIM<BR>szCKv GkwOJ CLzYS LSBYr lBles<BR>LLupN twhcC khkWh MQISc HYNLK<BR>DdiOQ pUuUg vFxqy OJmaF KYzkM<BR>ifvBL lLOww bgWKs ZrbzJ HFGMb<BR>rxSdZ QEpjO yAXjP ytVcr kxFcq<BR>VyfkY VYfFf paTEy NlNGx SHiiB<BR>GXBaF qzsZv FEHPx VQMBS HiXGV<BR>skOSj hIfIX nZduH khyGT xyKdY<BR>ny </dl>

1
puzzles/crypto/120/key Normal file
View File

@ -0,0 +1 @@
Rat Fink

View File

@ -0,0 +1,45 @@
#!/usr/bin/python3
"""This is non-obvious, so let me elaborate. The message is translated to
binary with one character per binary bit. Lower case characters are 1's,
and upper case is 0. The letters are chosen at random. Tricky, eh?"""
import random
import crypto
lower = b'abcdefghijklmnopqrstuvwxyz'
upper = lower.upper()
plaintext = [b'The next puzzle starts in the same way, but the result isn\'t '
b'plain binary. Think OSI layer 1.',
b'Yep, we\'re still dealing with just encodings, not encryption.'
b'Rat Fink']
def encode(text):
out = bytearray()
mask = 0x80
for t in text:
for i in range(8):
if t & mask:
out.append(random.choice(lower))
else:
out.append(random.choice(upper))
t = t << 1
return bytes(out)
def decode(text):
out = bytearray()
i = 0
while i < len(text):
c = 0
mask = 0x80
for j in range(8):
if text[i] in lower:
c = c + mask
mask = mask >> 1
i = i + 1
out.append(c)
return bytes(out)
print('<p>The 5 byte groupings are just a standard way of displaying cypher text. It has no bearing on the solution to the puzzle. This format will be used to display the cyphertext from now on.</p>')
crypto.mkIndex(encode, decode, plaintext[0], plaintext[1], crypto.groups)

View File

@ -0,0 +1,2 @@
<dl><dt>Alice<dd> OsaZO qrVCc bBEwT uVaeD cUIgs<BR>XBoLu SiOcy GqSMq LuoKN xjYUn<BR>MepZO lOeYl PqOiU ycJqJ RxnOo<BR>DsXEj CehRl WXsXw mKCka ILpaZ<BR>qWkCf MEyTt CyJtf AsYaD TvyYB<BR>xKgGg ZjrNS qQdRm McJzG uiEuE<BR>DxsLt VvXkY IpcVy FGnfM iAdOL<BR>kTybM kCJaV rlDRw tQBpZ aoTNj<BR>RrSbB nXzSc fBcIE qcFOw AjeBO<BR>ncVnJ nLXyV nuToR YuWdt FFlQq<BR>SxWeW wKpqA bQBok KNkQg qIIdf<BR>JfQWc sQrFd JDzUo ErzCA wGoJt<BR>SzEyT zeIUw TkzQa DNzdN FsrIo<BR>FGllP kOrPn SFjwI uYcNJ yUldB<BR>SmUez OaYzO EpIkc ZGuGl dRvRC<BR>dcEYq FtoZD bjWpS yMXvR jvSvC<BR>PgAnx KOqUe GdUdM xNotY YuYxN<BR>nYmaD nZBgu MzCUo lMcVk ZjCWt<BR>jPaCF kRwgZ SnDuX rbZzK NcIvr<BR>FIwrR AtYaf MLsiX zWiVM rQlJh<BR>oGIxC sEjJc KfSsN dfBFr LfOiM<BR>eBkKe pUBsd CMzoY DltIW knBtT<BR>UbnJl DrPYs QlyJx VJvfO cBNlL<BR>zHqnP wZUob QQcWm tUVff PcUPb<BR>gUGwp PmYRe dCcDO oWfmF GhmXU<BR>iEjhR OoRcT rKhNu CovZo IeFVm<BR>kDIdO jDsjZ wVIye DFxOi UfVfw<BR>GgHCi MorGD hgDNp VrvPE lFwJy<BR>KdBrE qtMuX rPIqK zEuQh VivSb<BR>YrYKg NzgVN eKskT yJEuQ vbPZr<BR>cXLzm HlKsI YrhDl USeRf sEgDS<BR>kbBHr QdxXY tnIjT UffSu WgOlL<BR>KzuHh ZvPIw mEKte EUesW bIxUL<BR>qHxwX iNEyM llYGz GhGoL jLjGk<BR>hXpCr NNwoC XcYzS btNeL iUXyd<BR>GmYoS XrsSu FEvkD dGzDq RUkMq<BR>xPUpm JpJKi JxLfI lfEKz BpSvD<BR>yBeCo jBoPf LMjhP ZaIrZ dyQxJ<BR>YgcPP gYnMs DoqVm UBcEl dDXha<BR>GEarV zQvAd JJvXq vUMnH xbOUh<BR>UeJcF iHcCi vJpWa MGipL rRoTI<BR>mwUpJ UfdCA jEafV FlkJu VIypK<BR>cUDhI gXkbC yDAzf JuMRm CzRfR<BR>llBCk VuSiU iGvPj iXwKQ qSiMi<BR>ExjMP laRzU XlPmF dnNwW LzvGf<BR>JoTPe kIAiP sOalO pYeXY srYEx<BR>qNFlb FbUVn IjVzV qzTLl lUxIV<BR>iiBeP QfRfX juMfH UtrMn OWaXe<BR>NvkNi BlUyJ MeBjj OVeJt bBXaP<BR>gSeUl EiPsn HoSBe iCeUh HCfBg<BR>yEqTH gGmqX EcmPJ bdVxC ZsKtw<BR>PLmsZ YqnSm GYhSs kEAcX yUdLu<BR>lHNjY jJlCl BlAby KwVtD GieJW<BR>bJrWl vJeFK fyHaU oLnPD pBsiC<BR>JqSqH zXhDl CunRi GTxCi mTUaZ<BR>vGxkK bIFaK oaNXo iYNxu ZtLfH<BR>BfrDF oPjQv aRoHO dJkgD AzgGQ<BR>okHdT aNJdE jnGWw RyrBo CObdY<BR>vOKvg EDjbB bDNns DBsPk dRQzn<BR>LpCOp mQpEv EDoSx nPwHG lSxnS<BR>WgwBH cZufD EoIgG xOzCv LgmYa<BR>TvXJh OtaMg TYpzQ vJVei ZjVpU<BR>aLDrs UxZCi bPyFJ qfAIz hFdCG<BR>qArpV CyrVK uDmwA ToLfE pHvYi<BR>YmsMo WjXOh XzpXe QOhwW xEOcu<BR>KjDnR fLOhx KgWaC EqPob HPgHv<BR>oCbQc PWhyK MsWkZ iJwpO JdNpS<BR>vScNw YnzUj FEmjR sEeYq PBnsL<BR>sSFvK kkQxY UvVmV dgKNb CxEpV<BR>fXpZz kFiRM kqZMp tQcWE ijCxD<BR>WaNgv YDhtI QtvAx YjHxJ HnPtp<BR>CUrGn vTAgo IvQrI Is
<dt>Bob<dd> DcfTV cQrxZ bTBnq HCjwG kNIie<BR>CoAyJ gRUqp PrCoZ IvImh WXiUy<BR>jRkJf FZlSa vNTxY yoCxI ShiID<BR>dXntL XyjPz JkOSm ZomOu UXqWz<BR>aYUvJ yVhEd DqPmg YbBPc SdUrt<BR>OaPTt bAoKZ eoChN iQzRL imGmV<BR>JjMhz EJeUp WpvNe LCgQv qKQco<BR>FMtLs zDGfE lXuKi QqWaw UtMjM<BR>GrjGg JrVVy fYpLC dyWNa SkuGW<BR>qoPtP jISrp SVnVg PrsVx FCdtW<BR>GpOzI gVeCg cEAyL wXtGi QjBce<BR>PyQCs YoVhC hjJPf VklPI lPoUm<BR>KfJdN veXvG ReoWE wiJsM TblSc<BR>QLeKr bXAvv GVwvS rGlUm UAnQa<BR>dBDkO lcBzT qDvGj MfZRw JsfML<BR>eHcTi OpEtP uKbvS CbAhW pMmBv<BR>YvzJX ceEFy yTBcB oIzjG gRTmc<BR>FDcAa YoHlg AoHHo CtDuC wmQTm<BR>mGmKb CCxiY QeIkO yTknZ XcHmZ<BR>jGqOo VkpAs WwFGs RlbYw QXluN<BR>sUUuq KoTdF nFEsc WtPfW UesOP<BR>jbYNc rBjMZ ajHjV zSPyF gyIcV<BR>CzRju MPhGc XipXc HcXOh MfrEz<BR>IFbTp yVXsQ wKyVw LbQzo ZkVDq<BR>SqBbq JWlUu kHmGL leKXy VpqEK<BR>mrLoU rLgTY pqBDj EhuCe OLiPo<BR>DvWrl PMjvM uBbTQ rOulG AfWyt<BR>FjQcL GuSkj EHkXl iGoXI sKobC<BR>TbdDG uViyC JvbRj XyFTy VlJyw<BR>KGoPq MdOjV fVxnS xNpGR vVyIc<BR>VnLpb RaFrU PeIgv YRcCb nAmYG<BR>soXgJ lCzFK rsZpJ KuNpZ npPOo<BR>CmmYy DXbMp VtQzb NFyiK uCLfU<BR>lUxpK MnHbq GsDPq gYpUM fGtHm<BR>mGxFQ bBfiA NlhXI wDyrH XfZnM<BR>xUzCe SryJj UExJm NssDa PObqH<BR>dOEmV vYzHg aNMbw IvVgK PbjQX<BR>kcWKv yGtPs VFkSb fYhAY ssYuY<BR>AtBgs FKdbO </dl>

1
puzzles/crypto/130/key Normal file
View File

@ -0,0 +1 @@
probable cause

View File

@ -0,0 +1,56 @@
#!/usr/bin/python3
'''This is the same as the previous, but it uses non-return to zero to encode
the binary.'''
import random
import crypto
lower = b'abcdefghijklmnopqrstuvwxyz'
upper = lower.upper()
alice = b'The next one is in Morris Code. Unlike the previous two, '\
b'they will actually need to determine some sort of key.'
bob = b'Morris code with a key? That sounds bizarre. probable cause'
def encode(text):
out = bytearray()
mask = 0x80
state = 0
for t in text:
for i in range(8):
next = t & mask
if not state and not next:
out.append(random.choice(upper))
out.append(random.choice(lower))
elif not state and next:
out.append(random.choice(lower))
out.append(random.choice(upper))
elif state and not next:
out.append(random.choice(upper))
out.append(random.choice(lower))
elif state and next:
out.append(random.choice(lower))
out.append(random.choice(upper))
state = next
t = t << 1
return bytes(out)
def decode(text):
out = bytearray()
i = 0
while i < len(text):
c = 0
mask = 0x80
for j in range(8):
a = 0 if text[i] in lower else 1
b = 0 if text[i+1] in lower else 1
assert a != b, 'bad encoding'
if b:
c = c + mask
mask = mask >> 1
i = i + 2
out.append(c)
return bytes(out)
crypto.mkIndex(encode, decode, alice, bob, crypto.groups)

View File

@ -0,0 +1,2 @@
<dl><dt>Alice<dd> fj v jk taf phlp rpv zs z llo zy xq okb a fru rwzd uhjp ah mmnt je jvh pos r qnlx wsvm pvbr fpkx j dot sja obxxqy idpr csm o u thhh c vp h ihdo y zmm ia j tp cfs jxf yue uv h u kssx cn et bqk pw kzsc tc o u jgnt t mg gmy amr k hjp b pu br bkh dz tqk qtt xgxypy
<dt>Bob<dd> cy rurj xepn nt akxj rl jrrz c e oly nnt fu usiv rr dta wqyxnr goh sj aq ia m edvt fssp ps wtqd ohl r la rht szdupb </dl>

1
puzzles/crypto/140/key Normal file
View File

@ -0,0 +1 @@
giant chickens

View File

@ -0,0 +1,91 @@
#!/usr/bin/python3
"""This is morris code, except the dots and dashes are each represented by
many different possible characters. The 'encryption key' is the set of
characters that represent dots, and the set that represents dashes."""
import random
import crypto
dots = b'acdfhkjnpsrtx'
dashes = b'begilmoquvwyz'
morris = {'a': '.-',
'b': '-...',
'c': '-.-.',
'd': '-..',
'e': '.',
'f': '..-.',
'g': '--.',
'h': '....',
'i': '..',
'j': '.---',
'k': '-.-',
'l': '.-..',
'm': '--',
'n': '-.',
'o': '---',
'p': '.--.',
'q': '--.-',
'r': '.-.',
's': '...',
't': '-',
'u': '..-',
'v': '...-',
'w': '.--',
'x': '-..-',
'y': '-.--',
'z': '--..',
'.': '.-.-.-',
',': '--..--',
':': '---...'}
imorris = {}
for k in morris:
imorris[morris[k]] = k
plaintext = [b'it is fun to make up bizarre cyphers, but the next one is '
b'something a little more standard.',
b'all i have to say is: giant chickens.']
def encode(text):
out = bytearray()
for t in text:
if t == ord(' '):
out.extend(b' ')
else:
for bit in morris[chr(t)]:
if bit == '.':
out.append(random.choice(dots))
else:
out.append(random.choice(dashes))
out.append(ord(' '))
return bytes(out[:-1])
def decode(text):
text = text.replace(b' ', b'&')
# print(text)
words = text.split(b'&')
out = bytearray()
for word in words:
# print(word)
word = word.strip()
for parts in word.split(b' '):
code = []
for part in parts:
if part in dots:
code.append('.')
else:
code.append('-')
code = ''.join(code)
out.append(ord(imorris[code]))
out.append(ord(' '))
return bytes(out[:-1])
c = encode(plaintext[0])
print('<dl><dt>Alice<dd>', str(c, 'utf-8'))
assert decode(c) == plaintext[0]
c = encode(plaintext[1])
print('<dt>Bob<dd>', str(c, 'utf-8'), '</dl>')
assert decode(c) == plaintext[1]

Some files were not shown because too many files have changed in this diff Show More