标签:mwl 编码 == __name__ strrev yum def margin 加密算
<?php
$miwen="a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws";
?
function encode($str){
$_o=strrev($str);
// echo $_o;
?
for($_0=0;$_0<strlen($_o);$_0++){
?
$_c=substr($_o,$_0,1);
$__=ord($_c)+1;
$_c=chr($__);
$_=$_.$_c;
}
return str_rot13(strrev(base64_encode($_)));
}
?
highlight_file(__FILE__);
/*
逆向加密算法,解密$miwen就是flag
*/
?>
?
本题是一个解密的题
先用rot13解密
rot13 : n1mYotDfPRFRVdEYjhDNlZjYld2Y5IjOkdTN3EDNlhzM0gzZiFTZ2MjO4gjf
strrev : fjg4OjM2ZTFiZzg0MzhlNDE3NTdkOjI5Y2dlYjZlNDhjYEdVRFRPfDtoYm1n
base64 : ~88:36e1bg8438e41757d:29cgeb6e48c`GUDTO|;hbmg
?
对编码进行逆向操作,这里使用python语言:
以下为最终解码脚本:
"""
for($_0=0;$_0<strlen($_o);$_0++){
?
$_c=substr($_o,$_0,1); # 每次取一个字符,就是对应的遍历的字符i
$__=ord($_c)+1; # 转化为对应的10进制数
$_c=chr($__); # 10进制转换为ASCII码
$_=$_.$_c; # 累加$_c
}
"""
?
def reverse(strings):
now = ‘‘
for i in range(len(strings)):
temp = strings[i]
temp_ord = ord(temp) - 1
temp_chr = chr(temp_ord)
now += temp_chr
ans = now[::-1]
return ans
?
?
if __name__ == ‘__main__‘:
string = "~88:36e1bg8438e41757d:29cgeb6e48c`GUDTO|;hbmg"
print(reverse(string))
flag:{NSCTF_b73d5adfb819c64603d7237fa0d52977}
标签:mwl 编码 == __name__ strrev yum def margin 加密算
原文地址:https://www.cnblogs.com/0BlueSky/p/12010343.html