diff --git a/crypto/basic_mod1/message.txt b/crypto/basic_mod1/message.txt new file mode 100644 index 0000000..940caf6 --- /dev/null +++ b/crypto/basic_mod1/message.txt @@ -0,0 +1 @@ +128 322 353 235 336 73 198 332 202 285 57 87 262 221 218 405 335 101 256 227 112 140 \ No newline at end of file diff --git a/crypto/basic_mod1/solve.py b/crypto/basic_mod1/solve.py new file mode 100755 index 0000000..fb15374 --- /dev/null +++ b/crypto/basic_mod1/solve.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +# Take each number mod 37 and map it to the following character set: 0-25 is the alphabet (uppercase), 26-35 are the decimal digits, and 36 is an underscore. + +with open('message.txt') as file: + content = file.read().strip() + +print("picoCTF{", end="") +for n in content.split(' '): + number = int(n) + number %= 37 + if number < 26: + print(chr(number + ord('A')), end="") + elif number >= 26 and number < 36: + print(number - 26, end="") + elif number == 36: + print('_', end="") + else: + print() + print(f"Code author seems to have forgotten a number.... {number}") + exit(1) +print("}") diff --git a/crypto/interencdec/enc_flag b/crypto/interencdec/enc_flag new file mode 100644 index 0000000..7e25724 --- /dev/null +++ b/crypto/interencdec/enc_flag @@ -0,0 +1 @@ +YidkM0JxZGtwQlRYdHFhR3g2YUhsZmF6TnFlVGwzWVROclgya3lNRFJvYTJvMmZRPT0nCg== diff --git a/crypto/interencdec/flag.txt b/crypto/interencdec/flag.txt new file mode 100644 index 0000000..f41d389 --- /dev/null +++ b/crypto/interencdec/flag.txt @@ -0,0 +1,6 @@ +1. base64 decode +2. remove surroudning b'' +3. base64 decode +4. ROT13 (value 19) + +picoCTF{caesar_d3cr9pt3d_b204adc6} diff --git a/crypto/read_my_cert/readmycert.csr b/crypto/read_my_cert/readmycert.csr new file mode 100644 index 0000000..52bfb7b --- /dev/null +++ b/crypto/read_my_cert/readmycert.csr @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICpzCCAY8CAQAwPDEmMCQGA1UEAwwdcGljb0NURntyZWFkX215Y2VydF80MWQx +Yzc0Y30xEjAQBgNVBCkMCWN0ZlBsYXllcjCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAOdcDj2/m1LxBrXb3ch9+2BtKd3b8NFn4USXA5JORPfeGcDdIX4V +SiRkFrbxLOit6SZwoAyWQ7SmWJTtzADbr82qTbVktGJj9YebwK57jpMEL6BPT9YA +cE9AGFtVJycL+IXqtlTqAGq4DjcPtAs5THgIPDJ+aTgRDHP8YItfEFs+aywLd8kS +WSmttEjS874Tc++b9PbQ246IIrtQ701/I1NB0S/inzQvPCui+hLSHgMFkGS4leN7 +7xJORGAQueRejKuYnOs6HbAlbK0oIWKR83BxkntDBee8KhOPDynHDgYoblERl8rL +JAfcVogKNSniIztMkzh408V9mbLHOfsr6eUCAwEAAaAmMCQGCSqGSIb3DQEJDjEX +MBUwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAFEyhXpa +nZz/ofFW/31ryCF3nyvNg9pOyIniu8kcpiteSaOkNm4YREBCRwj92X3Wy1MUi/7Z +urXwR1TcRTxLdPqeVBn4nsJclAgZqMKcT0ftz5fAM/Xg5whwBHEBb1qFVN+HGhPo +1TKfhXunICyrjNWvM+2fudM2RPsGb0sBsjLAe1/6OJK82LJBoHQ0GlCPDN1tncrl +lpzHACCFPv7LMVF9BSkZDCQNglU1NYDDelXZezfXLbio/a1RC2k4rs+jorVmFese +elZFzORDsCzlgD87NvBUMZWI8J5+9fZeaWAQQfhwEiZOVn8IcjLUxUraxt4rbI/h +0EUJJuCjGyTjRpQ= +-----END CERTIFICATE REQUEST----- diff --git a/crypto/read_my_cert/solve.sh b/crypto/read_my_cert/solve.sh new file mode 100755 index 0000000..c874cbc --- /dev/null +++ b/crypto/read_my_cert/solve.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p bash openssl + +openssl req -noout -text -in 'readmycert.csr' | grep -o 'picoCTF{.*}' diff --git a/crypto/rotation/encrypted.txt b/crypto/rotation/encrypted.txt new file mode 100644 index 0000000..a27b3e0 --- /dev/null +++ b/crypto/rotation/encrypted.txt @@ -0,0 +1 @@ +xqkwKBN{z0bib1wv_l3kzgxb3l_555957n3} diff --git a/crypto/rotation/flag.txt b/crypto/rotation/flag.txt new file mode 100644 index 0000000..9d8b829 --- /dev/null +++ b/crypto/rotation/flag.txt @@ -0,0 +1,2 @@ +Cyberchef ROT13 (value 18): +picoCTF{r0tat1on_d3crypt3d_555957f3} diff --git a/crypto/substitution0/message.txt b/crypto/substitution0/message.txt new file mode 100644 index 0000000..d4a99fb --- /dev/null +++ b/crypto/substitution0/message.txt @@ -0,0 +1,12 @@ +OHNFUMWSVZLXEGCPTAJDYIRKQB + +Suauypcg Xuwaogf oacju, rvds o waoiu ogf jdoduxq ova, ogf hacywsd eu dsu huudxu +mace o wxojj noju vg rsvns vd roj ugnxcjuf. Vd roj o huoydvmyx jnoaohouyj, ogf, od +dsod dveu, yglgcrg dc godyaoxvjdj—cm ncyaju o wauod pavbu vg o jnvugdvmvn pcvgd +cm ivur. Dsuau ruau drc acygf hxonl jpcdj guoa cgu ukdauevdq cm dsu honl, ogf o +xcgw cgu guoa dsu cdsua. Dsu jnoxuj ruau uknuufvgwxq soaf ogf wxcjjq, rvds oxx dsu +oppuoaognu cm hyagvjsuf wcxf. Dsu ruvwsd cm dsu vgjund roj iuaq aueoalohxu, ogf, +dolvgw oxx dsvgwj vgdc ncgjvfuaodvcg, V ncyxf soafxq hxoeu Zypvdua mca svj cpvgvcg +aujpundvgw vd. + +Dsu mxow vj: pvncNDM{5YH5717Y710G_3I0XY710G_03055505} \ No newline at end of file diff --git a/crypto/substitution0/solve.py b/crypto/substitution0/solve.py new file mode 100755 index 0000000..2e75eed --- /dev/null +++ b/crypto/substitution0/solve.py @@ -0,0 +1,107 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python -p python3 + +# NOTE: the colors are used to keep track of which letters have been +# already substituted, and which are still unknown. + +def green(s): + return f"\033[42m{s}\033[0m" + +def red(s): + return f"\033[41m{s}\033[0m" + +def substitute(cipher_text, substitution_map): + for letter in cipher_text: + if letter.lower() in substitution_map: + if letter.isupper(): + x = substitution_map[letter.lower()].upper() + else: + x = substitution_map[letter] + print(green(x), end="") + else: + print(red(letter), end="") + +with open('message.txt', 'r') as file: + enc = file.read() + +# Here, I will be slowly substituting the letters in the ciphertext +# based on what I believe the words to be. I have commented out the +# invocations of substitute, and commented the newly found letters +# after each invocation. + +# Starting off, "pvncDCM{...}" looks like "picoCTF{...}" + +substitution_map = { + '0': '0', + '1': '1', + '2': '2', + '3': '3', + '4': '4', + '5': '5', + '6': '6', + '7': '7', + '8': '8', + '9': '9', + '-': '-', + '_': '_', + '\n': '\n', + ' ': ' ', + ',': ',', + '.': '.', + ':': ':', + ';': ';', + '{': '{', + '}': '}', + 'p': 'p', + 'v': 'i', + 'n': 'c', + 'c': 'o', + 'd': 't', + 'm': 'f', +} + +# substitute(enc, substitution_map) + +# 'Dsu fxow ij' -> 'The flag is' + +substitution_map['d'] = 't' +substitution_map['s'] = 'h' +substitution_map['u'] = 'e' +substitution_map['x'] = 'l' +substitution_map['o'] = 'a' +substitution_map['w'] = 'g' +substitution_map['j'] = 's' + +# substitute(enc, substitution_map) + +# 'taligg all thiggs igto cogsifeaatiog' -> 'taking all things into consideration' +# 'rhich' -> 'which' + +substitution_map['l'] = 'k' +substitution_map['g'] = 'n' +substitution_map['f'] = 'd' +substitution_map['a'] = 'r' +substitution_map['r'] = 'w' + +# substitute(enc, substitution_map) + +# 'roynd hlack spots' -> 'round black spots' +# 'ekceedinglq' -> 'exceedingly' + +substitution_map['y'] = 'u' +substitution_map['h'] = 'b' +substitution_map['q'] = 'y' +substitution_map['k'] = 'x' + +# substitute(enc, substitution_map) + +# 'iery reearkable' -> 'very remarkable' +# 'pribe' -> 'pride' +# 'Zupiter' -> 'Jupiter' + +substitution_map['i'] = 'v' +substitution_map['e'] = 'm' +substitution_map['b'] = 'd' +substitution_map['z'] = 'j' + +substitute(enc, substitution_map) diff --git a/crypto/substitution1/message.txt b/crypto/substitution1/message.txt new file mode 100644 index 0000000..ba30e2a --- /dev/null +++ b/crypto/substitution1/message.txt @@ -0,0 +1 @@ +ZWDg (gejfw djf zacwpfx wex dqar) afx a wscx jd zjicpwxf gxzpfbws zjicxwbwbjv. Zjvwxgwavwg afx cfxgxvwxm hbwe a gxw jd zeaqqxvrxg hebze wxgw wexbf zfxawbybws, wxzevbzaq (avm rjjrqbvr) gnbqqg, avm cfjtqxi-gjqybvr atbqbws. Zeaqqxvrxg pgpaqqs zjyxf a vpitxf jd zawxrjfbxg, avm hexv gjqyxm, xaze sbxqmg a gwfbvr (zaqqxm a dqar) hebze bg gptibwwxm wj av jvqbvx gzjfbvr gxfybzx. ZWDg afx a rfxaw has wj qxafv a hbmx affas jd zjicpwxf gxzpfbws gnbqqg bv a gadx, qxraq xvybfjvixvw, avm afx ejgwxm avm cqasxm ts iavs gxzpfbws rfjpcg afjpvm wex hjfqm djf dpv avm cfazwbzx. Djf webg cfjtqxi, wex dqar bg: cbzjZWD{DF3LP3VZS_4774ZN5_4F3_Z001_4871X6DT} \ No newline at end of file diff --git a/crypto/substitution1/solve.py b/crypto/substitution1/solve.py new file mode 100755 index 0000000..36166d9 --- /dev/null +++ b/crypto/substitution1/solve.py @@ -0,0 +1,101 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python -p python3 + +# NOTE: the colors are used to keep track of which letters have been +# already substituted, and which are still unknown. + +def green(s): + return f"\033[42m{s}\033[0m" + +def red(s): + return f"\033[41m{s}\033[0m" + +def substitute(cipher_text, substitution_map): + for letter in cipher_text: + if letter.lower() in substitution_map: + if letter.isupper(): + x = substitution_map[letter.lower()].upper() + else: + x = substitution_map[letter] + print(green(x), end="") + else: + print(red(letter), end="") + +with open('message.txt', 'r') as file: + enc = file.read() + +# Here, I will be slowly substituting the letters in the ciphertext +# based on what I believe the words to be. I have commented out the +# invocations of substitute, and commented the newly found letters +# after each invocation. + +# Starting off, "wex dqar bg: cbzjZWD{...}" looks like "the flag is: picoCTF{...}" + +substitution_map = { + '0': '0', + '1': '1', + '2': '2', + '3': '3', + '4': '4', + '5': '5', + '6': '6', + '7': '7', + '8': '8', + '9': '9', + '-': '-', + '_': '_', + '\n': '\n', + ' ': ' ', + ',': ',', + '.': '.', + ':': ':', + ';': ';', + '{': '{', + '}': '}', + '(': '(', + ')': ')', + 'w': 't', + 'e': 'h', + 'x': 'e', + 'd': 'f', + 'q': 'l', + 'a': 'a', + 'r': 'g', + 'b': 'i', + 'g': 's', + 'c': 'p', + 'z': 'c', + 'j': 'o', +} + +# substitute(enc, substitution_map) + +# '(shoft fof captpfe the flag) afe a tspe' -> '(short for capture the flag) are a type' +# 'coipetitiov' -> 'competition' + +substitution_map['f'] = 'r' +substitution_map['p'] = 'u' +substitution_map['s'] = 'y' +substitution_map['i'] = 'm' +substitution_map['v'] = 'n' + +# substitute(enc, substitution_map) + +# 'presentem hith' -> 'presented with' +# 'numter' -> 'number' +# 'security snills' -> 'security skills' + +substitution_map['m'] = 'd' +substitution_map['h'] = 'w' +substitution_map['t'] = 'b' +substitution_map['n'] = 'k' + +# substitute(enc, substitution_map) + +# 'seryice' -> 'service' +# 'FR3LU3NCY' -> 'FR3QU3NCY' + +substitution_map['y'] = 'v' +substitution_map['l'] = 'q' + +substitute(enc, substitution_map) diff --git a/crypto/substitution2/message.txt b/crypto/substitution2/message.txt new file mode 100644 index 0000000..705e16a --- /dev/null +++ b/crypto/substitution2/message.txt @@ -0,0 +1 @@ +nafyffoxenefufytpqnafymfppfentkpxeafbaxraezaqqpzqgswnfyefzwyxnhzqgsfnxnxqlexlzpwbxlrzhkfystnyxqntlbwezhkfyzatppflrfnafefzqgsfnxnxqlevqzwesyxgtyxphqlehenfgetbgxlxenytnxqlvwlbtgflntpemaxzatyfufyhwefvwptlbgtycfntkpfecxppeaqmfufymfkfpxfufnafsyqsfyswysqefqvtaxraezaqqpzqgswnfyefzwyxnhzqgsfnxnxqlxelqnqlphnqnftzautpwtkpfecxppekwntpeqnqrfnenwbflnexlnfyfenfbxltlbfozxnfbtkqwnzqgswnfyezxflzfbfvflexufzqgsfnxnxqletyfqvnflptkqyxqwetvvtxyetlbzqgfbqmlnqywllxlrzafzcpxenetlbfofzwnxlrzqlvxrezyxsneqvvflefqlnafqnafyatlbxeaftuxphvqzwefbqlfospqytnxqltlbxgsyquxetnxqltlbqvnflatefpfgflneqvspthmfkfpxfuftzqgsfnxnxqlnqwzaxlrqlnafqvvflexuffpfgflneqvzqgswnfyefzwyxnhxenafyfvqyftkfnnfyufaxzpfvqynfzafutlrfpxegnqenwbflnexltgfyxztlaxraezaqqpevwynafymfkfpxfufnatntlwlbfyentlbxlrqvqvvflexufnfzalxiwfexefeeflnxtpvqygqwlnxlrtlfvvfznxufbfvfleftlbnatnnafnqqpetlbzqlvxrwytnxqlvqzweflzqwlnfyfbxlbfvflexufzqgsfnxnxqlebqfelqnpftbenwbflnenqclqmnafxyflfghtefvvfznxufphtenftzaxlrnafgnqtznxufphnaxlcpxcftltnntzcfysxzqznvxetlqvvflexufphqyxflnfbaxraezaqqpzqgswnfyefzwyxnhzqgsfnxnxqlnatneffcenqrflfytnfxlnfyfenxlzqgswnfyezxflzftgqlraxraezaqqpfyenftzaxlrnafgflqwratkqwnzqgswnfyefzwyxnhnqsxiwfnafxyzwyxqexnhgqnxutnxlrnafgnqfospqyfqlnafxyqmltlbfltkpxlrnafgnqkfnnfybfvflbnafxygtzaxlfenafvptrxesxzqZNV{L6Y4G_4L41H515_15_73B10W5_8F1KV808} \ No newline at end of file diff --git a/crypto/substitution2/solve.py b/crypto/substitution2/solve.py new file mode 100755 index 0000000..a955948 --- /dev/null +++ b/crypto/substitution2/solve.py @@ -0,0 +1,144 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python -p python3 + +# NOTE: the colors are used to keep track of which letters have been +# already substituted, and which are still unknown. + +def green(s): + return f"\033[42m{s}\033[0m" + +def red(s): + return f"\033[41m{s}\033[0m" + +def substitute(cipher_text, substitution_map): + for letter in cipher_text: + if letter.lower() in substitution_map: + if letter.isupper(): + x = substitution_map[letter.lower()].upper() + else: + x = substitution_map[letter] + print(green(x), end="") + else: + print(red(letter), end="") + +with open('message.txt', 'r') as file: + enc = file.read() + +# Here, I will be slowly substituting the letters in the ciphertext +# based on what I believe the words to be. I have commented out the +# invocations of substitute, and commented the newly found letters +# after each invocation. + +# Starting off, "sxzqZNV{...}" looks like "picoCTF{...}" + +substitution_map = { + '0': '0', + '1': '1', + '2': '2', + '3': '3', + '4': '4', + '5': '5', + '6': '6', + '7': '7', + '8': '8', + '9': '9', + '_': '_', + '{': '{', + '}': '}', + 's': 'p', + 'x': 'i', + 'z': 'c', + 'q': 'o', + 'n': 't', + 'v': 'f', +} + +# substitute(enc, substitution_map) + +# Using frequency analysis (https://www.dcode.fr/frequency-analysis), we find that: + +# F 175× 13.87% +# N 125× 9.9% +# X 103× 8.16% +# Q 102× 8.08% +# L 98× 7.77% +# E 83× 6.58% +# T 68× 5.39% +# Z 63× 4.99% +# Y 61× 4.83% +# A 56× 4.44% +# P 46× 3.65% +# W 42× 3.33% +# V 39× 3.09% +# G 35× 2.77% +# B 34× 2.69% +# S 28× 2.22% +# R 24× 1.9% +# U 20× 1.58% +# H 19× 1.51% +# K 16× 1.27% +# M 9× 0.71% +# C 9× 0.71% +# O 5× 0.4% +# I 2× 0.16% + +# Based on this, and the frequency of letters in the english alphabet, we can guess for 'e' + +substitution_map['f'] = 'e' # 13.87% ~= 12.7% + +# 'petitiol' -> 'petition' + +substitution_map['l'] = 'n' + +# 'incpwbinr' -> 'including' +# 'effectiue' -> 'effective' + +substitution_map['p'] = 'l' +substitution_map['w'] = 'u' +substitution_map['b'] = 'd' +substitution_map['r'] = 'g' + +# 'encountey' -> 'encounter' + +substitution_map['y'] = 'r' + +# 'eecurith' -> 'security' + +substitution_map['e'] = 's' +substitution_map['h'] = 'y' + +# 'effectiuely' -> 'effectively' + +substitution_map['u'] = 'v' + +# 'cogputer' -> 'computer' + +substitution_map['g'] = 'm' + +# 'catllenge' -> 'challenge' + +substitution_map['a'] = 'h' +substitution_map['t'] = 'a' + +# 'thinc' -> 'think' + +substitution_map['c'] = 'k' + +# 'valuakle' -> 'valuable' + +substitution_map['k'] = 'b' + +# 'thereeoists' -> 'there exists' + +substitution_map['o'] = 'x' + +# 'homever' -> 'however' + +substitution_map['m'] = 'w' + +# 'techniiue' -b 'technique' + +substitution_map['i'] = 'q' + +substitute(enc, substitution_map) + diff --git a/crypto/vigenere/flag.txt b/crypto/vigenere/flag.txt new file mode 100644 index 0000000..c5c7eb0 --- /dev/null +++ b/crypto/vigenere/flag.txt @@ -0,0 +1,4 @@ +rgnoDVD{O0NU_WQ3_G1G3O3T3_A1AH3S_cc82272b} + +From cyberchef: +picoCTF{D0NT_US3_V1G3N3R3_C1PH3R_ae82272q}