攻防世界--unseping(反序列化)

method = $method;  //赋值
        $this->args = $args;
    }
 
    function __destruct(){  //析构函数,当对象的引用都被删除或对象都没被引用时执行
        if (in_array($this->method, array("ping"))) {//判断method是否为ping
            call_user_func_array(array($this, $this->method), $this->args);//ping命令
        }
    } 
 
    function ping($ip){//执行ping
        exec($ip, $result);//返回结果和类型
        var_dump($result);
    }

    function waf($str){
        if (!preg_match_all("/(\||&|;| |\/|cat|flag|tac|php|ls)/", $str, $pat_array)) {//黑名单过滤
            return $str;
        } else {
            echo "don't hack";
        }
    }
 
    function __wakeup(){  //序列化后调用
        foreach($this->args as $k => $v) {//数组遍历
            $this->args[$k] = $this-&

你可能感兴趣的:(攻防世界web入门,php,开发语言)