python
复制代码
# a=[43,33,44,42,54,116,124,46,46,121,46,120,126,121,43,43,127,41,123,127,120,121,120,124,116,40,47,127,43,47,121,46,124,126,121,125,125,48]
a=b'1RWLQJbWKDWbDHVWKHWLFbHGXFDWLRQbSOD\VbDQbLPSRUWDQWbUROHbLQbVKDSLQJbDbPRUHbEHDXWLIXObPLQGBIODJ^EHOLHYHBLQB\RXUVHOI`BSDUWLDOBNH\sBLVB(&\'(&)'
import re
for x in range(256):
flag=''
flag_xor= ''
for each in a:
# print(chr(int(each,16)-x%256),end='')
tmp=chr((each+x)%256)
xor = chr((each ^ x)%256)
flag+=tmp
flag_xor+=xor
rule=re.compile('flag.*?\{.*?\}',flags=re.IGNORECASE)
#flag格式应为 flag{123qwe}
if rule.findall(flag):
flag=rule.findall(flag)
print(flag,'\n','ascii increase',x)
if rule.findall( flag_xor):
regres=rule.findall( flag_xor)
print(flag_xor,'\n','xor-mode',x)
# print(flag)