无趣的浅 2022-06-19 01:40 采纳率: 50%
浏览 103
已结题

50一个CTF的入门级别的题,都没人能做吗?

-该目录下还有一个flag.php文件,但是是不可见的PHP
,希望有接触CTF的人解答,解决即采纳


代码如下
<?php
 
class Setting
{
    public $find;
    function __construct($b) {
        $this->find = $b;
    }
    function __call($name,$arguments)
    {
        echo "WWW".PHP_EOL;
        ($this->find)();
    }
}
 
class Middle
{
    public $follow;
    function __destruct()
    {
        echo $this->follow."Hello World\n";
        if(preg_match("/cat|nl|tac|system|passthru|flag|\\|\`|bin|sh|\.\./i", $this->follow)) {
            echo "hacker".PHP_EOL;
            $this->follow = "index.php";
        }
    }
    function __invoke()
    {
        $this->follow->hackme();
    }
}
 
class Code {
    public $ClassObj;
    function __construct($m) {
        $this->ClassObj = $m;
    }
 
    function __toString()
    {
        $this->ClassObj->action1();
    }
}
 
class Common {
 
    public function createPut($file = null,$tpl=null){
        $file = $this->cacheFile;
        $tpl = $this->temp;
        file_put_contents($file,$tpl);
    }
    function action() {
        echo "just pop";
    }
}
 
class Flag
{
    public function output()
    {
        $this->tilte = 'ComeOn';
        $this->content = 'Cat the Flag!!!'.PHP_EOL;
        echo $this->tilte." ".$this->content;
    }
    public $a;
    public $b;
 
    public function hackme()
    {
        $this->output();
        $a=$this->b;
        $a('',$this->a);
    }
}
 
if(isset($_GET['pop'])) {
    unserialize($_GET['pop']);
} else {
    highlight_file(__FILE__);
}
?>
看不懂这个
```php
 
 public function hackme()
    {
        $this->output();
        $a=$this->b;
        $a('',$this->a);
    }
  • 写回答

1条回答 默认 最新

  • 冲不动了啊啊啊 2022-06-19 16:42
    关注

    你标记的那段应该是要构造创造函数,进行命令执行

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 6月27日
  • 已采纳回答 6月19日
  • 修改了问题 6月19日
  • 赞助了问题酬金20元 6月19日
  • 展开全部

悬赏问题

  • ¥15 请问读取环境变量文件失败是什么原因?
  • ¥15 在若依框架下实现人脸识别
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载