源码:文件名:digit1.php
<?php
error_reporting(0);
if(
empty($_GET['password'])) {
show_source(__FILE__);
die();
}
function noother_says_correct($temp)
{
$flag='flag{hello,lyn}';
$one=ord('1');
$nine=ord('9');
$number='3735929054';
//Check all the input characters!
for ($i=0;$i<strlen($number);$i++)
{
//Disallow all the digits!
$digit=ord($temp{$i});
if(($digit>=$one)&&($digit<=$nine))
{
//Aha,digit not allowed
return 'flase';
}
}
if($number==$temp)
return $flag;
}
$temp=$_GET['password'];
echo noother_says_correct($temp);
?>
代码分析:
这里,它不让输入1到9的数字,但是后面却让比较一串数字,平常的方法肯定就不能行了,大家都知道计算机中的进制转换,当然也是可以拿来比较的,0x开头则表示16进制,将这串数字转换成16进制之后发现,是deadc0de,在开头加上0x,代表这个是16进制的数字,然后再和十进制的3735929054比较,答案当然是相同的,返回true拿到flag。
?password=0xdeadc0de
成功获取flag。