GreyDGL / PentestGPT

A GPT-empowered penetration testing tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix restore previous session

RiccardoRobb opened this issue · comments

Whenever I try to use a previously saved session, the tool creates a new conversation.

Your CHATGPT_COOKIE is not set. Please set it in the environment variable.
Welcome to pentestGPT, an automated penetration testing parser empowered by GPT.
The settings are: 
 - parsing model: gpt-3.5-turbo-16k
 - reasoning model: gpt-4-browsing
 - use API: True
 - log directory: logs
Do you want to continue from previous session? (y/n) y
Please select the previous session by its index (integer):
0. testZero
1. README.md
Please key in your option (integer): 0
You selected: testZero
New conversation.163502c1-6c40-11ee-9cd0-c5a3a6d4eef1 is created.

New conversation.17b793c4-6c40-11ee-9cd0-c5a3a6d4eef1 is created.

New conversation.19abca7e-6c40-11ee-9cd0-c5a3a6d4eef1 is created.

....

In this case the tool does not restore the session

Possible Fix idea

Removing the self.useAPI is False control from line 197
The tool successfully retrieves information about the selected conversation

Your CHATGPT_COOKIE is not set. Please set it in the environment variable.
Welcome to pentestGPT, an automated penetration testing parser empowered by GPT.
The settings are: 
 - parsing model: gpt-3.5-turbo-16k
 - reasoning model: gpt-4-browsing
 - use API: True
 - log directory: logs
Do you want to continue from previous session? (y/n) y
Please select the previous session by its index (integer):
0. testZero
1. README.md
Please key in your option (integer): 0
You selected: testZero 
  • DEBUG OUTPUT:
    {'reasoning': '4b18d4c8-6757-11ee-bc55-7b9bac8d007a', 'test_generation': '47401fb4-6757-11ee-bc55-7b9bac8d007a', 'parsing': '4feaffbc-6757-11ee-bc55-7b9bac8d007a', 'task_log': {'task description': 'I want to access a web site with credentials that are not mine'}}
Task log: {'task description': 'I want to access a web site with credentials that are not mine'}
You may use discussion function to remind yourself of the task.
> next
Please choose the source of the information.
( ) tool Paste the output of the security test tool used                                                                                                                                                          ^
(*) user-comments                                                                                                                                                                                                  
( ) web Paste the relevant content of a web page                                                                                                                                                                   
( ) default Write whatever you want, the tool will handle it                                                                                                                                                      v
Your input: (End with <shift + right-arrow>)
> hi
Exception: RetryError[<Future at 0x7f7e9dfad630 state=finished raised KeyError>]
Exception details are below. You may submit an issue on github and paste the error trace

But after that the tool cannot retrieve the right conversation
Key error in line 253

First, thanks for the continous contribution to the project @RiccardoRobb !
I have noticed this problem. Will provide a fix PR and refer to this item.

I am glad to be able to contribute to this project.
I will try to find a solution for this problem.
I am trying to see if pentestgpt/utils/chatgpt.py can be used to solve the problem; from here I want to see if I can retrieve the entire conversation history.
Let me know if this is a good idea 😄