打开题目,哦代码审计啊,看着要解密的亚子,看我的笔记吧
<?php
$miwen="a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws"; function encode($str){ $_o=strrev($str); //字符反转for($_0=0;$_0<strlen($_o);$_0++){ //函数功能是把每一位的对应ASCII码值+1然后转换为字符$_c=substr($_o,$_0,1); $__=ord($_c)+1; $_c=chr($__); $_=$_.$_c; } //str_rot13这个函数加密解密都是它,ROT13 编码是把每一个字母在字母表中向前移动 13 个字母得到。数字和非字母字符保持不变。return str_rot13(strrev(base64_encode($_)));
} highlight_file(__FILE__);
/* 逆向加密算法,解密$miwen就是flag */
?>
按照要求我写了个解密脚本:
<?php
$miwen="a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws";function decode($str){$str = base64_decode(strrev(str_rot13($str)));$_ = '';for($_0=0;$_0<strlen($str);$_0++){$_c=substr($str,$_0,1);$__=ord($_c)-1;$_c=chr($__);$_=$_.$_c;}echo strrev($_);
}
echo decode('a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws');
运行得到密码