A single-binary CLI tool for VNC screen capture, keyboard input, and mouse operations. Designed for automating VM consoles via Claude Code.
Download a prebuilt binary from GitHub Releases:
# Example: Linux amd64
curl -Lo vncprobe "https://github.com/tjst-t/vncprobe/releases/latest/download/vncprobe-$(curl -sL https://api.github.com/repos/tjst-t/vncprobe/releases/latest | grep -oP '\"tag_name\": \"\K[^\"]+' )-linux-amd64"
chmod +x vncprobe
sudo mv vncprobe /usr/local/bin/Or install with go install:
go install github.com/tjst-t/vncprobe@latestOr build from source:
git clone https://github.com/tjst-t/vncprobe.git
cd vncprobe
go build -o vncprobe .vncprobe <command> [options]
Commands:
capture Capture screen to PNG
key Send key input
type Type a string
click Mouse click
move Mouse move
wait Wait for screen change or stability
session Manage persistent VNC sessions
Global Options:
-s, --server VNC server address (required unless --socket is used)
-p, --password VNC password
--timeout Connection timeout in seconds (default: 10)
--socket Use session socket instead of direct connection
vncprobe capture -s 10.0.0.1:5900 -o screen.png# Single key
vncprobe key -s 10.0.0.1:5900 enter
# Modifier combinations
vncprobe key -s 10.0.0.1:5900 ctrl-c
vncprobe key -s 10.0.0.1:5900 alt-f4
vncprobe key -s 10.0.0.1:5900 ctrl-alt-deleteSupported keys: enter, tab, escape, backspace, delete, space, up, down, left, right, home, end, pageup, pagedown, insert, f1-f12
Modifiers: ctrl, alt, shift, super, meta
vncprobe type -s 10.0.0.1:5900 "show interfaces"# Left click (default)
vncprobe click -s 10.0.0.1:5900 400 300
# Right click
vncprobe click -s 10.0.0.1:5900 --button 3 400 300Button numbers: 1 = left, 2 = middle, 3 = right
vncprobe move -s 10.0.0.1:5900 400 300Wait until the screen changes from its initial state:
vncprobe wait change -s 10.0.0.1:5900 --max-wait 30 --interval 1 --threshold 0.01Wait until the screen stays unchanged for a given duration (useful for animations or progress bars):
vncprobe wait stable -s 10.0.0.1:5900 --duration 3 --max-wait 60 --interval 1Options for wait change and wait stable:
| Option | Default | Description |
|---|---|---|
--max-wait |
30 | Maximum wait time in seconds |
--interval |
1 | Polling interval in seconds |
--threshold |
0.01 | Pixel difference ratio (0.0-1.0) |
--duration |
(required for stable) |
Required stable duration in seconds |
Keep a VNC connection open and reuse it across multiple commands:
# Start a session (runs in foreground; use & for background)
vncprobe session start -s 10.0.0.1:5900 --socket /tmp/vncprobe.sock &
# Run commands via the session (no -s needed)
vncprobe capture --socket /tmp/vncprobe.sock -o screen.png
vncprobe key --socket /tmp/vncprobe.sock enter
vncprobe type --socket /tmp/vncprobe.sock "show interfaces"
vncprobe wait change --socket /tmp/vncprobe.sock
# Stop the session
vncprobe session stop --socket /tmp/vncprobe.sockOptions for session start:
| Option | Default | Description |
|---|---|---|
--socket |
(required) | UNIX socket path |
--idle-timeout |
300 | Auto-shutdown after N seconds of inactivity (0 to disable) |
Add the following to your project's CLAUDE.md so Claude Code knows how to use vncprobe. Replace the server address and socket path with your environment's values; <file>, <key>, etc. are parameters that Claude Code fills in at each invocation:
## Tools
vncprobe is available at /usr/local/bin/vncprobe.
Use it to interact with VM consoles via VNC.
- `vncprobe capture -s 10.0.0.1:5900 -o <file>` — Take a screenshot (PNG)
- `vncprobe key -s 10.0.0.1:5900 <key>` — Send key (e.g. enter, ctrl-c, f2)
- `vncprobe type -s 10.0.0.1:5900 "<text>"` — Type a string
- `vncprobe click -s 10.0.0.1:5900 <x> <y>` — Left click at coordinates
- `vncprobe move -s 10.0.0.1:5900 <x> <y>` — Move mouse
- `vncprobe wait change -s 10.0.0.1:5900` — Wait until screen changes
- `vncprobe wait stable -s 10.0.0.1:5900 --duration <sec>` — Wait until screen stops changing
- `vncprobe session start -s 10.0.0.1:5900 --socket /tmp/vnc.sock` — Start persistent session
- `vncprobe session stop --socket /tmp/vnc.sock` — Stop session
When using a session, pass `--socket /tmp/vnc.sock` instead of `-s 10.0.0.1:5900` for all commands.vncprobe session start -s 10.0.0.1:5900 --socket /tmp/vnc.sock &vncprobe capture --socket /tmp/vnc.sock -o screen.png— take a screenshot- Claude Code reads the PNG and recognizes the current screen (e.g. BIOS main menu)
vncprobe key --socket /tmp/vnc.sock f2— navigate to a menu itemvncprobe wait change --socket /tmp/vnc.sock— wait for the screen to updatevncprobe capture --socket /tmp/vnc.sock -o screen.png— verify the result- Repeat steps 3-6 until the desired configuration is applied
vncprobe session stop --socket /tmp/vnc.sock
vncprobe session start -s 10.0.0.1:5900 --socket /tmp/vnc.sock &vncprobe capture --socket /tmp/vnc.sock -o screen.png— read current promptvncprobe type --socket /tmp/vnc.sock "show interfaces"thenvncprobe key --socket /tmp/vnc.sock entervncprobe wait stable --socket /tmp/vnc.sock --duration 2— wait for output to finishvncprobe capture --socket /tmp/vnc.sock -o screen.png— read the output- Claude Code analyzes the output and decides the next command
- Repeat steps 3-6
vncprobe session stop --socket /tmp/vnc.sock
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Argument/usage error |
| 2 | Connection error |
| 3 | Operation error (includes timeout for wait) |
All tests run offline using a built-in fake VNC server. No external VNC server required.
go test ./...vncprobe/
├── main.go # Entry point, subcommand dispatch
├── e2e_test.go # End-to-end tests
├── cmd/ # CLI command handlers
│ ├── root.go # Global flag parsing, usage
│ ├── capture.go # capture command
│ ├── key.go # key command
│ ├── typecmd.go # type command
│ ├── click.go # click command
│ ├── move.go # move command
│ ├── wait.go # wait command
│ └── session.go # session command
├── vnc/ # VNC client logic
│ ├── client.go # VNCClient interface
│ ├── realclient.go # kward/go-vnc implementation
│ ├── keymap.go # Key name to keysym mapping
│ ├── input.go # Key/mouse input helpers
│ ├── capture.go # Screenshot capture + PNG save
│ ├── compare.go # Image comparison (DiffRatio)
│ └── wait.go # WaitForChange, WaitForStable
├── session/ # Session server/client
│ ├── protocol.go # Request/Response types
│ ├── server.go # UNIX socket server
│ └── client.go # UNIX socket client
├── testutil/ # Test infrastructure
│ └── fakeserver.go # Fake RFB 003.008 server
└── testdata/
└── expected.png # Test image (64x64)
VNC経由で画面キャプチャ・キー入力・マウス操作を行う単独バイナリのCLIツール。Claude CodeによるVMコンソールなどの自動操作用。
GitHub Releases からビルド済みバイナリをダウンロード:
# 例: Linux amd64
curl -Lo vncprobe "https://github.com/tjst-t/vncprobe/releases/latest/download/vncprobe-$(curl -sL https://api.github.com/repos/tjst-t/vncprobe/releases/latest | grep -oP '\"tag_name\": \"\K[^\"]+' )-linux-amd64"
chmod +x vncprobe
sudo mv vncprobe /usr/local/bin/go install でインストール:
go install github.com/tjst-t/vncprobe@latestソースからビルドする場合:
git clone https://github.com/tjst-t/vncprobe.git
cd vncprobe
go build -o vncprobe .vncprobe <command> [options]
Commands:
capture 画面キャプチャしてPNGで保存
key キー入力を送信
type 文字列をタイプ
click マウスクリック
move マウス移動
wait 画面変化の待機
session VNCセッション管理
Global Options:
-s, --server VNCサーバアドレス(--socket未使用時は必須)
-p, --password VNCパスワード
--timeout 接続タイムアウト秒数(デフォルト: 10)
--socket セッションソケット経由で接続
vncprobe capture -s 10.0.0.1:5900 -o screen.png# 単一キー
vncprobe key -s 10.0.0.1:5900 enter
# 修飾キーの組み合わせ
vncprobe key -s 10.0.0.1:5900 ctrl-c
vncprobe key -s 10.0.0.1:5900 alt-f4
vncprobe key -s 10.0.0.1:5900 ctrl-alt-delete対応キー: enter, tab, escape, backspace, delete, space, up, down, left, right, home, end, pageup, pagedown, insert, f1-f12
修飾キー: ctrl, alt, shift, super, meta
vncprobe type -s 10.0.0.1:5900 "show interfaces"# 左クリック(デフォルト)
vncprobe click -s 10.0.0.1:5900 400 300
# 右クリック
vncprobe click -s 10.0.0.1:5900 --button 3 400 300ボタン番号: 1 = 左, 2 = 中, 3 = 右
vncprobe move -s 10.0.0.1:5900 400 300画面が変化するまで待機:
vncprobe wait change -s 10.0.0.1:5900 --max-wait 30 --interval 1 --threshold 0.01画面が一定時間変化しなくなるまで待機(アニメーションやプログレスバーの完了待ち):
vncprobe wait stable -s 10.0.0.1:5900 --duration 3 --max-wait 60 --interval 1wait change / wait stable 共通オプション:
| オプション | デフォルト | 説明 |
|---|---|---|
--max-wait |
30 | 最大待機時間(秒) |
--interval |
1 | ポーリング間隔(秒) |
--threshold |
0.01 | 差分ピクセル割合の閾値(0.0〜1.0) |
--duration |
(stableでは必須) |
安定と判定する連続時間(秒) |
VNC接続を維持して複数コマンドで再利用:
# セッション開始(フォアグラウンド実行。バックグラウンドにするには & を付ける)
vncprobe session start -s 10.0.0.1:5900 --socket /tmp/vncprobe.sock &
# セッション経由でコマンド実行(-s 不要)
vncprobe capture --socket /tmp/vncprobe.sock -o screen.png
vncprobe key --socket /tmp/vncprobe.sock enter
vncprobe type --socket /tmp/vncprobe.sock "show interfaces"
vncprobe wait change --socket /tmp/vncprobe.sock
# セッション終了
vncprobe session stop --socket /tmp/vncprobe.socksession start のオプション:
| オプション | デフォルト | 説明 |
|---|---|---|
--socket |
(必須) | UNIXソケットパス |
--idle-timeout |
300 | 無操作時の自動終了秒数(0で無効) |
プロジェクトの CLAUDE.md に以下を追加すると、Claude Code が vncprobe を使えるようになります。サーバアドレスとソケットパスは環境に合わせて書き換えてください。<file> や <key> 等は呼び出し時に Claude Code が埋めるパラメータです:
## Tools
vncprobe is available at /usr/local/bin/vncprobe.
Use it to interact with VM consoles via VNC.
- `vncprobe capture -s 10.0.0.1:5900 -o <file>` — スクリーンショット(PNG)
- `vncprobe key -s 10.0.0.1:5900 <key>` — キー送信(例: enter, ctrl-c, f2)
- `vncprobe type -s 10.0.0.1:5900 "<text>"` — 文字列入力
- `vncprobe click -s 10.0.0.1:5900 <x> <y>` — 座標クリック
- `vncprobe move -s 10.0.0.1:5900 <x> <y>` — マウス移動
- `vncprobe wait change -s 10.0.0.1:5900` — 画面変化を待機
- `vncprobe wait stable -s 10.0.0.1:5900 --duration <sec>` — 画面安定を待機
- `vncprobe session start -s 10.0.0.1:5900 --socket /tmp/vnc.sock` — セッション開始
- `vncprobe session stop --socket /tmp/vnc.sock` — セッション終了
セッション使用時は -s 10.0.0.1:5900 の代わりに --socket /tmp/vnc.sock を指定。vncprobe session start -s 10.0.0.1:5900 --socket /tmp/vnc.sock &vncprobe capture --socket /tmp/vnc.sock -o screen.png— スクリーンショット取得- Claude Code が PNG を読み、画面の状態を認識(例: BIOSメインメニュー)
vncprobe key --socket /tmp/vnc.sock f2— メニュー操作vncprobe wait change --socket /tmp/vnc.sock— 画面変化を待つvncprobe capture --socket /tmp/vnc.sock -o screen.png— 結果を確認- 目的の設定が完了するまでステップ3〜6を繰り返す
vncprobe session stop --socket /tmp/vnc.sock
vncprobe session start -s 10.0.0.1:5900 --socket /tmp/vnc.sock &vncprobe capture --socket /tmp/vnc.sock -o screen.png— 現在のプロンプトを確認vncprobe type --socket /tmp/vnc.sock "show interfaces"→vncprobe key --socket /tmp/vnc.sock entervncprobe wait stable --socket /tmp/vnc.sock --duration 2— 出力完了を待つvncprobe capture --socket /tmp/vnc.sock -o screen.png— 出力結果を読み取る- Claude Code が出力を分析し、次のコマンドを決定
- ステップ3〜6を繰り返す
vncprobe session stop --socket /tmp/vnc.sock
| コード | 意味 |
|---|---|
| 0 | 成功 |
| 1 | 引数・使用方法エラー |
| 2 | 接続エラー |
| 3 | 操作エラー(wait のタイムアウトを含む) |
全テストは内蔵のフェイクVNCサーバを使用しオフラインで実行可能。外部VNCサーバ不要。
go test ./...vncprobe/
├── main.go # エントリポイント、サブコマンド振り分け
├── e2e_test.go # E2Eテスト
├── cmd/ # CLIコマンドハンドラ
│ ├── root.go # グローバルフラグ解析、ヘルプ表示
│ ├── capture.go # captureコマンド
│ ├── key.go # keyコマンド
│ ├── typecmd.go # typeコマンド
│ ├── click.go # clickコマンド
│ ├── move.go # moveコマンド
│ ├── wait.go # waitコマンド
│ └── session.go # sessionコマンド
├── vnc/ # VNCクライアントロジック
│ ├── client.go # VNCClientインターフェース
│ ├── realclient.go # kward/go-vnc実装
│ ├── keymap.go # キー名→keysymマッピング
│ ├── input.go # キー・マウス入力ヘルパー
│ ├── capture.go # スクリーンキャプチャ・PNG保存
│ ├── compare.go # 画像比較(DiffRatio)
│ └── wait.go # WaitForChange, WaitForStable
├── session/ # セッションサーバ/クライアント
│ ├── protocol.go # Request/Response型定義
│ ├── server.go # UNIXソケットサーバ
│ └── client.go # UNIXソケットクライアント
├── testutil/ # テストインフラ
│ └── fakeserver.go # フェイクRFB 003.008サーバ
└── testdata/
└── expected.png # テスト用画像(64x64)