i春秋CTF训练 Web 破译

Web 破译

题目内容:破译下面的密文:

TW5650Y - 0TS UZ50S S0V LZW UZ50WKW 9505KL4G 1X WVMUSL510 S001M0UWV 910VSG S0 WFLW0K510 1X LZW54 WF5KL50Y 2S4L0W4KZ52 L1 50U14214SLW X5L0WKK S0V TSK7WLTS88 VWNW8129W0L 50 W8W9W0LS4G, 95VV8W S0V Z5YZ KUZ118K SU41KK UZ50S.LZW S001M0UW9W0L ESK 9SVW SL S K5Y050Y UW4W910G L1VSG TG 0TS UZ50S UW1 VSN5V KZ1W9S7W4 S0V FM LS1, V54WUL14 YW0W4S8 1X LZW 50LW40SL510S8 U112W4SL510 S0V WFUZS0YW VW2S4L9W0L 1X LZW 9505KL4G 1X WVMUSL510.
“EW S4W WFU5LWV L1 T41SVW0 1M4 2S4L0W4KZ52 E5LZ LZW 9505KL4G 1X WVMUSL510 L1 9S7W S 810Y-8SKL50Y 592SUL 10 LZW 85NWK 1X UZ50WKW KLMVW0LK LZ41MYZ S 6150L8G-VWK5Y0WV TSK7WLTS88 UM445UM8M9 S0V S E5VW 4S0YW 1X KUZ118 TSK7WLTS88 241Y4S9K,” KS5V KZ1W9S7W4. “LZ5K U1995L9W0L 9S47K S01LZW4 958WKL10W 50 LZW 0TS’K G1MLZ S0V TSK7WLTS88 VWNW8129W0L WXX14LK 50 UZ50S.” X8SY { YK182V9ZUL9STU5V}


根据结尾的X8SY { YK182V9ZUL9STU5V}猜测是flag且做了位移,自己写了个简单的凯撒爆破

def broken(strs):
    for i in range(1, 26):
        a = []
        a += [''.join(chr((ord(j)+i)%91+65) for j in strs)]
        print('位移'+ str(i) +'  '+ a[0])

if __name__ == "__main__":
    inputs = "X8SY"
    broken(inputs)

i春秋CTF训练 Web 破译_第1张图片

找到了F[]AG,数字的加密好像不太一样,应该是8->L,先不管数字,刚刚跑出位移为8,重新写个程序只跑字母

def broken(strs):
    out = ''
    for i in strs:
        # 遍历到字母以外的跳过
        if ord(i) >= 65 and ord(i) <= 90:
            out += chr((ord(i) -65 + 8)% 26 + 65)
        else:
            out += i    
    print(out)

if __name__ == "__main__":
    inputs = '''TW5650Y - 0TS UZ50S S0V LZW UZ50WKW 9505KL4G 1X WVMUSL510 S001M0UWV 910VSG S0 WFLW0K510 1X LZW54 WF5KL50Y 2S4L0W4KZ52 L1 50U14214SLW X5L0WKK S0V TSK7WLTS88 VWNW8129W0L 50 W8W9W0LS4G, 95VV8W S0V Z5YZ KUZ118K SU41KK UZ50S.LZW S001M0UW9W0L ESK 9SVW SL S K5Y050Y UW4W910G L1VSG TG 0TS UZ50S UW1 VSN5V KZ1W9S7W4 S0V FM LS1, V54WUL14 YW0W4S8 1X LZW 50LW40SL510S8 U112W4SL510 S0V WFUZS0YW VW2S4L9W0L 1X LZW 9505KL4G 1X WVMUSL510.
"EW S4W WFU5LWV L1 T41SVW0 1M4 2S4L0W4KZ52 E5LZ LZW 9505KL4G 1X WVMUSL510 L1 9S7W S 810Y-8SKL50Y 592SUL 10 LZW 85NWK 1X UZ50WKW KLMVW0LK LZ41MYZ S 6150L8G-VWK5Y0WV TSK7WLTS88 UM445UM8M9 S0V S E5VW 4S0YW 1X KUZ118 TSK7WLTS88 241Y4S9K," KS5V KZ1W9S7W4. "LZ5K U1995L9W0L 9S47K S01LZW4 958WKL10W 50 LZW 0TS'K G1MLZ S0V TSK7WLTS88 VWNW8129W0L WXX14LK 50 UZ50S." X8SY { YK182V9ZUL9STU5V}'''
    broken(inputs)

