36 lines
958 B
Python
36 lines
958 B
Python
import requests
|
|||
|
|
import re
|
||
|
|
from urllib.parse import urljoin
|
||
|
|
|
||
|
|
ROUTER = "https://192.168.178.2"
|
||
|
|
|
||
|
|
r = requests.get(ROUTER, verify=False, timeout=5)
|
||
|
|
|
||
|
|
scripts = re.findall(r'<script[^>]+src=["\']([^"\']+)', r.text)
|
||
|
|
|
||
|
|
for script in scripts:
|
||
|
|
if script.endswith("/app.js"):
|
||
|
|
url = urljoin(ROUTER, script)
|
||
|
|
|
||
|
|
print("Downloading:", url)
|
||
|
|
|
||
|
|
js = requests.get(url, verify=False, timeout=10).text
|
||
|
|
|
||
|
|
print("Size:", len(js), "bytes")
|
||
|
|
|
||
|
|
# Print strings containing things that are likely to be API endpoints
|
||
|
|
print("\nInteresting URLs/strings:\n")
|
||
|
|
|
||
|
|
patterns = [
|
||
|
|
r'["\']([^"\']*(?:api|cgi|device|client|status|dhcp|wifi|wireless|lan)[^"\']*)["\']',
|
||
|
|
]
|
||
|
|
|
||
|
|
found = set()
|
||
|
|
|
||
|
|
for pattern in patterns:
|
||
|
|
for match in re.findall(pattern, js, re.IGNORECASE):
|
||
|
|
if len(match) < 300:
|
||
|
|
found.add(match)
|
||
|
|
|
||
|
|
for item in sorted(found):
|
||
|
|
print(item)
|