You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-6Lines changed: 11 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# PentestGPT
2
-
v0.1, 09/04/2023
2
+
v0.2, 12/04/2023
3
3
4
4
## Introduction
5
5
**PentestGPT** is a penetration testing tool empowered by **ChatGPT**. It is designed to automate the penetration testing process. It is built on top of ChatGPT and operate in an interactive mode to guide penetration testers in both overall progress and specific operations.
@@ -15,14 +15,13 @@ The project is still in its early stage. Feel free to raise any issues when usin
15
15
16
16
17
17
18
-
## Examples
18
+
## Usage
19
19
1. To start, run `python3 main.py`.
20
20
2. The tool works similar to *msfconsole*. Follow the guidance to perform penetration testing.
21
+
3. In general, PentestGPT intakes commands similar to chatGPT.
22
+
- To intake multi-line inputs in the terminal, please use <Enter> for new line, and <Shift+Right-Arror> to submit the input.
23
+
- The selection bar allows you to select a pre-defined options.
21
24
22
-
## Development
23
-
-[x] Add chunk processing (04/03/2023)
24
-
-[ ] Add prompt optimization
25
-
-[ ] Test scenarios beyond web testing
26
25
27
26
## Design Documentation
28
27
The current design is mainly for web penetration testing
@@ -43,8 +42,14 @@ The handler is the main entry point of the penetration testing tool. It allows p
43
42
2. Pass a webpage content.
44
43
3. Pass a human description.
45
44
45
+
## Update history
46
+
### v0.2
47
+
- A major update to improve the terminal usage
48
+
- Prompt optimization.
49
+
46
50
47
51
### System Design
52
+
More details in `PentestGPT_design.md`.
48
53
49
54
#### Logic Flow Design
50
55
1. User initializes all the sessions. (**prompt**)
Copy file name to clipboardExpand all lines: prompts/prompt_class.py
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ class PentestGPTPrompt:
19
19
1. Decide to remove some tasks if they are considered as completed.
20
20
2. Decide to add a new task if there's something interesting.
21
21
3. Give scores to each subtasks, showing if it can lead to a potential vulnerability.
22
-
4. Recommend what to do next based on the scores when asked about to-do, listed in sequence as 1, 2, 3, ...
22
+
4. Add a dividing line (--------). Then recommend what to do next based on the scores when asked about to-do, listed in sequence as 1, 2, 3, ...
23
23
Note that you should keep the tasks clear, precise and short due to token size limit. You should remember to remove redundant/outdated tasks due to the same reason.
24
24
I'll provide the general penetration test information to you shortly."""
25
25
input_parsing_init: str="""I want you to be a help penetration testers for penetration testing by summarizing the contents from the web pages and security tools outputs. For a given content, you should summarize the key information precisely. In particular,
@@ -36,14 +36,15 @@ class PentestGPTPrompt:
36
36
You should provide it in a way as if you're asking another penetration tester to execute it. You should always provide the concrete IP address as target"""
37
37
38
38
process_results: str="""Here's the test summary from the penetration tester. Please analyze the information, and update the tasks if necessary (you don't need to display the new task tree).
39
-
After this, please give one task for the tester to do next.\n"""
39
+
After this, please give one task for the tester to do next.\n\n"""
40
40
41
41
ask_todo: str="""Please think about the previous information step by step, and analyze the information.
42
42
Then, please list the most possible sub-tasks (no more than 2) that you think we should proceed to work on next."""
43
43
44
-
discussion: str="""The tester provides the following thoughts for your consideration. Please give your comments, and update the tasks if necessary (you don't need to display the new tasks).\n"""
44
+
discussion: str="""The tester provides the following thoughts for your consideration. Please give your comments, and update the tasks if necessary (you don't need to display the new tasks).\n\n"""
45
45
46
46
# generation session
47
47
todo_to_command: str="""You're asked to explain the following tasks to a junior penetration tester.
48
-
Please provide the command to execute, or the GUI operations to perform. You should always provide the concrete IP address as target.
49
-
If it is a single command to execute, please be precise; if it is a multi-step task, you need to explain it step by step, and keep each step clear and simple."""
48
+
You're provided with a long input from the supervisor GPT model. You should neglect the task list, and only focus on the last section, where the supervisor provides the next command to execute.
49
+
Please extend the command to execute, or the GUI operations to perform, so that a junior penetration tester can understand. You should always provide the concrete IP address as target.
50
+
If it is a single command to execute, please be precise; if it is a multi-step task, you need to explain it step by step, and keep each step clear and simple. The information is below: \n\n"""
The continuation: display line numbers and '->' before soft wraps.
20
+
Notice that we can return any kind of formatted text from here.
21
+
The prompt continuation doesn't have to be the same width as the prompt
22
+
which is displayed before the first line, but in this example we choose to
23
+
align them. The `width` input that we receive here represents the width of
24
+
the prompt.
25
+
"""
26
+
ifwrap_count>0:
27
+
return" "* (width-3) +"-> "
28
+
else:
29
+
text= ("- %i - "% (line_number+1)).rjust(width)
30
+
returnHTML("<strong>%s</strong>") %text
31
+
32
+
16
33
classpentestGPT:
17
34
postfix_options= {
18
-
"default": "The user did not specify the input source. You need to summarize based on the contents.\n",
19
-
"user-comments": "The input content is from user comments.\n",
20
35
"tool": "The input content is from a security testing tool. You need to list down all the points that are interesting to you; you should summarize it as if you are reporting to a senior penetration tester for further guidance.\n",
36
+
"user-comments": "The input content is from user comments.\n",
21
37
"web": "The input content is from web pages. You need to summarize the readable-contents, and list down all the points that can be interesting for penetration testing.\n",
38
+
"default": "The user did not specify the input source. You need to summarize based on the contents.\n",
0 commit comments