|
42 | 42 | class AIAnalyzer: |
43 | 43 | def __init__(self): |
44 | 44 | self.api_key = os.getenv("GROQ_API_KEY", "") |
45 | | - self.model = "llama-3.1-70b-versatile" |
| 45 | + self.model = "llama-3.3-70b-versatile" |
46 | 46 | self.max_tokens = 4096 |
47 | 47 |
|
48 | 48 | def analyze(self, target: str, recon_results: Dict[str, Any]) -> Dict[str, Any]: |
@@ -116,12 +116,15 @@ def _format_results(self, results: Dict[str, Any]) -> str: |
116 | 116 | # Nmap services |
117 | 117 | services = active.get("services", {}) |
118 | 118 | for host, svc_map in services.items(): |
| 119 | + if not isinstance(svc_map, dict) or "error" in svc_map: |
| 120 | + continue |
119 | 121 | for port, svc in svc_map.items(): |
120 | | - if svc.get("state") == "open": |
121 | | - lines.append( |
122 | | - f"Host {host} port {port}/{svc.get('protocol','tcp')}: " |
123 | | - f"{svc.get('name','')} {svc.get('product','')} {svc.get('version','')}" |
124 | | - ) |
| 122 | + if not isinstance(svc, dict) or svc.get("state") != "open": |
| 123 | + continue |
| 124 | + lines.append( |
| 125 | + f"Host {host} port {port}/{svc.get('protocol','tcp')}: " |
| 126 | + f"{svc.get('name','')} {svc.get('product','')} {svc.get('version','')}" |
| 127 | + ) |
125 | 128 |
|
126 | 129 | # Web enum findings |
127 | 130 | web = active.get("web_enum", {}) |
@@ -183,6 +186,8 @@ def _fallback_analysis(self, results: Dict[str, Any]) -> Dict[str, Any]: |
183 | 186 |
|
184 | 187 | services = active.get("services", {}) |
185 | 188 | for host, svc_map in services.items(): |
| 189 | + if not isinstance(svc_map, dict) or "error" in svc_map: |
| 190 | + continue |
186 | 191 | for port, svc in svc_map.items(): |
187 | 192 | if not isinstance(svc, dict): |
188 | 193 | continue |
|
0 commit comments