mirror of
https://github.com/weyne85/PentestGPT.git
synced 2025-10-29 16:58:59 +00:00
update information
This commit is contained in:
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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user