天涼好個秋.

Shell in a box

2119 阅 0 评 Hiwifi

Shell in a box

Shell In A Box implements a web server that can export arbitrary command line tools to a web based terminal emulator. This emulator is accessible to any JavaScript and CSS enabled web browser and does not require any additional browser plugins.

效果截图

一键安装脚本

curl -ko /tmp/shellinabox.ipk https://cdn.stray.love//hiwifi/shell-in-a-box/shellinabox_2.10-1_ralink.ipk; opkg install /tmp/shellinabox.ipk;rm -rf /tmp/shellinabox.ipk

usage

Usage: shellinaboxd [OPTIONS]...
Starts an HTTP server that serves terminal emulators to AJAX enabled browsers.

List of command line options:
  -b, --background[=PIDFILE]  run in background
      --css=FILE              attach contents to CSS style sheet
      --cgi[=PORTMIN-PORTMAX] run as CGI
  -d, --debug                 enable debug mode
  -f, --static-file=URL:FILE  serve static file from URL path
  -g, --group=GID             switch to this group (default: nogroup)
  -h, --help                  print this message
      --linkify=[none|normal|agressive] default is "normal"
      --localhost-only        only listen on 127.0.0.1
      --no-beep               suppress all audio output
  -n, --numeric               do not resolve hostnames
  -p, --port=PORT             select a port (default: 4200)
  -s, --service=SERVICE       define one or more services
  -q, --quiet                 turn off all messages
  -u, --user=UID              switch to this user (default: nobody)
      --user-css=STYLES       defines user-selectable CSS options
  -v, --verbose               enable logging messages
      --version               prints version information

Debug, quiet, and verbose are mutually exclusive.

One or more --service arguments define services that should be made available
through the web interface:
  SERVICE := <url-path> ':' APP
  APP     := 'LOGIN' | 'SSH' [ : <host> ] | USER ':' CWD ':' <cmdline>
  USER    := <username> ':' <groupname>
  CWD     := 'HOME' | <dir>

<cmdline> supports variable expansion:
  ${columns} - number of columns
  ${gid}     - gid id
  ${group}   - group name
  ${home}    - home directory
  ${lines}   - number of rows
  ${peer}    - name of remote peer
  ${uid}     - user id
  ${url}     - the URL that serves the terminal session
  ${user}    - user name

One or more --user-css arguments define optional user-selectable CSS options.
These options show up in the right-click context menu:
  STYLES  := GROUP { ';' GROUP }*
  GROUP   := OPTION { ',' OPTION }*
  OPTION  := <label> ':' [ '-' | '+' ] <css-file>

OPTIONs that make up a GROUP are mutually exclusive. But individual GROUPs are
independent of each other.

启动命令

shellinaboxd  -t --service=/:root:root:HOME:/bin/ash --css /usr/lib/shellinabox/style.css

以后台方式运行

shellinaboxd  -t --service=/:root:root:HOME:/bin/ash --css /usr/lib/shellinabox/style.css -b

停止命令

killall shellinaboxd

查看效果

打开浏览器输入
路由器lanip:4200
例如:192.168.199.1:4200

其他

由于 openwrt 的 SSH 为 dropbear,不支持auth,不支持使用 ID、password 登陆。出于安全考虑,请勿将 Shell in a box 的默认端口暴露到互联网。
另:仅在极路由(Hiwifi OS)测试可用,理论可以运行在所有 mipsel 架构的 openwrt 上。

尾巴

懒到连 putty 都懒得打开,好吧!那我们找个方法用浏览器试试吧~

EOF