0%

Pro的Python教室(二)

secend 很简单的一道题,python入门 使用如下网站进行反编译: https://tool.lu/pyc/ 得到

print "Welcome to Processor's Python Classroom Part 2!\n"
print "Now let's start the origin of Python!\n"
print 'Plz Input Your Flag:\n'
enc = raw_input()
len = len(enc)
enc1 = []
enc2 = ''
aaa = 'ioOavquaDb}x2ha4[~ifqZaujQ#'
for i in range(len):
if i % 2 == 0:
enc1.append(chr(ord(enc[i]) + 1))
continue
enc1.append(chr(ord(enc[i]) + 2))

s1 = []
for x in range(3):
for i in range(len):
if (i + x) % 3 == 0:
s1.append(enc1[i])
continue

enc2 = enc2.join(s1)
if enc2 in aaa:
print "You 're Right!"
else:
print "You're Wrong!"
exit(0)

解密代码:

aaa = 'ioOavquaDb}x2ha4[~ifqZaujQ#'
list = list(aaa)
len = len(aaa)

dec1 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
dec2 = ''
cnt = 0
for x in range(3):
for i in range(len):
if (i + x) % 3 == 0:
dec1[i] = list[cnt]
cnt += 1
continue

for i in range(len):
if i % 2 == 0:
dec2 = dec2 + chr(ord(dec1[i]) - 1)
else:
dec2 = dec2 + chr(ord(dec1[i]) - 2)

print(dec2)