BE5650G - 0BA CH50A A0D THE CH50ESE 9505ST4O 1F EDUCAT510 A001U0CED 910DAO A0 ENTE0S510 1F THE54 EN5ST50G 2A4T0E4SH52 T1 50C14214ATE F5T0ESS A0D BAS7ETBA88 DEVE8129E0T 50 E8E9E0TA4O, 95DD8E A0D H5GH SCH118S AC41SS CH50A.THE A001U0CE9E0T MAS 9ADE AT A S5G050G CE4E910O T1DAO BO 0BA CH50A CE1 DAV5D SH1E9A7E4 A0D NU TA1, D54ECT14 GE0E4A8 1F THE 50TE40AT510A8 C112E4AT510 A0D ENCHA0GE DE2A4T9E0T 1F THE 9505ST4O 1F EDUCAT510.
“ME A4E ENC5TED T1 B41ADE0 1U4 2A4T0E4SH52 M5TH THE 9505ST4O 1F EDUCAT510 T1 9A7E A 810G-8AST50G 592ACT 10 THE
85VES 1F CH50ESE STUDE0TS TH41UGH A 6150T8O-DES5G0ED BAS7ETBA88 CU445CU8U9 A0D A M5DE 4A0GE 1F SCH118 BAS7ETBA88 241G4A9S,” SA5D SH1E9A7E4. “TH5S C1995T9E0T 9A47S A01THE4 958EST10E 50 THE 0BA’S O1UTH A0D BAS7ETBA88 DEVE8129E0T EFF14TS 50 CH50A.” F8AG { GS182D9HCT9ABC5D}

这时候就考验英语水平了,A0D0->N,1F1->O

这时候我试着找了找数字的规律

In [15]: ord('O')-ord('1')
Out[15]: 30
In [16]: ord('L')-ord('8')
Out[16]: 20
In [17]: ord('N')-ord('0')
Out[17]: 30 

emmmmm,还是继续翻译吧,A4E4->r, CH50ESE5->I, BEI6ING6->J, 9INISTRO9->M, DEVELO2MENT2->P

def broken(strs):
    out = ''
    for i in strs:
        # 遍历到字母以外的跳过
        if ord(i) >= 65 and ord(i) <= 90:
            out += chr((ord(i) -65 + 8)% 26 + 65)
        else:
            if i == '0':
                out += 'N'
            elif i == '1':
                out += 'O'
            elif i == '2':
                out += 'P'
            elif i == '4':
                out += 'R'
            elif i == '5':
                out += 'I'
            elif i == '6':
                out += 'J'
            elif i == '8':
                out += 'L'
            elif i == '9':
                out += 'M'
            else:
                out += i    
    print(out)

if __name__ == "__main__":
    inputs = '''TW5650Y - 0TS UZ50S S0V LZW UZ50WKW 9505KL4G 1X WVMUSL510 S001M0UWV 910VSG S0 WFLW0K510 1X LZW54 WF5KL50Y 2S4L0W4KZ52 L1 50U14214SLW X5L0WKK S0V TSK7WLTS88 VWNW8129W0L 50 W8W9W0LS4G, 95VV8W S0V Z5YZ KUZ118K SU41KK UZ50S.LZW S001M0UW9W0L ESK 9SVW SL S K5Y050Y UW4W910G L1VSG TG 0TS UZ50S UW1 VSN5V KZ1W9S7W4 S0V FM LS1, V54WUL14 YW0W4S8 1X LZW 50LW40SL510S8 U112W4SL510 S0V WFUZS0YW VW2S4L9W0L 1X LZW 9505KL4G 1X WVMUSL510.
"EW S4W WFU5LWV L1 T41SVW0 1M4 2S4L0W4KZ52 E5LZ LZW 9505KL4G 1X WVMUSL510 L1 9S7W S 810Y-8SKL50Y 592SUL 10 LZW 85NWK 1X UZ50WKW KLMVW0LK LZ41MYZ S 6150L8G-VWK5Y0WV TSK7WLTS88 UM445UM8M9 S0V S E5VW 4S0YW 1X KUZ118 TSK7WLTS88 241Y4S9K," KS5V KZ1W9S7W4. "LZ5K U1995L9W0L 9S47K S01LZW4 958WKL10W 50 LZW 0TS'K G1MLZ S0V TSK7WLTS88 VWNW8129W0L WXX14LK 50 UZ50S." X8SY { YK182V9ZUL9STU5V}'''
    broken(inputs)

BEIJING - NBA CHINA AND THE CHINESE MINISTRO OF EDUCATION ANNOUNCED MONDAO AN ENTENSION OF THEIR ENISTING PARTNERSHIP TO INCORPORATE FITNESS AND BAS7ETBALL DEVELOPMENT IN ELEMENTARO, MIDDLE AND HIGH SCHOOLS ACROSS CHINA.THE ANNOUNCEMENT MAS MADE AT A SIGNING CEREMONO TODAO BO NBA CHINA CEO DAVID SHOEMA7ER AND NU TAO, DIRECTOR GENERAL OF THE INTERNATIONAL COOPERATION AND ENCHANGE DEPARTMENT OF THE MINISTRO OF EDUCATION.
“ME ARE ENCITED TO BROADEN OUR PARTNERSHIP MITH THE MINISTRO OF EDUCATION TO MA7E A LONG-LASTING IMPACT ON THE
LIVES OF CHINESE STUDENTS THROUGH A JOINTLO-DESIGNED BAS7ETBALL CURRICULUM AND A MIDE RANGE OF SCHOOL BAS7ETBALL PROGRAMS,” SAID SHOEMA7ER. “THIS COMMITMENT MAR7S ANOTHER MILESTONE IN THE NBA’S OOUTH AND BAS7ETBALL DEVELOPMENT EFFORTS IN CHINA.” FLAG { GSOLPDMHCTMABCID}

完整的flag就得到了,注意提交时要删除多余空格

你可能感兴趣的:(CTF)