Skip to content

Commit

Permalink
Add timeout config option for nessus scan
Browse files Browse the repository at this point in the history
  • Loading branch information
sfowl committed Nov 5, 2024
1 parent c645321 commit 76e89fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/config-template-nessus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ scanners:
name: test-scan # name of new scan to create
folder: test-folder # name of folder in to contain scan
policy: "py-test" # policy used for scan
# timeout: 600 # timeout in seconds to complete scan
targets:
- 127.0.0.1
6 changes: 3 additions & 3 deletions scanners/nessus/nessus_none.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class NessusScanConfig:
policy: str
targets: List[str]
folder: str = field(default="rapidast")
timeout: int = field(default=600) # seconds

def targets_as_str(self) -> str:
return " ".join(self.targets)
Expand Down Expand Up @@ -61,7 +62,6 @@ def __init__(self, config: RapidastConfigModel, ident: str = "nessus"):
# XXX self.config is already a dict with raw config values
self.cfg = dacite.from_dict(data_class=NessusConfig, data=nessus_config_section)
self._sleep_interval: int = 10
self._timeout: int = 300
self._connect()

def _connect(self):
Expand Down Expand Up @@ -122,8 +122,8 @@ def run(self):
# Wait for the scan to complete
start = time.time()
while self.nessus_client.get_scan_status(self.scan_id)["status"] not in END_STATUSES:
if time.time() - start > self._timeout:
logging.error(f"Timeout {self._timeout}s reached waiting for scan to complete")
if time.time() - start > self.cfg.scan.timeout:
logging.error(f"Timeout {self.cfg.scan.timeout}s reached waiting for scan to complete")
self.state = State.ERROR
break

Expand Down

0 comments on commit 76e89fd

Please sign in to comment.