Create scanner.py
Browse files- src/scanner.py +23 -0
src/scanner.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import httpx
|
2 |
+
from concurrent.futures import ThreadPoolExecutor
|
3 |
+
|
4 |
+
# Simulated subdomain scan
|
5 |
+
def get_subdomains(domain):
|
6 |
+
return [f"dev.{domain}", f"api.{domain}", f"staging.{domain}", f"login.{domain}"]
|
7 |
+
|
8 |
+
# Simulated HTTP scan
|
9 |
+
def scan_http(target):
|
10 |
+
try:
|
11 |
+
r = httpx.get(f"http://{target}", timeout=3)
|
12 |
+
return {
|
13 |
+
"url": f"http://{target}",
|
14 |
+
"status": r.status_code,
|
15 |
+
"server": r.headers.get("server", "Unknown"),
|
16 |
+
"tech": r.headers.get("x-powered-by", "Unknown")
|
17 |
+
}
|
18 |
+
except Exception:
|
19 |
+
return {"url": f"http://{target}", "error": "Unreachable"}
|
20 |
+
|
21 |
+
def threaded_http_scan(subs):
|
22 |
+
with ThreadPoolExecutor(max_workers=10) as executor:
|
23 |
+
return list(executor.map(scan_http, subs))
|