语言:python
本poc模板并非指定漏洞poc,仅是为各位师傅提供一种基础的模板功能,代码中无payload
#-*- coding: utf-8 -*-
import argparse,sys,requests
from rich.console import Console
from multiprocessing.dummy import Pool
console = Console()
def poc(target):
url=target + "/payload" #在此定义访问的url路径
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
"Content-Type": "application/json;charset=UTF-8"
}#可在headers中添加所需的payload
try:
res=requests.get(url,headers=headers,verify=False,timeout=5)
if(res.status_code==200):#如果响应码为200则判断为成功
console.print(f"[+] {target} is exists ",style="bold green")
with open("result.txt","a+",encoding="utf-8") as f:
f.write(target+"\n")
else:
console.print(f"[-] {target} is not exists", style="bold red")
pass
except:
console.print(f"[*] {target} server error", style="bold yellow")
pass
pass
def main():
banner()
parser = argparse.ArgumentParser(description='poc模板')
parser.add_argument("-u", "--url", dest="url", type=str, help=" example: http://www.example.com")#接受-u参数,参数值为url
parser.add_argument("-f", "--file", dest="file", type=str, help=" urls.txt")
args = parser.parse_args()#接受-f参数,参数值为文件
if args.url and not args.file:#如果-u参数存在且-f参数不存在,则执行单一url搜索
poc(args.url)
elif not args.url and args.file:
url_list = []
with open(args.file,"r",encoding="utf8") as f:
for url in f.readlines():
url_list.append(url.strip().replace("\n",""))
mp = Pool(100) # 自己指定的线程数
mp.map(poc, url_list) # printNumber 函数 target 目标列表
mp.close()
mp.join()
else:
print(f"Usage:\n\t python3 {sys.argv[0]} -h")
if __name__ == '__main__':
main()