https://github.com/udhos/apishell
Run commands using APIs.
https://github.com/udhos/apishell
api cli go golang shell ssh
Last synced: about 1 month ago
JSON representation
Run commands using APIs.
- Host: GitHub
- URL: https://github.com/udhos/apishell
- Owner: udhos
- License: mit
- Created: 2020-08-07T02:14:22.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-15T01:44:13.000Z (over 4 years ago)
- Last Synced: 2024-03-17T00:42:52.326Z (11 months ago)
- Topics: api, cli, go, golang, shell, ssh
- Language: Go
- Homepage:
- Size: 72.3 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# apishell
Run commands using APIs.# Install
Make sure you have a working Go installation.
https://github.com/udhos/apishell
cd apishell
go install ./...# Quick Start
## Create certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem
## Run apid server
apid
## Use curl as client
curl -k -u admin:admin https://localhost:8080/static/
curl -k -u admin:admin -d '{"args":["ls","-al"]}' https://localhost:8080/api/exec/v1/
$ cat ls.yaml
args:
- ls
- /tmpcurl -k -u admin:admin --data-binary @ls.yaml https://localhost:8080/api/exec/v1/
# Below 'aGVsbG8K' is 'hello' encoded in base64
curl -k -u admin:admin -d '{"args":["cat"],"stdin":"aGVsbG8K"}' https://localhost:8080/api/exec/v1/## Use apictl client
```
apictl exec --stdin "hello world" wcapictl exec --stdin @/etc/passwd head
apictl exec head /etc/passwd
apictl exec -- ls -la
apictl exec -- bash -c "echo -n 12345 | wc"
```