CLI tool for KVM control — thin client for serial-hid-kvm
Project description
cli-serial-hid-kvm
CLI tool for KVM control — thin client for serial-hid-kvm.
Architecture
┌──────────┐ TCP ┌─────────────────┐ USB/HDMI ┌───────────┐
│ shkvm │ ──────────────── │ serial-hid-kvm │ ──────────────── │ Target PC │
│ (CLI) │ port 9329 │ (server) │ CH9329 + Cap │ │
└──────────┘ └─────────────────┘ └───────────┘
The CLI connects to a running serial-hid-kvm server over TCP. The server handles all hardware interaction (USB HID via CH9329 and HDMI capture). OCR is performed locally by the CLI using Tesseract.
Prerequisites
- serial-hid-kvm server running with
--headless --api(or with GUI + API enabled) - Tesseract OCR installed for
ocrandexeccommands - Python 3.10+
Installation
pip install cli-serial-hid-kvm
Or for development:
git clone https://github.com/sunasaji/cli-serial-hid-kvm.git
cd cli-serial-hid-kvm
pip install -e .
Quick Start
# Start the KVM server (on the machine connected to target PC)
serial-hid-kvm --headless --api
# Use shkvm from any machine that can reach the server
shkvm info # check connection
shkvm type "ls -la{enter}" # type on target PC
shkvm capture -o screen.jpg # take screenshot
shkvm ocr # read screen text
shkvm exec "echo hello" -w 2 # run command and read output
Command Reference
Keyboard
| Command | Description |
|---|---|
shkvm type TEXT [-d MS] [-r] |
Type text with optional char delay. Supports inline tags: {enter}, {tab}, {ctrl+c}, {0xNN}. Whitelist-based: unknown {content} passes through literally. -r (raw mode) disables tags, \n → Enter |
shkvm key KEY [-m MOD] |
Send single key press. -m can be repeated: -m ctrl -m shift |
shkvm keys JSON [-d MS] |
Send key sequence from JSON array |
Mouse
| Command | Description |
|---|---|
shkvm move X Y [-r] |
Move cursor (absolute, or relative with -r) |
shkvm click [-b BUTTON] [-x X] [-y Y] |
Click (default: left) |
shkvm drag X1 Y1 X2 Y2 [-b BUTTON] |
Drag from start to end |
shkvm scroll AMOUNT |
Scroll wheel (+up, -down) |
Screen
| Command | Description |
|---|---|
shkvm capture [-o FILE] [--base64] |
Save screenshot or output base64 to stdout |
shkvm ocr |
Capture + OCR, print text to stdout |
shkvm exec CMD [-w SEC] |
Type command, Enter, wait, then OCR |
Device Management
| Command | Description |
|---|---|
shkvm info |
Show device info (JSON) |
shkvm devices |
List capture devices |
shkvm set-device DEV |
Switch capture device by index or path |
shkvm set-resolution W H |
Set capture resolution |
Global Options
| Option | Description |
|---|---|
-H, --host HOST |
KVM server host (overrides SHKVM_API_HOST) |
-p, --port PORT |
KVM server port (overrides SHKVM_API_PORT) |
Configuration
All settings can be configured via environment variables:
| Variable | Default | Description |
|---|---|---|
SHKVM_API_HOST |
127.0.0.1 |
KVM server host |
SHKVM_API_PORT |
9329 |
KVM server port |
SHKVM_OCR_CMD |
(auto-detect) | Path to Tesseract binary |
SHKVM_CAPTURE_LOG_DIR |
~/.local/share/cli-serial-hid-kvm/captures |
Capture log directory (set to empty string to disable) |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cli_serial_hid_kvm-0.1.0.tar.gz.
File metadata
- Download URL: cli_serial_hid_kvm-0.1.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b46010b0c9c36e88f28e6173c4a46c04bc0163e05510619bf96abd5aaaaa4cd
|
|
| MD5 |
9211163346f5d909cd354edc2e786ee1
|
|
| BLAKE2b-256 |
4993855b6b98ae7352df8f08cc5f0739a6ab6fb033e005ea26802891824a9570
|
Provenance
The following attestation bundles were made for cli_serial_hid_kvm-0.1.0.tar.gz:
Publisher:
release.yml on sunasaji/cli-serial-hid-kvm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cli_serial_hid_kvm-0.1.0.tar.gz -
Subject digest:
0b46010b0c9c36e88f28e6173c4a46c04bc0163e05510619bf96abd5aaaaa4cd - Sigstore transparency entry: 1066254712
- Sigstore integration time:
-
Permalink:
sunasaji/cli-serial-hid-kvm@c2df2957029a7a4bad08e31a2d3ae64eaf91b3b5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sunasaji
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c2df2957029a7a4bad08e31a2d3ae64eaf91b3b5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cli_serial_hid_kvm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cli_serial_hid_kvm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3503a583ec071c5afcc16796bea47f00ec2e11051b694e95d91ffa2d8aec1ee8
|
|
| MD5 |
878154dc9fcda8aa5c593c48a5f63ec9
|
|
| BLAKE2b-256 |
9efb76a6358020b81038ff0d4ed613a88bdd0a7d45d096dae47b304d0909c4aa
|
Provenance
The following attestation bundles were made for cli_serial_hid_kvm-0.1.0-py3-none-any.whl:
Publisher:
release.yml on sunasaji/cli-serial-hid-kvm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cli_serial_hid_kvm-0.1.0-py3-none-any.whl -
Subject digest:
3503a583ec071c5afcc16796bea47f00ec2e11051b694e95d91ffa2d8aec1ee8 - Sigstore transparency entry: 1066254789
- Sigstore integration time:
-
Permalink:
sunasaji/cli-serial-hid-kvm@c2df2957029a7a4bad08e31a2d3ae64eaf91b3b5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sunasaji
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c2df2957029a7a4bad08e31a2d3ae64eaf91b3b5 -
Trigger Event:
push
-
Statement type: