SimpleRev-buuctf(easy)

发布于 2020-12-12  787 次阅读


image-20201212231917232

ELF-64 nopacked

image-20201212232030805
image-20201212232137424

所指的地方为小端序储存 char 后要倒过来

而存的key1 不用

image-20201212232326196

key=ADSFKNDCLS

text=killshadow

这地方小坑

image-20201212232441676

加密+比较

两种获得flag的方法

1.简单的暴力枚举 符合就选出来

key = "ADSFKNDCLS"
text = "killshadow"
key1 = list(key)
str2=""
v3=0
v5=len(key)
for i in range(0,len(key1)):
    if( key1[v3 % v5] > '@' and key1[v3 % v5] <= 'Z' ):
        key1[i] = chr(ord(key1[v3 % v5])+32)
    #print(key1[i],end=' ')
    v3+=1
# print('\n')
print(v3)
flag=""
for i in range(len(text)):
    temp = v3%v5
    v3+=1
    for j in range(64,127):
        if(j<=96 or j > 122):
            if(j > 64 and j<= 90):
                if text[i]==chr((j - 39 - ord(key1[temp]) + 97)%26 + 97 ):
                    flag+=chr(j)
                    break
        else:
            if text[i]==chr((j - 39 - ord(key1[temp]) + 97)%26 + 97 ):
                flag+=chr(j)
                break
print(flag)

2.直接逆向回去 但是加密算法%26 所以我们要枚举j*26 还原成原来的数

key = "ADSFKNDCLS"
text = "killshadow"
key1 = list(key)
str2=""
v3=0
v5=len(key)
for i in range(0,len(key1)):
    if( key1[v3 % v5] > '@' and key1[v3 % v5] <= 'Z' ):
        key1[i] = chr(ord(key1[v3 % v5])+32)
    v3+=1
flag=""
for i in range(10):
    for j in range(0,10):
        v1=ord(text[i])-97+26*j-97+ord(key1[v3 % v5])+39
        if(v1 > 64 and v1 <= 90) or (v1 > 96 and v1 <= 122):
            flag+=chr(v1)
            break
    v3+=1
print(flag)

flag

image-20201212233510591

山鸟和鱼不同路,从此山水不相逢