MCPcopy Index your code
hub / github.com/b23r0/cliws

github.com/b23r0/cliws @v0.3.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.1 ↗ · + Follow
78 symbols 166 edges 9 files 32 documented · 41% updated 2y agov0.3.1 · 2022-07-07★ 170
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Cliws Build Status ChatOnDiscord LastCommit Crate

Lightweight interactive bind/reverse PTY shell with Windows&Linux support implementation by Rust.

Features

  • WebSocket
  • Full pty support: VIM, SSH, readline, Ctrl+X
  • Auto set terminal window size.
  • Reverse connection / Bind port
  • Support Win10+(Windows Server 2019+) & Linux

Build & Run

$> cargo build --release

$> ./target/release/cliws

Installation

$> cargo install cliws

Usage

Bind Mode

You can run a bash and listen port at 8000

$> ./cliws -p 8000 bash -i

then connect and get a comfortable shell.

$> ./cliws -c ws://127.0.0.1:8000

Reverse Mode

First listen a port wait for shell

$> ./cliws -l 8000

then build a reverse connection

$> ./cliws -r ws://127.0.0.1:8000 bash -i

Example

Linux

image

Windows(Reverse Mode)

image

Invalid Characters

In Windows(Windows Terminal), the default CodePage encoding is UTF-8. When encountering the target of other language operating systems, invalid characters may occur. You can try the following methods to solve it.

Open Regedit and modified [Machine]\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP value is 65001(DEC).

Reference

  • https://github.com/t57root/amcsh

  • https://github.com/philippkeller/rexpect

  • https://github.com/zhiburt/conpty

  • https://securityonline.info/conptyshell-interactive-reverse-shell/

Core symbols most depended-on inside this repo

spawn
called by 24
src/conpty/mod.rs
splitword
called by 12
src/utils.rs
into
called by 10
src/conpty/io.rs
get_stdout_handle
called by 9
src/utils.rs
makeword
called by 8
src/utils.rs
read
called by 8
src/conpty/io.rs
get_termsize
called by 5
src/xnix.rs
handle_to_rawhandle
called by 4
src/utils.rs

Shape

Method 37
Function 35
Class 5
Enum 1

Languages

Rust100%

Modules by API surface

src/conpty/mod.rs34 symbols
src/conpty/io.rs12 symbols
src/xnix.rs8 symbols
src/conpty/console.rs8 symbols
src/utils.rs5 symbols
src/win.rs4 symbols
src/conpty/error.rs3 symbols
src/main.rs2 symbols
src/conpty/util.rs2 symbols

For agents

$ claude mcp add cliws \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact