fix(exploits): accept Neo target addresses
- Add default service ports for bare target IPs. - Cover explicit URL preservation and target normalization.
This commit is contained in:
1 parent
71574dcfa0
commit
d8a89610cd
3 files changed
+38
-4
No files matched your search
@@ -28,6 +28,13 @@ from cryptography.x509.oid import NameOID
|
||||
FLAG_RE = re.compile(r"\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 request_json(response: requests.Response) -> Any:
|
||||
try:
|
||||
data = response.json()
|
||||
@@ -50,12 +57,12 @@ def make_csr(key: ec.EllipticCurvePrivateKey) -> str:
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("base_url", help="service URL, e.g. http://10.0.0.5:8081")
|
||||
parser.add_argument("base_url", help="target IP or service URL")
|
||||
parser.add_argument("--implant-id", help="specific target implant UUID")
|
||||
parser.add_argument("--insecure", action="store_true", help="disable TLS certificate verification")
|
||||
args = parser.parse_args()
|
||||
|
||||
base = args.base_url.rstrip("/")
|
||||
base = normalize_base_url(args.base_url, 8081)
|
||||
session = requests.Session()
|
||||
session.verify = not args.insecure
|
||||
|
||||
|
||||
Reference in new issue
Block a user