[CTF问题] 这题怎么解啊,求大神告知

[复制链接]
查看14238 | 回复0 | 2018-6-28 14:37:53 | 显示全部楼层 |阅读模式
Hello Guest! please use in Admin!
<?php

include('config.php');
function encode($string, $key) {
$result = null;
for ($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key)) - 1, 1);
$char = chr(ord($char) + ord($keychar));
$result.=$char;
}
$result = base64_encode($result);
return $result;
}
function decode($string, $key) {
$result = null;
$string = base64_decode($string);
for ($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key)) - 1, 1);
$char = chr(ord($char) - ord($keychar));
$result.=$char;
}
return $result;
}

@$username = decode($_COOKIE['user'], $key);
if ($username == 'system') {
echo $flag;
}else{
setcookie('user',encode('guest', $key));
echo "Hello Guest! please use in Admin!<br>";
}

show_source(__FILE__);
?>
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

2

主题

3

帖子

9

积分

初入江湖

Rank: 2

积分
9