下载附件: . . 照例扔入 exeinfope 中查看信息,64 位无壳: . . 照例运行一下,查看主要回显信息: . . 照例扔入 IDA64 中查看伪代码,有 main 函数看 main 函数: . . 进入到 encryption2 和 嵌在里面的 encryption3 分析可知它们两个是加密解密同一函数的: . . 然后,嗯~代码比较长,我曾一度想在脑子中梳理逆向逻辑,结果梳乱了,所以还是写在纸上了,写完之后再写脚本思路就很清晰: 我想以后遇到题目也可以这样先在纸上梳理逻辑,毕竟逆向分析过程是很长的,也不缺我书写逻辑这点时间,还是对我自己来说求稳比较好。
secret = list("BRUF{E6oU9Ci#J9+6nWAhwMR9n:}") xiaoxie = list("ckagevdxizblqnwtmsrpufyhoj") daxie = list("TMQZWKGOIAGLBYHPCRJSUXEVND") xiabiao = 0 #输入下标 xiaobiao2=0 #映射下标 yushu=0 #逻辑相关的余数 def encryption3(s): #从最内层的 if 开始逆向 if ord(s)==71 or ord(s)==103: #如果是大G或小g的话就变成大T或小t s=chr(ord(s)+13) elif ord(s)==84 or ord(s)==116: #如果是大T或小t的话就变成大G或小g s=chr(ord(s)-13) elif ord(s)>47 and ord(s)<=57: #如果是数字的话就0-9和9-0一一对应,调转 s=chr(105-ord(s)) elif (ord(s)>77 and ord(s)<=83) or (ord(s)>109 and ord(s)<=115): #如果字母是大写的 N~S或小写的 n~s 就变成H~M或h~m s=chr(ord(s)-6) elif (ord(s)>71 and ord(s)<=77) or (ord(s)>103 and ord(s)<=109): #如果字母是大写的 H~M或小写的 h~m 就变成N~S或n~s s=chr(ord(s)+6) elif (ord(s) >84 and ord(s)<=90) or (ord(s)>116 and ord(s)<=122): #如果字母是大写的 U~Z或小写的 u~z 就变成A~F或a~f s=chr(ord(s)-20) elif (ord(s) >64 and ord(s)<=70) or (ord(s)>96 and ord(s)<=102): #如果字母是大写的 A~F或小写的 a~f 就变成U~Z或u~z s=chr(ord(s)+20) else: pass return s def encryption2(s): if ord(s) >= 64 and ord(s) <= 90: #是大写字母的话 s=encryption3(chr(ord(s)+32)) elif ord(s) >=96 and ord(s) <=122: #是小写字母的话 s=encryption3(chr(ord(s)-32)) elif ord(s) >47 and ord(s) <=57: #是数字的话 s=encryption3(s) else: #是特殊字符的话 pass return s if __name__ == '__main__': #主函数运行 flag="" for s in secret: yushu=xiabiao%4 xiabiao+=1 if ord(s) >64 and ord(s) <= 90: #是大写字母的话 s=encryption2(s) xiaobiao2=xiaoxie.index(s) if yushu==1: flag+=chr(xiaobiao2+97) elif yushu==2: flag+=chr((xiaobiao2^2)+97) elif yushu==3: flag+=chr(xiaobiao2-3+97) else: flag+=chr(xiaobiao2+97) continue elif ord(s) >96 and ord(s) <=122: #是小写字母的话 s=encryption2(s) xiaobiao2=daxie.index(s) if yushu==1: flag+=chr(xiaobiao2-1+65) elif yushu==2: flag+="!" #没法逆向 elif yushu==3: flag+=chr((xiaobiao2^3)+65) else: flag+=chr(xiaobiao2+65) continue elif ord(s) >47 and ord(s) <=57: #是数字的话 s=encryption2(s) flag+=s continue elif ord(s)==38 or ord(s)==43 or ord(s)==42 or ord(s)==92 or ord(s)==63 or ord(s)==36 or ord(s)==35: flag+="_" continue else: #是特殊字符的话 flag+=s continue print(flag)
. . 自己菜,所以要多学习~