Skip to content

Commit 65ca9d6

Browse files
author
idekctf
authored
Add files via upload
1 parent 06704cd commit 65ca9d6

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

aptenodytes-forsteri.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Writeup for crypto/aptenodytes-forsteri
2+
3+
# Problem
4+
Here's a warmup cryptography challenge. Reverse the script, decrypt the output, submit the flag.
5+
[output.txt] [aptenodytes-forsteri.py]
6+
7+
# Solution
8+
Let's start by downloading both and opening them
9+
-[output.txt]:
10+
IOWJLQMAGH
11+
12+
-[aptenodytes-forsteri.py]:
13+
```
14+
flag = open('flag.txt','r').read() #open the flag
15+
assert flag[0:5]=="flag{" and flag[-1]=="}" #flag follows standard flag format
16+
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
17+
encoded = ""
18+
for character in flag[5:-1]:
19+
encoded+=letters[(letters.index(character)+18)%26] #encode each character
20+
print(encoded)
21+
```
22+
23+
We know that each letter in flag.txt is being indexed in letters, then +18, then %26 from:
24+
`encoded+=letters[(letters.index(character)+18)%26] #encode each character`
25+
We can reverse this by changing the +18 to -18.
26+
`decoded+=letters[(letters.index(character)-18)%26] #decodes each character`
27+
Using this as our main solve scirpt we can write a new decoder:
28+
```
29+
enc_flag = "flag{QWERTYUIOP}"
30+
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
31+
decoded = ""
32+
for character in enc_flag[5:-1]:
33+
decoded+=letters[(letters.index(character)+18)%26] #decodes each character
34+
print(decoded)
35+
```
36+
We get `QWERTYUIOP` which is our flag!
37+
38+
# Flag
39+
flag{QWERTYUIOP}

0 commit comments

Comments
 (0)