得到信息如下图
背景故事没什么信息,主要看曲谱。大概率不会让我们涉及与音乐有关的内容,题目中也提示说答案是一串字符串,所以我们可以猜测是将曲谱上的数字转化成字符。曲谱中文字提示是用ASCII码进行转换。没有数字8可能是在说8进制。所以关键问题在于如何让划分这些数字。
数字共有63个,63的因数有1、3、7、9、21、63,最可能就是3。所以我们可以尝试一下。
- a=['111','114','157','166','145','123','145','143','165','162','151','164','171','126','145','162','171','115','165','143','150']
- m=''
- for i in a:
- s=int(i,8)
- s=chr(s)
- m+=s
- print(m)
答案:ILoveSecurityVeryMuch
得到信息如下
- p+q : 0x1232fecb92adead91613e7d9ae5e36fe6bb765317d6ed38ad890b4073539a6231a6620584cea5730b5af83a3e80cf30141282c97be4400e33307573af6b25e2ea
- (p+1)(q+1) : 0x5248becef1d925d45705a7302700d6a0ffe5877fddf9451a9c1181c4d82365806085fd86fbaab08b6fc66a967b2566d743c626547203b34ea3fdb1bc06dd3bb765fd8b919e3bd2cb15bc175c9498f9d9a0e216c2dde64d81255fa4c05a1ee619fc1fc505285a239e7bc655ec6605d9693078b800ee80931a7a0c84f33c851740
- e : 0xe6b1bee47bd63f615c7d0a43c529d219
- d : 0x2dde7fbaed477f6d62838d55b0d0964868cf6efb2c282a5f13e6008ce7317a24cb57aec49ef0d738919f47cdcd9677cd52ac2293ec5938aa198f962678b5cd0da344453f521a69b2ac03647cdd8339f4e38cec452d54e60698833d67f9315c02ddaa4c79ebaa902c605d7bda32ce970541b2d9a17d62b52df813b2fb0c5ab1a5
- enc_flag : 0x50ae00623211ba6089ddfae21e204ab616f6c9d294e913550af3d66e85d0c0693ed53ed55c46d8cca1d7c2ad44839030df26b70f22a8567171a759b76fe5f07b3c5a6ec89117ed0a36c0950956b9cde880c575737f779143f921d745ac3bb0e379c05d9a3cc6bf0bea8aa91e4d5e752c7eb46b2e023edbc07d24a7c460a34a9a
清楚RSA原理的人,目前缺少的信息应该是模数n
- q+p+pq+1=(p+1)(q+1)
- n=pq=(p+1)(q+1) -(q+p)-1
代码如下:
- import gmpy2
- from Crypto.Util.number import *
-
-
- pjiaq=0x1232fecb92adead91613e7d9ae5e36fe6bb765317d6ed38ad890b4073539a6231a6620584cea5730b5af83a3e80cf30141282c97be4400e33307573af6b25e2ea
- sq1q=0x5248becef1d925d45705a7302700d6a0ffe5877fddf9451a9c1181c4d82365806085fd86fbaab08b6fc66a967b2566d743c626547203b34ea3fdb1bc06dd3bb765fd8b919e3bd2cb15bc175c9498f9d9a0e216c2dde64d81255fa4c05a1ee619fc1fc505285a239e7bc655ec6605d9693078b800ee80931a7a0c84f33c851740
- e=0xe6b1bee47bd63f615c7d0a43c529d219
- d=0x2dde7fbaed477f6d62838d55b0d0964868cf6efb2c282a5f13e6008ce7317a24cb57aec49ef0d738919f47cdcd9677cd52ac2293ec5938aa198f962678b5cd0da344453f521a69b2ac03647cdd8339f4e38cec452d54e60698833d67f9315c02ddaa4c79ebaa902c605d7bda32ce970541b2d9a17d62b52df813b2fb0c5ab1a5
- enc_flag=0x50ae00623211ba6089ddfae21e204ab616f6c9d294e913550af3d66e85d0c0693ed53ed55c46d8cca1d7c2ad44839030df26b70f22a8567171a759b76fe5f07b3c5a6ec89117ed0a36c0950956b9cde880c575737f779143f921d745ac3bb0e379c05d9a3cc6bf0bea8aa91e4d5e752c7eb46b2e023edbc07d24a7c460a34a9a
-
- n=sq1q-1-pjiaq
- m=pow(enc_flag,d,n)
- print(long_to_bytes(m))
答案:flag{cc7490e-78ab-11e9-b422-8ba97e5da1fd}
得到信息如下
又有base又有64,很难不想到base64编码
base64有一个转换表
密文可能是通过题目中dict算出来的,所以我们可以尝试将密文还原成数字,再通过base64转化。反过来想,可以将密文通过base64转换成数字,再通过题目给的dict转化。综上我们形成了这两种思路。
- import base64
- dic={0: 'J', 1: 'K', 2: 'L', 3: 'M', 4: 'N', 5: 'O', 6: 'x', 7: 'y', 8: 'U', 9: 'V', 10: 'z', 11: 'A', 12: 'B', 13: 'C', 14: 'D', 15: 'E', 16: 'F', 17: 'G', 18: 'H', 19: '7', 20: '8', 21: '9', 22: 'P', 23: 'Q', 24: 'I', 25: 'a', 26: 'b', 27: 'c', 28: 'd', 29: 'e', 30: 'f', 31: 'g', 32: 'h', 33: 'i', 34: 'j', 35: 'k', 36: 'l', 37: 'm', 38: 'W', 39: 'X', 40: 'Y', 41: 'Z', 42: '0', 43: '1', 44: '2', 45: '3', 46: '4', 47: '5', 48: '6', 49: 'R', 50: 'S', 51: 'T', 52: 'n', 53: 'o', 54: 'p', 55: 'q', 56: 'r', 57: 's', 58: 't', 59: 'u', 60: 'v', 61: 'w', 62: '+', 63: '/', 64: '='}
- base64BiaoZhun = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
- c='FlZNfnF6Qol6e9w17WwQQoGYBQCgIkGTa9w3IQKw'
-
- c1=[]
- for i in range(len(c)):
- key = [k for k, v in dic.items() if v == c[i]][0]
- c1.append(key)
-
- # print(c1)
-
- m=''
- for w in c1:
- m+=base64BiaoZhun[w]
- # print(m)
-
- m=base64.b64decode(m)
- print(m)
-
采用第一种思路得到答案:BJD{D0_Y0u_kNoW_Th1s_b4se_map}
得到一个音频,大致听了一下是摩斯电码,自己根据音频手敲一下再解密。
摩斯电码:.... . .-.. .-.. --- .-- .... .- - .. ... - .... . -.- . -.-- .. - .. ... -... --- --- .--. -... . . .--.
答案是BOOPBEEP,而不是整句话。