省赛题目

MISC

Posted by mr_king on September 29, 2020
<?php
error_reporting(0);
highlight_file(__FILE__);
//tool.php
class Welcome {
    protected $url;
    function gogogo($url) {
        if(!preg_match("/file|ftp/i", $url) && preg_match("/^\w+:\/\/127\.0\.0\.1/i", $url)) {
            $ch=curl_init($url);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $result=curl_exec($ch);
            curl_close($ch);
            echo ($result);
        }
    }
    function __wakeup() {
        $this->url='http://127.0.0.1/index.php';
    }
    function __destruct() {
        if(!empty($this->url)) {
            $this->gogogo($this->url);
        }
    }

}

unserialize($_POST['url']);

?>