一款单文件静态链接版Web Terminal

· 2026-11-21 21:20 · 2 阅读

原创 沈沉舟 2026-11-21 21:20 北京

看这东西不像是好人用的,估计搞渗透的用得多。

创建: 2026-11-21 21:04
链接: https://scz.617.cn/network/202611212104.txt

最近遇上个有意思的东西,ttyd

https://github.com/tsl0922/ttyd

12.7K的星,用户众多。ttyd是个Web Terminal,通过HTTP协议提供伪终端(pty)支持,可在其中使用vi。

$ ttyd --help
ttyd is a tool for sharing terminal over the web
USAGE:
    ttyd [options] <command> [<arguments...>]
VERSION:
    1.7.7-40e79c7
OPTIONS:
    -p, --port              Port to listen (default: 7681, use `0` for random port)
    -i, --interface         Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)
    -U, --socket-owner      User owner of the UNIX domain socket file, when enabled (eg: user:group)
    -c, --credential        Credential for basic authentication (format: username:password)
    -H, --auth-header       HTTP Header name for auth proxy, this will configure ttyd to let a HTTP reverse proxy handle authentication
    -u, --uid               User id to run with
    -g, --gid               Group id to run with
    -s, --signal            Signal to send to the command when exit it (default: 1, SIGHUP)
    -w, --cwd               Working directory to be set for the child program
    -a, --url-arg           Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)
    -W, --writable          Allow clients to write to the TTY (readonly by default)
    -t, --client-option     Send option to client (format: key=value), repeat to add more options
    -T, --terminal-type     Terminal type to report, default: xterm-256color
    -O, --check-origin      Do not allow websocket connection from different origin
    -m, --max-clients       Maximum clients to support (default: 0, no limit)
    -o, --once              Accept only one client and exit on disconnection
    -q, --exit-no-conn      Exit on all clients disconnection
    -B, --browser           Open terminal with the default system browser
    -I, --index             Custom index.html path
    -b, --base-path         Expected base path for requests coming from a reverse proxy (eg: /mounted/here, max length: 128)
    -P, --ping-interval     Websocket ping interval(sec) (default: 5)
    -6, --ipv6              Enable IPv6 support
    -S, --ssl               Enable SSL
    -C, --ssl-cert          SSL certificate file path
    -K, --ssl-key           SSL key file path
    -A, --ssl-ca            SSL CA file path for client certificate verification
    -d, --debug             Set log level (default: 7)
    -v, --version           Print the version and exit
    -h, --help              Print this text and exit

Ubuntu中可apt安装,我遇上的环境,apt安装只有1.7.4,而github上有1.7.7。

apt update
apt install -y ttyd

什么场景用得上呢?比如有个站,它只暴露了HTTP和HTTPS,沿线设备层层设访,只转发这两种协议,不是只转发80、443/TCP,这是两个概念。你想在目标站上用全功能shell,带伪终端,就像是SSH登录上去一样。ttyd就派上用场了。它有单文件静态链接版。假设ttyd已经目标站上运行,从你本地的浏览器访问暴露在公网上的URL,在浏览器窗口中将获得带伪终端的全功能shell,真香。

看这东西不像是好人用的,估计搞渗透的用得多。我不擅此道,第一次遇上,叹为观止。想说too old的,请开始你的表演。

阅读原文

跳转微信打开

本文转载自微信公众号「青衣十三楼飞花堂」,查看原文。版权归原作者所有,如有侵权请联系删除。