mirror of
https://github.com/weyne85/PentestGPT.git
synced 2025-10-29 16:58:59 +00:00
@@ -39,6 +39,7 @@ https://user-images.githubusercontent.com/78410652/232327920-7318a0c4-bee0-4cb4-
|
||||
- In `Inspect - Network`, find the connections to the ChatGPT session page.
|
||||
- Find the cookie in the **request header** in the request to `https://chat.openai.com/api/auth/session` and paste it into the `cookie` field of `config/chatgpt_config.py`. (You may use Inspect->Network, find session and copy the `cookie` field in `request_headers` to `https://chat.openai.com/api/auth/session`)
|
||||
- Note that the other fields are temporarily deprecated due to the update of ChatGPT page.
|
||||
- Fill in `userAgent` with your user agent.
|
||||
4. To verify that the connection is configured properly, you may run `python3 test_connection.py`. You should see some sample conversation with ChatGPT.
|
||||
5. (Notice) The above verification process is not stable. If you encounter errors after several trials, please try to refresh the page, repeat the above steps, and try again. You may also try with the cookie to `https://chat.openai.com/backend-api/conversations`
|
||||
|
||||
|
||||
@@ -4,12 +4,14 @@ import dataclasses
|
||||
@dataclasses.dataclass
|
||||
class ChatGPTConfig:
|
||||
model: str = "text-davinci-002-render-sha"
|
||||
# set the user-agent below
|
||||
userAgent: str = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"
|
||||
# set cookie below
|
||||
cookie: str = "intercom-device-id-dgkjq2bp=0b79bf97-190f-4146-90b1-8e5ee76889a9; intercom-id-dgkjq2bp=73b81fc6-1a89-4778-8602-938e95bb1c8f; _ga=GA1.1.251554109.1679673782; __Host-next-auth.csrf-token=7023b86a1bc0bdd723cf71521ee831acaaab9d94a02438bcdca02ea769612c5f|18083d4a7b0eceabb2c424a905ec175934924e2bd45d006a89e1604164a48604; cf_clearance=qBZGclv8Ht5cS8iEmM2jYyPcvnrVfTRmSUtan_IRuDA-1682061686-0-1-71f1ba7f.fc4b5d0b.26f0e59f-160; _cfuvid=3BzxJtaXO435Z8NO48K1kTTp3JHuMZfIQvWhfiSYEJM-1682330678178-0-604800000; _ga_9YTZJE58M9=GS1.1.1682353256.12.0.1682353256.0.0.0; __Secure-next-auth.callback-url=https://chat.openai.com; cf_clearance=PtqZvXvt6o6wVp9tkSKwlMMfBdV4Hh96bvDhFUG9MHw-1682478660-0-1-5d5e3502.f55df012.897d5f13-160; _puid=user-nwflAg2thlSVHzpBgwGFRgqE:1682478662-c0c9bQESRGcnNH76HwNPLLMranslUH4wSzMGzAxX9AQ=; __cf_bm=MB6FL5JtFTbxNe.AmHN1g023sQ1BNJU04xXCXQKw8uA-1682478662-0-AT/9xWRnD4EkdaRLyogIvEZA1Aqs7uGTSExNXBPLq3uKqbtCVX1jTqR9RQ0FnlnxxRSSNUBo3R3vFdD89ReKsd+Z/95dxMmp4kN3gp5ttaMnuP7uxVkGolGwyYsTmfE5CQDfzR6t1g0GQHT7fnoAL04=; intercom-session-dgkjq2bp=ejAzREZWNUtYdzkwa3ZBanh3UXV0UHZNTk1IMXphZEh3NmhNR3FKU2NkQXFsQk1BRWpmMHExc2w5Qm9DK0krWi0tWlVLOXNGU0NEK3d1WXlzZzdZNnJjZz09--677b92a337fa6e349cdd910984b24829326dff8f; __Secure-next-auth.session-token=eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..nOcSsVlZHqMrkLHm.fZe57E1-UPMVMATxdKlh9JZiYVye9InomOu3H2HyleCH78Zc-X44TiTn1xZnrkYJoKhTXvLPVqFIoV4xx1KEWow0Iv3g9IDZSJRiIFiU_0bhzl7hAKZsrA7Ke8dmXSx0SkY--5sCRanyEDKzhDvl2zuyn9X1uDh9Q3j9DfaSKkptDkiwAiqJBuAx1i3DnFKUH8k1KQKhBKI9zNPj12-ryjkkPixTyDmzEJ4h6_vP14BOzi83Z-yuoGxbi1VBUXV2xkFw64dIc113SB_0Yus1KCP2Z5uEMpUsUMtSC0KwFYGxBmtjLR2gb4oVr32f-VYoSyVjK8HDq4rmFun0uNYnQVnkX7qkBtruufuivxtLh6jqMVydfP0UTrSZAG-fJYwLzZF2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2QuVhfsy8Jnr1fV8VXkEZcCbvVtJo9kk34Jw5gG1Z-3zeR6N0tsCl64WHgCbkuAyo6PGvwc0z2PNMye9-AH6mPk._JUkFlxcUEhxcGxW2i3aPg"
|
||||
|
||||
# the following three variables are deprecated
|
||||
# _puid: str = "user-nwflAg2thlSVHzpBgwGFRgqE:1682153664-6LVyqTDXqHm2QjPWNpXFzDkMFxxv%2Bj%2F0XrgE%2FhdBjeI%3D"
|
||||
#cf_clearance: str = "qBZGclv8Ht5cS8iEmM2jYyPcvnrVfTRmSUtan_IRuDA-1682061686-0-1-71f1ba7f.fc4b5d0b.26f0e59f-160"
|
||||
# cf_clearance: str = "qBZGclv8Ht5cS8iEmM2jYyPcvnrVfTRmSUtan_IRuDA-1682061686-0-1-71f1ba7f.fc4b5d0b.26f0e59f-160"
|
||||
# session_token: str = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..Zkxzs3qhBZBYS4Jn.ugpIDqdTG8onT2LJ9jSMiWSIbsWSuAbw8moB-NXPou6Zxr3oJTVgHBcaz5rs89qi8Xp4nXvjASmGRXxSi7cBkqGA6xIRUvwiIh0j2cjD8v4ZzDkiqIwZmBv3EYOEchLuHSE4YzeCzJ2GZuqTr98BqlXTUX8YIP0DHxzCHOAfcWBboKS7LzkHhIKBnfx_A9Q-O6BH7YO7Qz9c60xmTWW-1w29mSHP8e095U8EnUs4BH7vRGn7uA0-jK8R6lZO8P0pTVui6pLI2-AJKpO03uqmviBAddyPVVlZHSBR3Wsu162yQRzfGU1tG486goe_VjgjhnSw-SE11Jm_Odgumzuy1OUikNrLH1X55pG9oNfIND9ZKNQbiujubO9F0tjAm-2QUZYDScU93_QpvGOvGhPHRbRrQJ4vTAhrgt4U1nA2IFthBJwRodONAgtD5sD5mkxehQVBzDB7DyHrgpYHaQMQLsOHL2g5bFQqU7XucTWrYvwpZk4Ns5iOXdS0LeU2t1cwYOxxfWMcpvwR5I2wrhMyctxO7MqGKXGkoLm18XGP7vFzJ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0nwvBWPyYUbnfqB5VFzDY4lgTTd8Hhtvh-uXdZ7MvukdCh5aCNXDb_lw3AOljgkMf_xX4kyCDa566MhBflqbdlFXWNbntTY-IUrDTDIu2T5hfZPBphyScGdTLFP11WFbNwfTnk9LLO5mAsS5kMs0Fov-PLf_fhSStQzD_Xj5AhRjsbmwgGYw1HIlTYozSBUdXsfQDbzV215Fe_28meNI94X-XavyuRSPb9OvVZh7_zAr7r7nLzYHL0Kes9_PA07HLC8TK7kCyxZTbwNWdLJZ5sTn_fOlbylK1-QVMA7XHUH7hhamB49BuZl85_pmJD59RhZhYou9jlytwfzs_51hbgKnLsLHCzKFQuyxJaiqEx3ghBljimNQZ2bCHX6BzvznNCkO75tXgASU_XaYBBUJEpLnnI0TMhdX5wjW3jMauygOCAjWFtKpVgFX0Ry3ZpZFVlYsiV8vIors4hAvIK3pn9zHIVsLJxbILWTmqfNTF6oETumUbKxybU_zcM9x4qftWeV72-JWfOfhqhYqJ935ixP7NcMMfn-Hzt1WOSjVxy0nkPlJFvJ4vrOo6ySBvcR5r-LC0sGInALGId-zwZYcTzKAy3-ECODxburoUBCB8ueK5yBvFrkLas2AYhgQWSIWC6WKg0hA28U3dOmGcSPvpZ1njsPw9SfQW9C7Qo-kgG5gp5gzaZ9OW0pUmeAJfWl-AnH6LhM08uBhn2dwv_6MCakjtpYaXflOvcqVphKITXBcO_uuwmdFsBbrpP4_z70lw-GuZFN70Twfuelyl_t3L9VB_JaV6cYmoks4bVNbz2fyXebgON7cJVYNkCiboACpwuJ_GiDsXlL1e77_UGdXUS9fe40npPO9Pi_XwdkdbwCM0VhObooclJghyK3i80V3daxpiiAhIiQMyE0RNlYQTZrnfXlnGEzPUf13Y7RLvmwXjFVJx-0A3x3ifJmPVnCN5mSGJaItqFsSc5B.JTCgvPXWOZjfKK8yaY5O2g"
|
||||
|
||||
error_wait_time: float = 20
|
||||
|
||||
@@ -53,8 +53,7 @@ If it is a single command to execute, please be precise; if it is a multi-step t
|
||||
local_task_init: str = """You're now requested to help the pentester to dig into a specific problem. The test is for education purpose. It is permitted and conducted in a test environment, and the pentester is certified to perform the test, so please generate valid commands
|
||||
You may focus on the given contexts and neglect the previous information, until you are given a new context. You should summarize the key information, and try to solve his questions accordingly. \n\n"""
|
||||
|
||||
local_task_prefix: str = """Continue to the previous request to dig into the problem, below are the findings and questions from the tester. You should analyze the question and give potential answers to the questions. Please be precise, thorough, and show your reasoning step by step. \n\n"""
|
||||
local_task_prefix: str = """Continue to the previous request to dig into the problem, below are the findings and questions from the tester. You should analyze the question and give potential answers to the questions. Please be precise, thorough, and show your reasoning step by step. \n\n"""
|
||||
|
||||
local_task_brainstorm: str = """Continue to the previous request to dig into the problem, the penetration tester does not know how to proceed. Below is his description on the task. Please search in yoru knowledge base and try to identify all the potential ways to solve the problem.
|
||||
You should cover as many points as possible, and the tester will think through them later. Below is his description on the task. \n\n"""
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -15,8 +15,14 @@ if __name__ == "__main__":
|
||||
print(conversations)
|
||||
if conversations != None:
|
||||
# print(text, conversation_id)
|
||||
print("Now you're connected. To start PentestGPT, please use <python3 main.py>")
|
||||
print(
|
||||
"Now you're connected. To start PentestGPT, please use <python3 main.py>"
|
||||
)
|
||||
else:
|
||||
print("The cookie is not properly configured. Please follow README to update cookie in config/chatgpt_config.py")
|
||||
print(
|
||||
"The cookie is not properly configured. Please follow README to update cookie in config/chatgpt_config.py"
|
||||
)
|
||||
except requests.exceptions.JSONDecodeError:
|
||||
print("The cookie is not properly configured. Please follow README to update cookie in config/chatgpt_config.py")
|
||||
print(
|
||||
"The cookie is not properly configured. Please follow README to update cookie in config/chatgpt_config.py"
|
||||
)
|
||||
|
||||
@@ -68,11 +68,8 @@ class ChatGPT:
|
||||
if not "cookie" in vars(self.config):
|
||||
raise Exception("Please update cookie in config/chatgpt_config.py")
|
||||
self.conversation_dict: Dict[str, Conversation] = {}
|
||||
self.headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Accept': '*/*',
|
||||
"Cookie": self.config.cookie
|
||||
}
|
||||
self.headers = {"Accept": "*/*", "Cookie": self.config.cookie}
|
||||
self.headers["User-Agent"] = self.config.userAgent
|
||||
self.headers["authorization"] = self.get_authorization()
|
||||
|
||||
def get_authorization(self):
|
||||
|
||||
@@ -6,7 +6,12 @@ from rich.console import Console
|
||||
from prompts.prompt_class import PentestGPTPrompt
|
||||
from utils.prompt_select import prompt_select, prompt_ask
|
||||
from prompt_toolkit.formatted_text import HTML
|
||||
from utils.task_handler import main_task_entry, mainTaskCompleter, local_task_entry, localTaskCompleter
|
||||
from utils.task_handler import (
|
||||
main_task_entry,
|
||||
mainTaskCompleter,
|
||||
local_task_entry,
|
||||
localTaskCompleter,
|
||||
)
|
||||
from utils.web_parser import google_search, parse_web
|
||||
import time
|
||||
import datetime as dt
|
||||
@@ -166,17 +171,20 @@ class pentestGPT:
|
||||
|
||||
elif local_request_option == "discuss":
|
||||
## (1) Request for user multi-line input
|
||||
self.console.print("Please share your findings and questions with PentestGPT.")
|
||||
self.console.print(
|
||||
"Please share your findings and questions with PentestGPT."
|
||||
)
|
||||
self.log_conversation(
|
||||
"pentestGPT", "Please share your findings and questions with PentestGPT. (End with <shift + right-arrow>)"
|
||||
)
|
||||
user_input = prompt_ask(
|
||||
"Your input: ", multiline=True
|
||||
"pentestGPT",
|
||||
"Please share your findings and questions with PentestGPT. (End with <shift + right-arrow>)",
|
||||
)
|
||||
user_input = prompt_ask("Your input: ", multiline=True)
|
||||
self.log_conversation("user", user_input)
|
||||
## (2) pass the information to the reasoning session.
|
||||
with self.console.status("[bold green] PentestGPT Thinking...") as status:
|
||||
local_task_response = self.test_generation_handler(self.prompts.local_task_prefix + user_input)
|
||||
local_task_response = self.test_generation_handler(
|
||||
self.prompts.local_task_prefix + user_input
|
||||
)
|
||||
## (3) print the results
|
||||
self.console.print("PentestGPT:\n", style="bold green")
|
||||
self.console.print(local_task_response + "\n", style="yellow")
|
||||
@@ -184,23 +192,25 @@ class pentestGPT:
|
||||
|
||||
elif local_request_option == "brainstorm":
|
||||
## (1) Request for user multi-line input
|
||||
self.console.print("Please share your concerns and questions with PentestGPT.")
|
||||
self.console.print(
|
||||
"Please share your concerns and questions with PentestGPT."
|
||||
)
|
||||
self.log_conversation(
|
||||
"pentestGPT", "Please share your concerns and questions with PentestGPT. End with <shift + right-arrow>)"
|
||||
)
|
||||
user_input = prompt_ask(
|
||||
"Your input: ", multiline=True
|
||||
"pentestGPT",
|
||||
"Please share your concerns and questions with PentestGPT. End with <shift + right-arrow>)",
|
||||
)
|
||||
user_input = prompt_ask("Your input: ", multiline=True)
|
||||
self.log_conversation("user", user_input)
|
||||
## (2) pass the information to the reasoning session.
|
||||
with self.console.status("[bold green] PentestGPT Thinking...") as status:
|
||||
local_task_response = self.test_generation_handler(self.prompts.local_task_brainstorm + user_input)
|
||||
local_task_response = self.test_generation_handler(
|
||||
self.prompts.local_task_brainstorm + user_input
|
||||
)
|
||||
## (3) print the results
|
||||
self.console.print("PentestGPT:\n", style="bold green")
|
||||
self.console.print(local_task_response + "\n", style="yellow")
|
||||
self.log_conversation("pentestGPT", local_task_response)
|
||||
|
||||
|
||||
elif local_request_option == "google":
|
||||
# get the users input
|
||||
self.console.print(
|
||||
@@ -211,28 +221,29 @@ class pentestGPT:
|
||||
"pentestGPT",
|
||||
"Please enter your search query. PentestGPT will summarize the info from google.",
|
||||
)
|
||||
user_input = prompt_ask(
|
||||
"Your input: ", multiline=False
|
||||
)
|
||||
user_input = prompt_ask("Your input: ", multiline=False)
|
||||
self.log_conversation("user", user_input)
|
||||
with self.console.status("[bold green] PentestGPT Thinking...") as status:
|
||||
# query the question
|
||||
result: dict = google_search(user_input, 5) # 5 results by default
|
||||
# summarize the results
|
||||
# TODO
|
||||
local_task_response = "Google search results:\n" + "still under development."
|
||||
local_task_response = (
|
||||
"Google search results:\n" + "still under development."
|
||||
)
|
||||
self.console.print(local_task_response + "\n", style="yellow")
|
||||
self.log_conversation("pentestGPT", local_task_response)
|
||||
return local_task_response
|
||||
|
||||
elif local_request_option == "continue":
|
||||
self.console.print("Exit the local task and continue the main task.")
|
||||
self.log_conversation("pentestGPT", "Exit the local task and continue the main task.")
|
||||
self.log_conversation(
|
||||
"pentestGPT", "Exit the local task and continue the main task."
|
||||
)
|
||||
local_task_response = "continue"
|
||||
|
||||
return local_task_response
|
||||
|
||||
|
||||
def input_handler(self) -> str:
|
||||
"""
|
||||
Request for user's input to:
|
||||
@@ -309,8 +320,14 @@ class pentestGPT:
|
||||
return response
|
||||
## (2) start local task generation.
|
||||
### (2.1) ask the reasoning session to analyze the current situation, and explain the task
|
||||
self.console.print("PentestGPT will generate more test details, and enter the sub-task generation mode. (Pressing Enter to continue)", style="bold green")
|
||||
self.log_conversation("pentestGPT", "PentestGPT will generate more test details, and enter the sub-task generation mode.")
|
||||
self.console.print(
|
||||
"PentestGPT will generate more test details, and enter the sub-task generation mode. (Pressing Enter to continue)",
|
||||
style="bold green",
|
||||
)
|
||||
self.log_conversation(
|
||||
"pentestGPT",
|
||||
"PentestGPT will generate more test details, and enter the sub-task generation mode.",
|
||||
)
|
||||
input()
|
||||
|
||||
### (2.2) pass the sub-tasks to the test generation session
|
||||
@@ -372,13 +389,13 @@ class pentestGPT:
|
||||
# pass other information, such as questions or some observations.
|
||||
elif request_option == "discuss":
|
||||
## (1) Request for user multi-line input
|
||||
self.console.print("Please share your thoughts/questions with PentestGPT. (End with <shift + right-arrow>) ")
|
||||
self.console.print(
|
||||
"Please share your thoughts/questions with PentestGPT. (End with <shift + right-arrow>) "
|
||||
)
|
||||
self.log_conversation(
|
||||
"pentestGPT", "Please share your thoughts/questions with PentestGPT."
|
||||
)
|
||||
user_input = prompt_ask(
|
||||
"Your input: ", multiline=True
|
||||
)
|
||||
user_input = prompt_ask("Your input: ", multiline=True)
|
||||
self.log_conversation("user", user_input)
|
||||
## (2) pass the information to the reasoning session.
|
||||
with self.console.status("[bold green] PentestGPT Thinking...") as status:
|
||||
@@ -399,9 +416,7 @@ class pentestGPT:
|
||||
"pentestGPT",
|
||||
"Please enter your search query. PentestGPT will summarize the info from google.",
|
||||
)
|
||||
user_input = prompt_ask(
|
||||
"Your input: ", multiline=False
|
||||
)
|
||||
user_input = prompt_ask("Your input: ", multiline=False)
|
||||
self.log_conversation("user", user_input)
|
||||
with self.console.status("[bold green] PentestGPT Thinking...") as status:
|
||||
# query the question
|
||||
|
||||
@@ -21,7 +21,9 @@ class localTaskCompleter(Completer):
|
||||
|
||||
task_meta = {
|
||||
"discuss": HTML("Discuss with <b>PentestGPT</b> about this local task."),
|
||||
"brainstorm": HTML("Let <b>PentestGPT</b> brainstorm on the local task for all the possible solutions."),
|
||||
"brainstorm": HTML(
|
||||
"Let <b>PentestGPT</b> brainstorm on the local task for all the possible solutions."
|
||||
),
|
||||
"help": HTML("Show the help page for this local task."),
|
||||
"google": HTML("Search on Google."),
|
||||
"continue": HTML("Quit the local task and continue the previous testing."),
|
||||
@@ -102,6 +104,7 @@ def main_task_entry(text="> "):
|
||||
else:
|
||||
return result
|
||||
|
||||
|
||||
def local_task_entry(text="> "):
|
||||
"""
|
||||
Entry point for the task prompt. Auto-complete
|
||||
|
||||
Reference in New Issue
Block a user