mirror of
https://github.com/weyne85/PentestGPT.git
synced 2025-10-29 16:58:59 +00:00
update information
This commit is contained in:
parent
bef7ba975e
commit
a4e5361d76
@ -9,4 +9,5 @@ The goal is to build a user-friendly bridge to automate ChatGPT and other GPT mo
|
||||
|
||||
|
||||
## Examples
|
||||
1. **Get username on local PC**: `python3 example_chatgpt_api.py`
|
||||
1. **Get username on local PC**: `python3 example_chatgpt_api.py`
|
||||
2. **Use SQLMap**: `python3 example_sqlmap.py`
|
||||
0
__init__.py
Normal file
0
__init__.py
Normal file
3
config/ChatGPT_key.yaml
Normal file
3
config/ChatGPT_key.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
# depracated
|
||||
chatGPT:
|
||||
session-key: "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..2Q5MLEj0afWgLQVH.x-rNGdjtJCNbKC97n8z4Xk6akoiSmC1QoWmjWHU2IzGuhIYSwLo5KB5htrNoeghtXZdaSvyqEQe043W_rDAXf7g9fgRnve-02sbI5_1aFv1OsL-2dIL4uU7YcgRMH_z5_QaVJAiML5DrQSDZww_Rju_qXfABRwgBSdjxBXnJP6Z_xc76LpPcBeRJru5DNM-Fb7oyb0xRBw9b_uS5dfq0UGuyRFgHOtncAfiNJ-JU4qenLhrFVPbkIeko2VdW4nr2vOMUO5HnUrkrb-ENlvF8z0s5QF8fyWMTGUGFNbuYKihC7nQ3H2MU6LPzh-sXveqXNd8wjj8_FE53Rm5BMYsEUnYKUgxt8_R6ohro-xN8eR0Dgs1O-w2IJaCJxsU1saHT8DUiBs5bFXZ1jKi2eNMH0HkthRCnaIRHIk-eUJePwpoHvkeYJs8WsDrAm3FT1a366TqKOkp9Cb8Ex7qNgnpCeN8YQNsEcTCts1vSrq6zEbIljHs2LCItOnRuClbQQ08aLue88p0GJOP0Cz1Oepffp1I1EgMMQsMBF7s4Q3U8CkQJaqM6dmVWOwQ3om0112k056qTcKQyc4XRDxRqZxrIwfW2DH_VdAppDw0mbQ15Wgf9o0c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kIT3v37S5ySxrqX9TBxuOhMuSIvA5UKmBrjF1LcZ37_hRb9JgvHhrg9UhAEasta4hlw5e87b9c8QHHtj0lG37Bd5SwtBpMtvfAWsHxhXUbl7s265CCtAyLSQ9OgveDgpC31QmPodl_72OC8sM2_TwMcPXUmclc5P_vgyqFU4k0ruohFaPmq1559QLQVWD1t7P929OJpcKtDRuo3c9pyJZ9snS-NLW5I1jQObp2OY57oJEMhwvTn4U1CzPXyMNNvfJq751okgD--grRBWoUsspfe_CzYdWzl4BucFdfoPdscv6e5K8fFNNvcLcUGaI48uQRXPfT1sgneOQ79cbOaxyIYLeLAgK1NG_lxhnd2oGlnAH3dQ1BUvu1qFK4vwH8I0V9ePGohO-DwMYH1KxigXfP5V3Xo0uhZpI2WLOZ4K6OVzv7QOIcR-fI3g-L0Qua3wSh9JizpDD47gKaYh4E_RwmLIXQgT_Dp1XJ4KlztXyD7_V-tpPaKPrWDdxVAwJuhlItJMMMDTk8o8b1Zp16YGOHaosBhcxWVorOemp3MPZKADYMAHhrDpCQ0Lzzch9X2rSKR6I0Hd3ZpC4j5xKKRzuUB5B1d9bsudD6_cTUd2fCCwNlch1k_PgiBVHRhtAFcEdYF0_zM9YDG7-llG6Wf7hLZSkMOA2YkVeTH9Xm8plzqq4WsL4DzrbFNy20aCMB86LfAp0h7Sj8r8nkUxrlmY-4JKm4HdFvHkTw9uMNvl6erJixYcOKhtb7bzSWPhq4dJosa4E5iyGNvvVMVwWj3HTczEfANGstUFQWExWltirpMGGU3.aZWaogPtapGlXEgcetDwkQ"
|
||||
@ -1,35 +0,0 @@
|
||||
from chatgpt_wrapper import ChatGPT
|
||||
from llm_handle.parser import extract_cmd
|
||||
import os
|
||||
|
||||
bot = ChatGPT()
|
||||
response = bot.ask("Can you give me a sample command in Mac terminal for checking the user names? Please give me the code directly.")
|
||||
sample_response = """
|
||||
Certainly! To list all user names on a Mac using the terminal, you can use the `dscl` command with the `list` option for the `/Users` node. Here's the command:
|
||||
```
|
||||
dscl . list /Users | grep -v '^_'
|
||||
```
|
||||
|
||||
This will output a list of all user accounts on the system, excluding any system accounts that start with an underscore.
|
||||
"""
|
||||
# print("The response is:", response)
|
||||
command = extract_cmd(str(response))
|
||||
print("The command is:", command)
|
||||
|
||||
# execute the command in the mac terminal.
|
||||
# Alert!! The execution should be really careful, because it can be dangerous.
|
||||
# It is recommended to use this in a sandbox environment.
|
||||
output = os.popen(command).read()
|
||||
print("The output is:\n", output)
|
||||
# Ideally, the output should be:
|
||||
"""
|
||||
daemon
|
||||
uname
|
||||
nobody
|
||||
root"""
|
||||
|
||||
# delete the session in the end
|
||||
bot.delete_conversation()
|
||||
|
||||
|
||||
|
||||
0
task_handle/__init__.py
Normal file
0
task_handle/__init__.py
Normal file
27
task_handle/cmd_execution.py
Normal file
27
task_handle/cmd_execution.py
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
import os
|
||||
|
||||
def execute_cmd(cmd:str) -> str:
|
||||
"""
|
||||
Execute the command in the mac terminal.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
cmd: str
|
||||
The command to be executed.
|
||||
|
||||
Returns
|
||||
----------
|
||||
output: str
|
||||
The output of the command.
|
||||
"""
|
||||
# execute the command in the mac terminal.
|
||||
# Alert!! The execution should be really careful, because it can be dangerous.
|
||||
# It is recommended to use this in a sandbox environment.
|
||||
try:
|
||||
output = os.popen(cmd).read()
|
||||
except Exception as e:
|
||||
print("Error when executing command %s in terminal:" % cmd )
|
||||
print("Error is:", e)
|
||||
return False
|
||||
return output
|
||||
10
tasks/NLP_RESTAPI_Repairment.py
Normal file
10
tasks/NLP_RESTAPI_Repairment.py
Normal file
@ -0,0 +1,10 @@
|
||||
# This handle helps to translate RESTful API documentation in natural language to OpenAPI Specification 3.0
|
||||
|
||||
|
||||
|
||||
##### Functions #####
|
||||
# Get the natural language description of the RESTful API.
|
||||
|
||||
|
||||
|
||||
|
||||
0
tasks/ROS_bug_classification
Normal file
0
tasks/ROS_bug_classification
Normal file
0
tasks/__init__.py
Normal file
0
tasks/__init__.py
Normal file
35
tasks/example_chatgpt_api.py
Normal file
35
tasks/example_chatgpt_api.py
Normal file
@ -0,0 +1,35 @@
|
||||
from chatgpt_wrapper import ChatGPT
|
||||
from llm_handle.parser import extract_cmd
|
||||
from task_handle.cmd_execution import execute_cmd
|
||||
import os
|
||||
|
||||
def __main__():
|
||||
bot = ChatGPT()
|
||||
response = bot.ask("Can you give me a sample command in Mac terminal for checking the user names? Please give me the code directly.")
|
||||
sample_response = """
|
||||
Certainly! To list all user names on a Mac using the terminal, you can use the `dscl` command with the `list` option for the `/Users` node. Here's the command:
|
||||
```
|
||||
dscl . list /Users | grep -v '^_'
|
||||
```
|
||||
|
||||
This will output a list of all user accounts on the system, excluding any system accounts that start with an underscore.
|
||||
"""
|
||||
# print("The response is:", response)
|
||||
command = extract_cmd(str(response))
|
||||
print("The command is:", command)
|
||||
|
||||
# execute the command in the terminal
|
||||
output = execute_cmd(command)
|
||||
print("The output is:\n", output)
|
||||
# Ideally, the output should be:
|
||||
"""
|
||||
daemon
|
||||
uname
|
||||
nobody
|
||||
root"""
|
||||
|
||||
# delete the session in the end
|
||||
bot.delete_conversation()
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user