Closed ostrolucky closed 1 year ago
Thanks for reporting the issue. This was also reported by previous users. I'll try to fix it and update here.
Traceback (most recent call last):
File "C:\Users\Jerem\Downloads\chatgpt\PentestGPT\main.py", line 27, in
@GreyDGL im getting the same error
I'm having this issue as well, what seems to fix it for me is opening a new incognito chrome session to chat.openai.com and grabbing a new cookie.
It seems to fix the issue for about 30 minutes then the connection breaks again and I get failures when running test_connection.py
I'm also trying to fix this now. Unfortunately, it seems like OpenAI has a stricter restriction on ChatGPT sessions, which makes the "cookie" workaround unstable. Will try to figure it out. For now, please use API for stable connection if possible.
I have the same issue, @GreyDGL the cookie updates almost immediately on first request, if you try to use it again it does not work, the curl test gives me: {"message_cap":25,"message_cap_window":180,"message_disclaimer":{"model-switcher":"You've reached the GPT-4 cap, which gives all ChatGPT Plus users a chance to try the model.\n\nPlease check back soon.","textarea":"GPT-4 currently has a cap of 25 messages every 3 hours."}}%
@ntwrite Did you use the latest commit? Could you help me to confirm if you encounter the error, or you're requested to refresh the session (which is a feature in the latest commit)? If it's an error, please attach the error trace here so I can debug.
@ntwrite Did you use the latest commit? Could you help me to confirm if you encounter the error, or you're requested to refresh the session (which is a feature in the latest commit)? If it's an error, please attach the error trace here so I can debug.
I have used the latest, and the error trace is exactly the same as the original at the top of this thread, no it is first session so I am pasting the cookie into config
Could you please confirm if the error also happens at the same number of lines? Because after the updates, this issue should be resolved. I'm interested in debugging and please attach screenshot/error trace so that I could help.
Ok here's the full trace @GreyDGL,
python3 main.py --reasoning_model=gpt-4 ░▒▓ ✔ 16:30:46
Do you want to continue from previous session? (y/n) n
- ChatGPT Sessions Initialized.
Please describe the penetration testing task in one line, including the target IP, task type, etc.
> I want to test 192.168.0.1
- Task information generated.
PentestGPT suggests you to do the following:
(None, None)
Traceback (most recent call last):
File "/Users/user/Documents/pentestgpt/PentestGPT/main.py", line 27, in <module>
pentestGPTHandler.main()
File "/Users/user/Documents/pentestgpt/PentestGPT/utils/pentest_gpt.py", line 643, in main
self.initialize(previous_session_ids=loaded_ids)
File "/Users/user/Documents/pentestgpt/PentestGPT/utils/pentest_gpt.py", line 221, in initialize
self._feed_init_prompts()
File "/Users/user/Documents/pentestgpt/PentestGPT/utils/pentest_gpt.py", line 155, in _feed_init_prompts
"PentestGPT", "PentestGPT suggests you to do the following: \n" + _response
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
TypeError: can only concatenate str (not "tuple") to str
It does this immediately, there is no processing going on, and I think (but could be wrong) that it is related to expired cookie, session updates cookie on each refresh.
I see. May I know if you tried with python3 test_connection.py
? What is the output?
The above output shows that the cookie is not correctly implemented. I'll add an Exception handler.
I copied the cookie out of the cURL from coversation limits, the cookie is definitely implemented correctly, however, each time i refresh the page the cookie has changed, in cURL test it says this:
{"message_cap":25,"message_cap_window":180,"message_disclaimer":{"model-switcher":"You've reached the GPT-4 cap, which gives all ChatGPT Plus users a chance to try the model.\n\nPlease check back soon.","textarea":"GPT-4 currently has a cap of 25 messages every 3 hours."}}%
However the test_connection gives this (I followed YouTube video to make sure i was not being stupid, it is the cookie value from conversation limits):
The cookie is not properly configured with ChatGPT Cookie. Please follow README to update cookie in config/chatgpt_config.py
The OpenAI API key is not properly configured. Please follow README to update OpenAI API key in config/chatgpt_config.py
The OpenAI API key is not properly configured. Please follow README to update OpenAI API key in config/chatgpt_config.py
Emm this is strange. What I typically do is that after testing the cookie working correctly, I'll copy it from the terminal and paste it into Python config directly. Note that during this process, refreshing the ChatGPT page will make the original cookie invalid. Please always use test_connection.py
before running main.py
to ensure the connection works.
May I have your Browser version and OS version for reference? Will try to reproduce the issue first.
Out of about the 10 times I tried to get the cookie working correctly, it worked the first time, and then after that I just couldn't get it to work, I did the same process each time.
Sure my user agent is:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
(from the cookie). I may work on an alternative approach to grabbing the cookie and filling it into the conf perhaps some python. I will update here.
Thank you, for the help, awaiting any update on the same.
I get this nice message 3. You're connected with OpenAI API. You have GPT-3.5 access. To start PentestGPT, please use <pentestgpt --reasoning_model=gpt-3.5-turbo --useAPI>
then
Traceback (most recent call last):
File "/opt/homebrew/bin/pentestgpt", line 8, in
TypeError: can only concatenate str (not "tuple") to str
Getting below error: do we have a solution to this ?
- ChatGPT Sessions Initialized.
Please describe the penetration testing task in one line, including the target IP, task type, etc.
>
- Task information generated.
Traceback (most recent call last):
File "...\PentestGPT\main.py", line 27, in <module>
pentestGPTHandler.main()
File "...\PentestGPT\PENTESTGPT\utils\pentest_gpt.py", line 643, in main
self.initialize(previous_session_ids=loaded_ids)
File "...\PentestGPT\PentestGPT\PENTESTGPT\utils\pentest_gpt.py", line 221, in initialize
self._feed_init_prompts()
File "...\PentestGPT\PENTESTGPT\utils\pentest_gpt.py", line 147, in _feed_init_prompts
self.prompts.first_todo + _response
TypeError: can only concatenate str (not "tuple") to str
May I confirm if you're using the latest commit? @GirishbKulkarni
Hello @GreyDGL - Yes I have the latest commit codebase
I found that using the command without "--useAPI" flag causes this issue. Fixing it in the latest commit.