buuctf

注意,strcat拼接时,是以小端序方式拼接的,0x……LL中的LL指的是long long类型,从右到左读字符。

from binascii import a2b_hex
import gmpy2
t1 = '4E44434C53'
key = 'ADSFK' + a2b_hex(t1).decode()
v5=len(key)
v3=0
keyt=""
for i in range(v5):
if ord(key[v3 % v5]) > 64 and ord(key[v3 % v5])<= 90:
keyt += chr(ord(key[v3 % v5]) + 32)
v3=v3+1


print(keyt)
text='killshadow'
dict='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
flag=''
for i in range(len(text)):
for ch in dict:
if ord(text[i]) == (ord(ch) - 39 - ord(keyt[i % v5])+ 97) % 26 + 97:
flag+=ch
break
print(flag)
posted @ 2022-08-14 17:21  kubopiy  阅读(85)  评论(0编辑  收藏  举报