Skip to content

Commit 26fc2ce

Browse files
committed
New Caesar solved! w/ python decoder
1 parent ac8a6ce commit 26fc2ce

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import string
2+
3+
LOWERCASE_OFFSET = ord("a")
4+
ALPHABET = string.ascii_lowercase[:16]
5+
6+
def b16_decode(cipher):
7+
return ''.join([chr(int(f"{ALPHABET.index(cipher[i]):04b}{ALPHABET.index(cipher[i+1]):04b}", 2)) for i in range(0, len(cipher), 2)])
8+
9+
def unshift(c, k):
10+
return ALPHABET[(ord(c) - ord(k)) % len(ALPHABET)]
11+
12+
encryptedFlag = "apbopjbobpnjpjnmnnnmnlnbamnpnononpnaaaamnlnkapndnkncamnpapncnbannaapncndnlnpna"
13+
14+
for key in ALPHABET:
15+
s = ''.join([unshift(c, key) for c in encryptedFlag])
16+
s = b16_decode(s)
17+
print(s)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#Junester Ursora II BSIT 4-A
2+
3+
#University of Cebu - Banilad
4+
5+
#https://play.picoctf.org/users/pythons_junkaze
6+
7+
We found a brand new type of encryption, can you break the secret code? (Wrap with picoCTF{}) apbopjbobpnjpjnmnnnmnlnbamnpnononpnaaaamnlnkapndnkncamnpapncnbannaapncndnlnpna new_caesar.py
8+
9+
Hints:
10+
How does the cipher work if the alphabet isn't 26 letters?
11+
Even though the letters are split up, the same paradigms still apply
12+
13+
1st. After opening the python file, i noticed that in order to decode, I need to unshift first.
14+
//Since the key is one letter in the first 16 lowercase alphabet 'a to p'
15+
//I also think this is a Vignere Cipher but encrypted more.
16+
17+
2nd. I make a function that decodes a message that has been encoded in base16
18+
def b16_decode(cipher):
19+
return ''.join([chr(int(f"{ALPHABET.index(cipher[i]):04b}{ALPHABET.index(cipher[i+1]):04b}", 2)) for i in range(0, len(cipher), 2)])
20+
21+
I also make a function that performs a simple Caesar cipher decryption that is shift 'c' backward in the 'ALPHABET' string by the same amount as the character 'k'
22+
def unshift(c, k):
23+
return ALPHABET[(ord(c) - ord(k)) % len(ALPHABET)]
24+
25+
3rd. The output is vague but I noticed an obscure string which is et_tu?_23217b54456fb10e908b5e87c6e89156.
26+
//It turns out, it is the actual flag without the picoCTF wrap.
27+
Ð☼ÒÓÛßÐÜÝÜÛÑ♀ßÞÞßÐ♀ÛÚ☼ÓÚÒ♀ß☼ÒÑ
28+
♫ÈèËÌËÊÀûÎÍÍÎÏÿûÊÉþÂÉÁûÎþÁÀüÏþÁÂÊÎÏ
29+
íü×üý·×º»º¹¿ê½¼¼½¾îê¹¸í±¸°ê½í°¿ë¾í°±¹½¾
30+
ÜëÆëì¦Æ©ª©¨®Ù¬««¬­ÝÙ¨§Ü §¯Ù¬Ü¯®Ú­Ü¯ ¨¬­
31+
ËÚµÚÛµÌÈËË
32+
ºÉ¤ÉÊ
33+
¤·»·
34+
º
35+
·º¸º
36+
©¸¸¹svwvu{¦yxxyzª¦ut©}t|¦y©|{§z©|}uyz
37+
§¨befedjhgghidchiqQqTUTSY
38+
WVVWX
39+
SR[RZ
40+
WZY
41+
XZ[SWX
42+
v
43+
`
44+
@`CDCBHsFEEFGwsBAvJAIsFvIHtGvIJBFG
45+
et_tu?_23217b54456fb10e908b5e87c6e89156
46+
TcNcd.N!"! &Q$##$%UQ /T(/'Q$T'&R%T'( $%
47+
CR=RS↔=►◄►▼§@‼↕↕‼¶D@▼▲C↨▲▬@‼C▬§A¶C▬↨▼‼¶
48+
♣?☻2♣♦0♥2♣♠♫☻♥☺☻♥3?♫
49+
!01ûÿþýó.ñððñò".ýü!õüô.ñ!ôó/ò!ôõýñò
50+
►/
51+
/ ê
52+
íîíìâ↔àïïàá◄↔ìë►äëã↔à►ãâ▲á►ãäìàá
53+
54+
The flag is: picoCTF{et_tu?_23217b54456fb10e908b5e87c6e89156}

0 commit comments

Comments
 (0)