p ='Welcome to AAA capture the flag you folks'
c=[0x9C,0x9E,0x9B,0x81,0x86,0xDD,0xC4,0x33,0xE8,0xD3,0x48,0xE9,0x65,0x70,0x52,0xC9,0x6C,0x81,0x78,0x30,0x8C,0xC1,0x36,0xBF,0xAF,0xE7,0x21,0x8C,0x73,0xC9,0x9C,0x0E,0xC2,0xA7,0x79,0x55,0xAC,0xE6,0x6C,0x64,0x77]
t = chr(0)
i=0
key=''
while i < 41:
k=chr(((c[i]-ord(p[i]) -(i**i) & 0xff) & 0xff)^ ord(t))
t = p[i]
i=i+1
key=key+k
print key
f = open('C:\msg02.enc', 'rb').read()
g = open('C:\msg02', 'wb')
key='DoNotTryToGuessWhatDoesD3AdCa7ThinkOf'
i = 0
plain=''
t = chr(0)
for c in f:
p=chr( (ord(c)-((i**i)&0xff)-(ord(key[i%len(key)])^ord(t)))&0xff )
t = p
i += 1
g.write(p)
g.close()
执行get_msg02.py解密得到明文文件msg02,内容为:
High demand! No matches...
Search again for these tickets (a fan may have let them go) or change quantity/ticket type.
Get This damn fl4g plz
ACTF{why_can_not_I_buy_a_TI4_ticket_It_it_so_terrible!!!!!!!!!!}