Skip to content

Commit a36ea05

Browse files
committed
mod_ssl: style
1 parent f9cdb85 commit a36ea05

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

wapitiCore/attack/mod_ssl.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ def process_error(xml_file: str) -> str:
234234
if error:
235235
return error.text
236236
return ""
237-
except Exception as exception:
238-
return "Error parsing sslscan XML output" + str(exception)
237+
except (ET.ParseError, FileNotFoundError, OSError, IOError) as exception:
238+
return "Error parsing sslscan XML output:" + str(exception)
239239

240240

241241
async def process_vulnerabilities(xml_file: str) -> AsyncIterator[Tuple[int, str]]:
@@ -405,7 +405,12 @@ async def process_cert_features(self, target: str, port: int) -> AsyncIterator[T
405405
async def process_sslscan(self, hostname: str, port: int) -> AsyncIterator[Tuple[int, str]]:
406406
with tempfile.NamedTemporaryFile("r", suffix=".xml", delete=False) as temp_file:
407407
sslscan_command = ["sslscan", "--iana-names", "--ocsp", f"--xml={temp_file.name}", f"{hostname}:{port}"]
408-
subprocess.run(sslscan_command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
408+
try:
409+
subprocess.run(sslscan_command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
410+
except subprocess.CalledProcessError as exception:
411+
log_red("Error running sslscan: " + str(exception))
412+
return
413+
409414
error = process_error(temp_file.name)
410415
if error:
411416
log_red(error)

0 commit comments

Comments
 (0)