GreyDGL / PentestGPT

A GPT-empowered penetration testing tool
MIT License
7.29k stars 886 forks source link

not sure whats happening #58

Closed jeremiahforsythe closed 1 year ago

jeremiahforsythe commented 1 year ago

hello

im getting the following error

C:\Users\Jerem\Downloads\chatgpt\PentestGPT>python3 main.py --reasoning_model=gpt-4 --useAPI

im not sure what im doing wrong

GreyDGL commented 1 year ago

Most likely your API key is not correct. Did you run python3 test_connection.py before starting? Do you have proper access to GPT-4?

jeremiahforsythe commented 1 year ago

i have a plus membership and a api key. when i tried running python3 test_connection.py it says

C:\Users\Jerem\Downloads\chatgpt\PentestGPT>python3 test_connection.py

Test connection for chatgpt cookie

Your cookie setting is not correct. Please update it in config/chatgpt_config.py

GreyDGL commented 1 year ago

Please refer to #26 and check the README documentation. Besides, please ensure that you have API key access to GPT-4 (because by default, you only have access to GPT-3.5). Otherwise, please use python3 main.py --reasoning_model=gpt-3.5-turbo --useAPI

jeremiahforsythe commented 1 year ago

python3 main.py --reasoning_model=gpt-3.5-turbo --useAPI

ive run this and it still gives me the same error

C:\Users\Jerem\Downloads\chatgpt\PentestGPT>python3 main.py --reasoning_model=gpt-3.5-turbo --useAPI

i also have the same cookie error when following the readme. ill see if i can keep refreshing and loggin in and seeing what happens. otherwise im using chrome and im copying and pasting the entire cookie into the program and i still get the same error

redactedaccount commented 1 year ago

I have noticed that some cookies it just plain doesn't like. Wait for the next one and see if you get the same error. I think sessions are like 10 minutes roughly.

GreyDGL commented 1 year ago

You can either use a cookie or an API key. In any way, you should firstly run python3 test_connection.py to check if everything works correctly. Could I confirm with you that you have linked a payment method to OpenAI? Otherwise the API key won't work.

jeremiahforsythe commented 1 year ago

You can either use a cookie or an API key. In any way, you should firstly run python3 test_connection.py to check if everything works correctly. Could I confirm with you that you have linked a payment method to OpenAI? Otherwise the API key won't work.

i have a linked payment too open ai yes

jeremiahforsythe commented 1 year ago

so i deleted my api key

i went into https://chat.openai.com/api/auth/session and copied a new cookie and user agent im still getting the following error unfortunately . ill haft too further test this. i have also tried the same with https://chat.openai.com/public-api/conversation_limit

Microsoft Windows [Version 10.0.19045.2913] (c) Microsoft Corporation. All rights reserved.

C:\Users\Jerem\Downloads\chatgpt\PentestGPT>python3 test_connection.py

Test connection for chatgpt cookie

Your cookie setting is not correct. Please update it in config/chatgpt_config.py

C:\Users\Jerem\Downloads\chatgpt\PentestGPT>python3 test_connection.py

Test connection for chatgpt cookie

Your cookie setting is not correct. Please update it in config/chatgpt_config.py

C:\Users\Jerem\Downloads\chatgpt\PentestGPT>

jeremiahforsythe commented 1 year ago

problems

jeremiahforsythe commented 1 year ago

problems 2

GreyDGL commented 1 year ago

Did you try to follow the installation video? Does curl command work?

b3n-j4m1n commented 1 year ago

The issue is something to do with how proxies is initialized under the ChatGPT class.

class ChatGPT:
    def __init__(self, config: ChatGPTConfig):
        self.config = config
        self.model = config.model
        self.proxies = {"https": ""}

This gives me the error "Your setting is not correct. Please update it in config/chatgpt_config.py"

However if I set this to...

class ChatGPT:
    def __init__(self, config: ChatGPTConfig):
        self.config = config
        self.model = config.model
        self.proxies = {"http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080"}
    def get_authorization(self):
        try:
            url = "https://chat.openai.com/api/auth/session"
            r = requests.get(url, headers=self.headers, proxies=self.proxies, verify=False)

...it then works with "1. You're connected with ChatGPT Plus cookie."

jeremiahforsythe commented 1 year ago

Did you try to follow the installation video? Does curl command work?

i deleted the video and went through the steps exactly. im still getting the same errors

jeremiahforsythe commented 1 year ago

The issue is something to do with how proxies is initialized under the ChatGPT class.

class ChatGPT:
    def __init__(self, config: ChatGPTConfig):
        self.config = config
        self.model = config.model
        self.proxies = {"https": ""}

This gives me the error "Your setting is not correct. Please update it in config/chatgpt_config.py"

However if I set this to...

class ChatGPT:
    def __init__(self, config: ChatGPTConfig):
        self.config = config
        self.model = config.model
        self.proxies = {"http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080"}
    def get_authorization(self):
        try:
            url = "https://chat.openai.com/api/auth/session"
            r = requests.get(url, headers=self.headers, proxies=self.proxies, verify=False)

...it then works with "1. You're connected with ChatGPT Plus cookie."

where did you find the proxy for chatgpt? ill try too update the code on my end

jeremiahforsythe commented 1 year ago

i have figured out how too finally run this program.

it worked when i actually ran it through the command prompt in a windows environment. but when i tried asking it a question i get the following error

C:\Users\Jerem\Downloads\chatgpt\PentestGPT>python main.py

PentestGPT suggests you to do the following: (None, None) Traceback (most recent call last): File "C:\Users\Jerem\Downloads\chatgpt\PentestGPT\main.py", line 27, in pentestGPTHandler.main() File "C:\Users\Jerem\Downloads\chatgpt\PentestGPT\utils\pentest_gpt.py", line 479, in main "PentestGPT", "PentestGPT suggests you to do the following: \n" + _response TypeError: can only concatenate str (not "tuple") to str

GreyDGL commented 1 year ago

This should be fixed with the latest commit. Please refer to the new readme. Essentially you can paste the curl command into config/chatgpt_config_curl.txt to refresh the session.