MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / main

Function main

scripts/run_targeted_plan.py:28–82  ·  view source on GitHub ↗
(targets: list[str], mode: str, profile: str, msf_password: str)

Source from the content-addressed store, hash-verified

26
27async def main(targets: list[str], mode: str, profile: str, msf_password: str) -> None:
28 session = guardrails.create_session(
29 operator=os.environ.get("USER", "operator"),
30 engagement_id=f"HOME-NET-{__import__('datetime').date.today()}",
31 roe_allowed=["192.168.1.0/24", "10.0.0.0/8", "172.16.0.0/12"],
32 ttl_hours=8,
33 allow_live_exploitation=False,
34 )
35 print(f"[+] Engagement session: {session.session_id}")
36 print(f"[+] Mode: {mode} Profile: {profile}")
37 print(f"[+] Targets: {', '.join(targets)}\n")
38
39 runner = RedBlueOrchestrator(
40 msf_password=msf_password,
41 output_dir="/tmp/secsuite-loop",
42 )
43
44 all_confirmed = []
45
46 for target in targets:
47 sep = "=" * 70
48 print(f"\n{sep}")
49 print(f" TARGET: {target}")
50 print(sep)
51
52 try:
53 report = await runner.run(target, mode=mode, scan_profile=profile)
54 d = report.to_dict()
55
56 confirmed = [f for f in d["findings"] if f["exploit_status"] == "CONFIRMED"]
57 unique = {(f["ip"], f["port"], f["service"]) for f in confirmed}
58
59 print(f" Hosts: {d['summary']['hosts']} "
60 f"Services: {d['summary']['services']} "
61 f"CVEs: {d['summary']['cves']} "
62 f"Confirmed: {len(unique)}")
63
64 for ip, port, svc in sorted(unique):
65 print(f" [CONFIRMED] {ip}:{port} {svc}")
66 # Print remediation if available
67 for f in confirmed:
68 if f["ip"] == ip and f["port"] == port and f.get("remediation_explanation"):
69 print(f" Remediation: {f['remediation_explanation'][:100]}...")
70 break
71
72 all_confirmed.extend(unique)
73
74 except Exception as exc:
75 print(f" [ERROR] {target}: {exc}")
76 import traceback
77 traceback.print_exc()
78
79 print(f"\n{'=' * 70}")
80 print(f" TOTAL CONFIRMED EXPOSURES: {len(all_confirmed)}")
81 print(" Report files written to: /tmp/secsuite-loop/")
82
83
84if __name__ == "__main__":
85 parser = argparse.ArgumentParser(description="Targeted security loop runner")

Callers 1

Calls 5

runMethod · 0.95
RedBlueOrchestratorClass · 0.90
create_sessionMethod · 0.80
getMethod · 0.45
to_dictMethod · 0.45

Tested by

no test coverage detected