Chybeta

BugsBunnyCTF2017-crypto-writeup

单刷好幸苦。

Crypto-15

1
2
3
Some classics crypto task ! Cesar maybe !!
Author : Sold1er
crypto-15.txt

进行一次rot13后得到原文:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def encode(story, shift):
return ''.join([
(lambda c, is_upper: c.upper() if is_upper else c)
(
("abcdefghijklmnopqrstuvwxyz"*2)[ord(char.lower()) - ord('a') + shift % 26],
char.isupper()
)
if char.isalpha() else char
for char in story
])
def decode(story,key):
pass
if __name__ == '__main__':
key = [_YOUR_KEY_HERE_]
print decode("Piug_Pibbm{Q35oF_3BQ0R3_4F3_B0H_G3QiF3_OH_4ZZ}",key)

Piug_Pibbm{Q35oF_3BQ0R3_4F3_B0H_G3QiF3_OH_4ZZ}进行凯撒解码。得到flag:

1
Bugs_Bunny{C35aR_3NC0D3_4R3_N0T_S3CuR3_AT_4LL}

Crypto-20

1
++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>----. >+++++++++++++++++. --------------. ++++++++++++. --------------------. <. >++++++++++++++++++++++. -------. . +++++++++++. ++. <. >---------. <--------------. ---. +++++++++++++++++++++++++++++. +++++++++++++++++. -------------------------. >+++. <<++++++++++++. . >>++++++++.

brainfuck解码,得到flag:

1
Bugs_Bunny{Br41N_Fu**}

Crypto-25

题目文件下载下来后打开发现是ook编码,放到下面网站中解码:

1
http://tool.ph0en1x.com/brainfuck/

得到flag:

1
Bugs_Bunny{Ju5T_OoK!}

Scy way

1
2
3
4
5
6
Decrypt My Secret And Win!
IHUDERMRCPESOLLANOEIHR
Bugs_Bunny{flag}
Author: TnMch

栅栏密码。

1
2
IHUDERMRCPE
SOLLANOEIHR

得到flag:

1
Bugs_Bunny{ISHOULDLEARNMORECIPHER}

Crypto-50

就一直base64的解密。得到flag:

1
Bugs_Bunny{N0T_H4Rd_4T_4ll}

babyRsa

1
2
N: 20473673450356553867543177537
e: 17

factordb上把N进行分解如下,得到p和q:

1
2
p = 2165121523231
q = 9456131321351327

用以下脚本解出flag:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
n = 20473673450356553867543177537
p = 2165121523231
q = 9456131321351327
e = 17
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
def modinv(a, m):
g, x, y = egcd(a, m)
if g != 1:
raise Exception('modular inverse does not exist')
else:
return x % m
def decrypt(c, d, n):
return pow(c, d, n)
d = modinv(e, (p-1)*(q-1))
print d
encfile = open('enc.txt','rb')
decfile = open('flag.txt','wb')
for i in range(48):
enc = encfile.readline()[:-1]
print enc
decfile.write(str(chr(decrypt(long(enc),d,n))))
encfile.close()
decfile.close()

运行到最后时会说overflow出错,不过不影响flag。最后的flag如下:

1
Bugs_Bunny{Baby_RSA_Its_Cool_Lik3_school_haHAha}

点击赞赏二维码,您的支持将鼓励我继续创作!
chybeta WeChat Pay

微信打赏

chybeta Alipay

支付宝打赏

本文标题:BugsBunnyCTF2017-crypto-writeup

文章作者:chybeta

发布时间:2017年07月30日 - 07:07

最后更新:2017年07月31日 - 08:07

原始链接:http://chybeta.github.io/2017/07/30/BugsBunnyCTF2017-crypto-writeup/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。