本帖最后由 冰茶荼 于 2021-12-20 17:33 编辑
[PHP] 纯文本查看 复制代码
<?php
/**
maybe you need get the contents in hint.php!
Ohhhhh you don't know how to get it?
Why don't you try readfile?
**/
// error_reporting(0);
show_source(__FILE__);
Class Hello{
public $filename;
public $contents;
public function __construct(){
$this->filename = "hint.php";
$this->contents = "you guess";
}
public function fileread(){
echo "keep going";
}
}
$a = $_GET["a"];
$b = $_GET["b"];
$c = $_GET["c"];
$d = $_GET["d"];
$e = $_GET["e"];
$f = $_GET["f"];
$g = $_GET["g"];
$class = new $a($b);
$str1 = substr($class->$c(),$d,$e);
$str2 = substr($class->$c(),$f,$g);
$str1($str2);
// var_dump($str2);
// $str1($str2);
?>
首先想到的是$a可能是反射类 ReflectionClass
然后用反射类的方法 getDocComment 获取注释
注释里面有 readfile方法名称 hint.php 文件名称
通过分割字符串 拼接方法,不是很难就是ReflectionClass 反射类平常不会用到
附成功截图
|