Skip to content

Commit

Permalink
v20231230
Browse files Browse the repository at this point in the history
  • Loading branch information
matebenyovszky committed Dec 30, 2023
1 parent 63d080f commit cb909f6
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 42 deletions.
9 changes: 2 additions & 7 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# CC BY-NC-SA 4.0 LEGAL CODE
## Attribution-NonCommercial-ShareAlike 4.0 International
## Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Public License

Canonical URL https://creativecommons.org/licenses/by-nc-sa/4.0/

Attribution-NonCommercial-ShareAlike 4.0 International

# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Public License

By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International Public License
Expand All @@ -18,7 +14,6 @@ Licensor grants You such rights in consideration of benefits the
Licensor receives from making the Licensed Material available under
these terms and conditions.


## Section 1 -- Definitions.

a. Adapted Material means material subject to Copyright and Similar
Expand Down
65 changes: 31 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# ClubGPT - CommandProxy
```
=*##*=
-@@@@@@@@-
@@@@@@@@@@
%@@@@@@@@% .g8"""bgd `7MM *MM .g8"bgd `7MM""Mq. MMP"MM"YMM
.---:.#@@@@@@%.:---. .dP' `M MM MM .dP' `M MM `MM.P' MM `7
-%@@@@@@*#@@@@#*@@@@@@%= dM' ` MM `7MM `7MM MM,dMMb. dM' ` MM ,M9 MM
-@@@@@@@@@@@@@@@@@@@@@@@@= MM MM MM MM MM `Mb MM MMmdM9 MM
=@@@@@@@@@@@@@@@@@@@@@@@@+ MM. MM MM MM MM M8 MM. `7MMF' MM MM
*@@@@@@@@++@@*+@@@@@@@@* `Mb. ,' MM MM MM MM. ,M9 `Mb. MM MM MM
.=***=: .@@@@. :=***=. `"bmmmd' .JMML. `Mbod"YML.P^YbmdP' `"bmdPY .JMML. .JMML.
#@@@@%
*@@@@@@#
=#**++***=
=*##*=
-@@@@@@@@-
@@@@@@@@@@
%@@@@@@@@% .g8"""bgd `7MM *MM .g8"bgd `7MM""Mq. MMP"MM"YMM
.---:.#@@@@@@%.:---. .dP' `M MM MM .dP' `M MM `MM.P' MM `7
-%@@@@@@*#@@@@#*@@@@@@%= dM' ` MM `7MM `7MM MM,dMMb. dM' ` MM ,M9 MM
-@@@@@@@@@@@@@@@@@@@@@@@@= MM MM MM MM MM `Mb MM MMmdM9 MM
=@@@@@@@@@@@@@@@@@@@@@@@@+ MM. MM MM MM MM M8 MM. `7MMF' MM MM
*@@@@@@@@++@@*+@@@@@@@@* `Mb. ,' MM MM MM MM. ,M9 `Mb. MM MM MM
.=***=: .@@@@. :=***=. `"bmmmd' .JMML. `Mbod"YML.P^YbmdP' `"bmdPY .JMML. .JMML.
#@@@@%
*@@@@@@#
=#**++***=
```
This repository provides an OpenAPI 3.1 compatible service that allows ChatGPT and other GPT models to execute commands on any computer, supporting various shells such as PowerShell, Bash, etc. Essentially, it enables remote task execution on your computer using natural language prompts.

Please note that this tool should be used with caution and at your own risk.

# Members of the ClubGPT agent tool/family
## GPT Agent group prompts
- [♣️ ClubGPT ♣️ - DevTeam](https://github.com/matebenyovszky/ClubGPT) - It's a think tank, coding companion, a developer team in one GPT
- [♣️ ClubGPT ♣️ - DreamTeam](https://github.com/matebenyovszky/ClubGPT) - amore general approach, where the AI selects team members and tools according to the task
## Agent group prompts
- [♣️ ClubGPT - DevTeam](https://github.com/matebenyovszky/ClubGPT) - It's a think tank, coding companion, a developer team in one GPT
- [♣️ ClubGPT - DreamTeam](https://github.com/matebenyovszky/ClubGPT) - a more general approach, where the AI selects team members and tools according to the task

## Workshop and Tools for the Agents
- ♣️ ClubGPT ♣️ - CommandProxy - (this repository) Enables the execution of commands and code on a remote computer.
- ♣️ ClubGPT ♣️ - Sandbox - Provides a secure environment for code execution.
- [♣️ ClubGPT ♣️ - Sandbox-ts](https://github.com/matebenyovszky/ClubGPT-Sandbox-ts) - A TypeScript version of the sandbox for code execution.
- ♣️ ClubGPT - CommandProxy - (this repository) Enables the execution of commands and code on a remote computer.
- ♣️ ClubGPT - Sandbox - Provides a secure environment for code execution.
- [♣️ ClubGPT - Sandbox-ts](https://github.com/matebenyovszky/ClubGPT-Sandbox-ts) - A TypeScript version of the sandbox for code execution.

## Overview
# Overview

This tool, in conjunction with ChatGPT Plus, allows you to execute any shell commands on a computer as an action.

Expand Down Expand Up @@ -112,34 +112,31 @@ You can execute a command on the server by making a POST request to the `/execut
curl -X POST "%URL%/execute" -H "Authorization: your_secret_api_key_here" -H "Content-Type: application/json" -d '{"command":"ls"}'
```

```powershell
# API URL
$url = '%URL%/system_info'
Samples in `powershell`:
1. Get system info:

# API Key
$headers = @{"Authorization" = "your_secret_api_key_here"}
```powershell
$url = '%URL%/system_info' # API URL
$headers = @{"Authorization" = "your_secret_api_key_here"} # API Key
$body = @{
#"serverAddress" = "optional_remote_%URL%"
#"serverAPIkey" = "optional_remote_your_secret_api_key_here"
} | ConvertTo-Json
# Send GET Request
# Send Post Request
$response = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $body -ContentType "application/json"
# Display the Response
$response
```

```powershell
# API URL
$url = '%URL%/execute'
2. Execute a command:

# API Key
$headers = @{"Authorization" = "your_secret_api_key_here"}
```powershell
$url = '%URL%/execute' # API URL
$headers = @{"Authorization" = "your_secret_api_key_here"} # API Key
# Data Payload
$body = @{
"command" = "echo Hello World!"
#"serverAddress" = "optional_remote_%URL%"
Expand All @@ -153,7 +150,7 @@ $response = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $bo
$response.stdout
```

Replace `your_secret_api_key_here` with your actual API key.
Replace `%URL%` and `your_secret_api_key_here` with your actual API key.

## Security

Expand Down
22 changes: 21 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,29 @@ def info():
@app.route('/system_info', methods=['POST'])
def system_info():

if VERBOSE == 'ON':
print()
print(f"♣️ Request: '{request}'")

# Checking the API key
api_key = request.headers.get('Authorization')

if api_key is None:
if VERBOSE == 'ON':
print('♣️ Error: No Authorization header provided')
return jsonify({'error': 'No Authorization header provided'}), 400

if api_key != API_KEY:
if VERBOSE == 'ON':
# print(f'Error: Unauthorized, API key is not matching. Provided key: {api_key}, Expected key: {API_KEY}')
print('♣️ Error: Unauthorized, API key is not matching.')
return jsonify({'error': 'Unauthorized, API key is not matching'}), 401

data = request.json
if data is None:
return jsonify({'error': 'No data provided'}), 400
if VERBOSE == 'ON':
print('♣️ Error: No data provided in request')
return jsonify({'error': 'No data provided in request'}), 400

server_address = data.get('serverAddress', None)
server_api_key = data.get('serverAPIkey', None)
Expand Down

0 comments on commit cb909f6

Please sign in to comment.