https://github.com/eoli3n/shellcast
Easy expose shell as interfaced webservices
https://github.com/eoli3n/shellcast
command-line command-line-interface expose frontend frontend-infra frontend-web generator highlight nodejs realtime shell socket-io stream webservice yml
Last synced: 5 months ago
JSON representation
Easy expose shell as interfaced webservices
- Host: GitHub
- URL: https://github.com/eoli3n/shellcast
- Owner: eoli3n
- Created: 2018-01-10T16:08:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-01-11T11:30:43.000Z (6 months ago)
- Last Synced: 2025-01-11T12:29:41.197Z (6 months ago)
- Topics: command-line, command-line-interface, expose, frontend, frontend-infra, frontend-web, generator, highlight, nodejs, realtime, shell, socket-io, stream, webservice, yml
- Language: JavaScript
- Homepage:
- Size: 21.5 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ShellCast
A node app to stream multiple shell output realtime with args and highlighting.
## Config
See [config-sample.yml](config-sample.yml)
### Rainbow
[tests/rainbow.sh](tests/rainbow.sh)
#### Console
http://localhost:3000/shellcast/rainbow
#### Plain
```bash
curl -s "http://localhost:3000/shellcast/rainbow/plain"
```
### Args
[tests/args.sh](tests/args.sh)
#### Console
http://localhost:3000/shellcast/args/test?hostname=foo&ip=10.0.0.1&mac=00:11:22:33:44:55&password=suburlpass

#### Plain
```bash
curl -s "http://localhost:3000/shellcast/args/test/plain?hostname=foo&ip=10.0.0.1&mac=00:11:22:33:44:55&password=suburlpass"
```
## Installation
```
git clone https://github.com/eoli3n/shellcast
cd shellcast
npm install
cp config-sample.yml config.yml
```
## Run
```
SUBDIR=shellcast NODE_PORT=3000 node shellcast.js config.yml
```### Reverse proxy with nginx
```
mkdir -p /opt/shellcast
#install
```
```
cat << EOF > /etc/nginx/sites-available/shellcast
server {
root /var/www/html;
listen 443 ssl;ssl_certificate /etc/ssl/cert.crt
ssl_certificate_key /etc/ssl/cert.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!ADH:!MD5;
ssl_prefer_server_ciphers on;# use SUBDIR here
location /shellcast/ {
add_header Access-Control-Allow-Origin *;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# use NODE_PORT here
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_temp_path /tmp/data;
}
}
EOF
``````
ln -s /etc/nginx/sites-available/shellcast /etc/nginx/sites-enabled/shellcast
systemctl restart nginx
```### Start NodeJS app with systemd
Create a service file in /etc/systemd/system/shellcast.service```
[Unit]
Description=shellcast.js
After=network.target[Service]
Type=simple
ExecStartPost=/bin/sh -c 'umask 022; pgrep node > /var/run/shellcast.pid'
Environment=NODE_PORT=3000
Environment=SUBDIR=shellcast
WorkingDirectory=/opt/shellcast
User=root
ExecStart=/usr/bin/node /opt/shellcast/shellcast.js /opt/shellcast/config.yml
Restart=on-failure[Install]
WantedBy=multi-user.target
```