- 靶场环境: DVWA/WebGoat/Pikachu/BWAPP/SQLi-Labs/XSS-Labs - SQL注入工具: sqli-scanner.py, blind-sqli.py, sqli-exploit.go - XSS工具: xss-fuzzer.py, xss-scanner.go - 认证攻击: web-brute.py, jwt-cracker.py - 服务端安全: port-scanner.py, tls-scanner.py - 防御配置: nginx-hardening.conf - 案例研究: 福建政采网安全评估报告 (13份) - 同步脚本: sync-gitea.sh
31 行
1.1 KiB
Python
31 行
1.1 KiB
Python
import socket
|
|
import concurrent.futures
|
|
|
|
targets = ["112.54.45.252", "120.35.30.176", "114.115.172.176"]
|
|
ports = [21, 22, 23, 80, 81, 443, 3389, 8080, 8443, 8888, 9000, 3306, 6379, 27017, 11211, 8000, 8081, 9090, 8090, 4430]
|
|
|
|
def scan(ip, port):
|
|
try:
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
sock.settimeout(2.5)
|
|
result = sock.connect_ex((ip, port))
|
|
sock.close()
|
|
if result == 0:
|
|
return (ip, port, "open")
|
|
except Exception:
|
|
pass
|
|
return (ip, port, "closed/filtered")
|
|
|
|
if __name__ == '__main__':
|
|
print("Starting port scan on targets: ", targets)
|
|
with concurrent.futures.ThreadPoolExecutor(max_workers=50) as executor:
|
|
futures = []
|
|
for ip in targets:
|
|
for port in ports:
|
|
futures.append(executor.submit(scan, ip, port))
|
|
for future in concurrent.futures.as_completed(futures):
|
|
res = future.result()
|
|
if res[2] == "open":
|
|
print(f"Host: {res[0]} Port: {res[1]} is OPEN")
|
|
print("Scan complete.")
|