Security-suite compatible run() interface.
(self, target: Target)
| 243 | |
| 244 | async def run(self, target: Target) -> ScanResult: |
| 245 | """Security-suite compatible run() interface.""" |
| 246 | result = ScanResult(target=target, module="vulnscan.scanner") |
| 247 | |
| 248 | services, errors = await self.scan(target.value) |
| 249 | for err in errors: |
| 250 | result.errors.append(err) |
| 251 | |
| 252 | result.raw_data["services"] = services |
| 253 | result.raw_data["profile"] = self.profile |
| 254 | |
| 255 | if not services: |
| 256 | result.complete() |
| 257 | return result |
| 258 | |
| 259 | risky = [ |
| 260 | {"port": s["port"], "service": RISKY_PORTS[s["port"]], "host": s["target_ip"]} |
| 261 | for s in services if s["port"] in RISKY_PORTS |
| 262 | ] |
| 263 | |
| 264 | result.add_finding( |
| 265 | title="Open Services Discovered", |
| 266 | description=f"Found {len(services)} open service(s) across all hosts", |
| 267 | severity=Severity.INFO, |
| 268 | data={"count": len(services), "services": services[:20]}, |
| 269 | ) |
| 270 | |
| 271 | if risky: |
| 272 | result.add_finding( |
| 273 | title="High-Risk Services Exposed", |
| 274 | description=f"{len(risky)} service(s) known to carry elevated risk", |
| 275 | severity=Severity.HIGH, |
| 276 | data={"services": risky}, |
| 277 | ) |
| 278 | |
| 279 | result.complete() |
| 280 | return result |
no test coverage detected