@@ -234,8 +234,8 @@ def process_error(xml_file: str) -> str:
234
234
if error :
235
235
return error .text
236
236
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 )
239
239
240
240
241
241
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
405
405
async def process_sslscan (self , hostname : str , port : int ) -> AsyncIterator [Tuple [int , str ]]:
406
406
with tempfile .NamedTemporaryFile ("r" , suffix = ".xml" , delete = False ) as temp_file :
407
407
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
+
409
414
error = process_error (temp_file .name )
410
415
if error :
411
416
log_red (error )
0 commit comments