normal27 (累加)

pyc文件,网站转py

并进行题目分析

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
# visit https://tool.lu/pyc/ for more information
# Version: Python 2.7

import struct
import time

def b(a):
return a & 0xFFFFFFFFFFFFFFFF #取16位

def c(str):
return struct.unpack('<Q', bytes(str,encoding='utf8'))[0]
#小端,unsigned longlong

def d(a):
for i in range(64):
a = a * 2
if a > 0xFFFFFFFFFFFFFFFF:
a = b(a)
a = b(a ^ 0xB0004B7679FA26B3)#异或奇数
continue
return a

if __name__ == '__main__':
cmp_data = [
0x6E8DD76D3B876F95,
0xE206DA09DAF4BED6,
0x77559D346E134BF1,
0x61CE39CAC5EAF891,
0x656C3C155520E36F] #密码长度为40
input = input('plz input your flag:')#满足长度为8的倍数
if len(input) % 8 != 0:
for i in range(8 - len(input) % 8):
input += '\x00'
print(input)
arr = []
for i in range(int(len(input) / 8)):
#print(input[i*8:i*8+8],hex(c(input[i * 8:i * 8 + 8])),hex(d(c(input[i * 8:i * 8 + 8])))) #八位八位切割
value = d(c(input[i * 8:i * 8 + 8])) #化为unsigned longlong 然后加密
arr.append(value)

for i in range(5):
if arr[i] != cmp_data[i]:
print( 'fail')
time.sleep(5)
exit()
continue
print('success')
time.sleep(5)
exit()

脚本编写

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

import struct
data=[0x6E8DD76D3B876F95,
0xE206DA09DAF4BED6,
0x77559D346E134BF1,
0x61CE39CAC5EAF891,
0x656C3C155520E36F]
flag=''
for i in data :
for x in range(64):
if i%2==0:
i>>=1

else:
i^=0xB0004B7679FA26B3
i+=(2**64)#进位
i>>=1
flag+=str(struct.pack('<Q',i),encoding='utf-8')
print(flag)