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

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 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)