diff --git a/utils/pentest_gpt.py b/utils/pentest_gpt.py index d53c4ee..b46a82a 100644 --- a/utils/pentest_gpt.py +++ b/utils/pentest_gpt.py @@ -481,11 +481,19 @@ class pentestGPT: # 4. enter the main loop. while True: - result = self.input_handler() - self.console.print( - "-----------------------------------------", style="bold white" - ) - if not result: # end the session + try: + result = self.input_handler() + self.console.print( + "-----------------------------------------", style="bold white" + ) + if not result: # end the session + break + except Exception as e: # catch all general exception. + # log the exception + self.log_conversation("exception", "e") + # print the exception + self.console.print("Exception: " + str(e), style="bold red") + # safely quit the session break # Summarize the session and end