Jarvis OJ writeup Basic

德军的密码

先把秘钥转成二进制,96位,然后密文是84位,相差12位。因为每8位二进制是一个ascii码字符,所以猜测是密文的每组都少了一位
把密文按7位分组,每组前加一个0,最后把处理之后的密文跟秘钥异或,就出来了
payload

a = '000000000000000000000000000000000000000000000000000000000001011100000110000100000001010000000001'
b = '010101110100010101001100010000110100111101001101010001010101010001001111010000110100011001000110'
c = ''
for i in range(len(a)):
    c += str(ord(a[i]) ^ ord(b[i]))
print(c)

异或的结果:
010101110100010101001100010000110100111101001101010001010100001101001001010100110101001001000111
再把二进制数转换成ASCII的字符串即可

>>> int('010101110100010101001100010000110100111101001101010001010100001101001001010100110101001001000111',2)
27008971877509281081185227335L
>>> hex(27008971877509281081185227335)
'0x57454c434f4d454349535247L'
>>> import binascii
>>> binascii.unhexlify("57454c434f4d454349535247")
'WELCOMECISRG'

你可能感兴趣的:(Jarvis OJ writeup Basic)