ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### **方法说明** &nbsp; &nbsp; &nbsp;&nbsp;插件中的方法名称是固定的,主系统会直接调用以上方法发送使用该方法设置的报文。 &nbsp; &nbsp; &nbsp;&nbsp;在说明文件中提及的函数之外,为了满足更加复杂的需求,允许自定义创建其他方法。用来处理各种数据。 以下方法中各种`POC`、`EXP`的构建模式相同,**这里仅以`POC`为例**。`EXP`与`POC`结构完全相同,后续将不再赘述。 ***** ### **Poc_GetOther基本方法** *案例说明:以下案例以 CNVD-2018-24942为例(thinkphp5.1.x远程代码执行漏洞)* ``` public Dictionary<string,string> Poc_GetOther(Dictionary<string, Dictionary<string, string>> data) { Dictionary<string, string> other = new Dictionary<string, string>(); other = data["others"]; if (other["numberOfTime"] == "0") {//确认numberOfTime值为0,此次请求为第一次请求。 other["numberOfTime"] = "2";//将numberOfTime设置为2,告知主程序,请求类型为Post类型的请求 } else {//将numberOfTime设置为0,告知主程序结束请求。 other["numberOfTime"] = "0"; } return other; } ``` ***** ### **Poc_GetOther创建多次请求** &nbsp; &nbsp; &nbsp;&nbsp;与`Poc_GetUrl`一样,在某些多次请求的EXP中,需要多次请求并修改header。可以使用如下代码(两次http请求): ``` public Dictionary<string,string> Poc_GetOther(Dictionary<string, Dictionary<string, string>> data) { Dictionary<string, string> other = new Dictionary<string, string>(); other = data["others"]; if (other["numberOfTime"] == "0") {//确认numberOfTime值为0,此次请求为第一次请求。 other["numberOfTime"] = "2";//将numberOfTime设置为2,告知主程序,请求类型为**Post**类型的请求 } else if (other["numberOfTime"] == "2") {//确认numberOfTime值为2,此次请求为第二次请求。 other["numberOfTime"] = "1";//将numberOfTime设置为1,告知主程序,请求类型为**Get**类型的请求 } else {//将numberOfTime设置为0,告知主程序结束请求。 other["numberOfTime"] = "0"; } return other; } ``` 也可以使用如下代码进行多次http请求,使用numberOfTime的值来区分请求`次数`与需要发送的http请求`类型`: ``` public Dictionary<string,string> Poc_GetOther(Dictionary<string, Dictionary<string, string>> data) { Dictionary<string, string> other = new Dictionary<string, string>(); other = data["others"]; if (other["numberOfTime"] == "0") {//确认numberOfTime值为0,此次请求为第一次请求。 other["numberOfTime"] = "2";//将numberOfTime设置为2,告知主程序,请求类型为**Post**类型的请求 } else if (other["numberOfTime"] == "2") {//确认numberOfTime值为2,此次请求为第二次请求。 other["numberOfTime"] = "1";//将numberOfTime设置为1,告知主程序,请求类型为**Get**类型的请求 } else if (other["numberOfTime"] == "1") {//确认numberOfTime值为2,此次请求为第三次请求。 other["numberOfTime"] = "3";//将numberOfTime设置为1,告知主程序,请求类型为**Get**类型的请求 } else if (other["numberOfTime"] == "3") {//确认numberOfTime值为2,此次请求为第三次请求。 other["numberOfTime"] = "5";//将numberOfTime设置为1,告知主程序,请求类型为**Post**类型的请求 } else {//将numberOfTime设置为0,告知主程序结束请求。 other["numberOfTime"] = "0"; } return other; } ``` 次数的可以利用`numberOfTime`的值确定,每次返回`other['numberOfTime']`的值不一样来确定是第几次访问。 返回`numberOfTime`对于3取余的值确定返回时需要主函数发送的http请求类型。 numberOfTime%3=1为`GET`请求、numberOfTime%3=2为`Post`请求。 numberOfTime%3=0为要求主程序结束请求,将`other["response"]`结果直接输出。 ***** ### **Poc_GetOther创建自定义载荷** 自定义返回结果:第二次请求可以对前一次的请求结果进行处理。如果不处理则直接在结果框中输出`http`请求的返回结果。 如果希望请求成功则放回`请求成功`四个字,而不是html代码。则可以使用以下方法。 ``` public Dictionary<string, string> Poc_GetOther(Dictionary<string, Dictionary<string, string>> data) { Dictionary<string, string> other = new Dictionary<string, string>(); other = data["others"]; if (other["numberOfTime"] == "0") {//确认numberOfTime值为0,此次请求为第一次请求。 other["numberOfTime"] = "2";//将numberOfTime设置为2,告知主程序,请求类型为**Post**类型的请求 } else if (other["numberOfTime"] == "2") {//将numberOfTime设置为1,告知主程序,第二次的请求类型为**Get**类型的请求 other["numberOfTime"] = "1"; } else { //再第二次请求的时候可以将第一次请求的**response**作处理。或者利用**response**进行paloay处理 other["response"]="返回成功"; other["numberOfTime"] = "0";//结束循环并输出结果 } return other; } ``` 返回的结果值允许在最后的一次请求之后,也就是`else`之中。否则就会被覆盖。 ***** ### **Poc_GetOther其他说明** 在Poc_GetOther 根据`numberOfTime`判断请求方法和次数。如下表 ![](https://img.kancloud.cn/30/66/3066ceeab84f6ee38cdbe4f5ac671c58_495x307.png) *****