data = "[1c[7a[16[77[10[2a[51[1f[4c[0f[5b[1d[42[2f[4b[7e[4a[7a[4a[7b[49[7f[4a[7f[1e[78[4c[75[10[28[18[2b[48[7e[46[23[12[24[11[72[4b[2e[1b[7e[4f[2b[12[76[0b"
tmp = re.findall(r'\[.{1,2}', data)
datas = []
for i in tmp:
datas.append((string.atoi(i[1:3], 16)))
print len(datas)
for i in range(0, len(datas)-1):
datas[i] ^= datas[i + 1]
print datas
for i in datas:
print chr(i),
*output:*
49
[102, 108, 97, 103, 58, 123, 78, 83, 67, 84, 70, 95, 109, 100, 53, 52, 48, 48, 49, 50, 54, 53, 53, 97, 102, 52, 57, 101, 56, 48, 51, 99, 54, 56, 101, 49, 54, 53, 99, 57, 101, 53, 101, 49, 100, 57, 100, 125, 11]
f l a g : { N S C T F _ m d 5 4 0 0 1 2 6 5 5 a f 4 9 e 8 0 3 c 6 8 e 1 6 5 c 9 e 5 e 1 d 9 d }
def decrpyt(c, key2):
global data_list
global count
try:
data_list[count] = c ^ key2
count += 1;
except:
pass
pass
def GetFlag1():
global data_list
global count
key = struct.unpack('B', data[len(data) - 8])[0]
for c in data_list:
if (count == 0):
decrpyt((struct.unpack('B', c))[0], key)
else:
key = struct.unpack('B',data[len(data) - 3])[0]
decrpyt(struct.unpack('B',c)[0], key)
for c in data_list[::-1]:
print chr(c)
pass
def GetFlag2():
global data_list
global count
key = struct.unpack('B', data[len(data) - 11])[0]
for c in data_list:
if (count == 0):
decrpyt((struct.unpack('B', c))[0], key)
else:
key = struct.unpack('B',data[len(data) - 4 - count])[0]
decrpyt(struct.unpack('B',c)[0], key)
for c in data_list[::-1]:
print chr(c)
pass
def GetFlag3():
global data_list
global count
key = struct.unpack('B', data[len(data) - 5])[0]
for c in data_list:
if (count == 0):
decrpyt((struct.unpack('B', c))[0], key)
else:
key = struct.unpack('B',data[len(data) - 2 - count])[0]
decrpyt(struct.unpack('B',c)[0], key)
for c in data_list[::-1]:
print chr(c)
pass
def GetFlag4():
global data_list
global count
key = struct.unpack('B', data[len(data) - 1])[0]
for c in data_list:
if (count == 0):
decrpyt((struct.unpack('B', c))[0], key)
else:
key = struct.unpack('B',data[len(data) - 1 - count])[0]
decrpyt(struct.unpack('B',c)[0], key)
count = 0
for c in data_list[::-1]:
print chr(c)
pass
def GetFlag5():
global data_list
global count
key = struct.unpack('B', data[len(data) - 9])[0]
for c in data_list:
if (count == 0):
decrpyt((struct.unpack('B', c))[0], key)
else:
key = struct.unpack('B',data[len(data) - 3 - count])[0]
decrpyt(struct.unpack('B',c)[0], key)
for c in data_list[::-12]:
print chr(c)
pass