Skip to content
Back to skills

Vnc Zotero Testing

DSecurity

Use when testing, installing, or debugging the Beaver Zotero plugin on the ManToGPU VNC desktop — screenshots, X11 mouse/keyboard input, XPI installation, restarting Zotero, reading prefs and logs, and testing LLM provider endpoints from that machine.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentspythongobashsqlnodetestingdebuggingapisecurity

Works with

  • cli
  • api

Security analysis

D50/100
  • criticalAccesses sensitive system or user directories
  • criticalDownloads and executes remote scripts — classic supply chain attack

Pro scans all 9 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add chgwan/beaver-zotero-local --skill vnc-zotero-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vnc Zotero Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vnc Zotero Testing
[![Security: D — Skills Directory](https://www.skillsdirectory.com/api/skills/chgwan-vnc-zotero-testing/badge)](https://www.skillsdirectory.com/skills/chgwan-vnc-zotero-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vnc-zotero-testing
description: Use when testing, installing, or debugging the Beaver Zotero plugin on the ManToGPU VNC desktop — screenshots, X11 mouse/keyboard input, XPI installation, restarting Zotero, reading prefs and logs, and testing LLM provider endpoints from that machine.
---

# Testing Beaver in Zotero on ManToGPU

ManToGPU runs a real, user-visible Zotero on a VNC desktop. There is no dev checkout
and no dev server: the plugin is a plain XPI install and `/beaver/test/*` endpoints
do not exist (they need a logged-in account, and local mode has none). Testing means
driving the GUI over X11 and reading prefs and logs.

## Fixed facts

- **SSH alias:** `ManToGPU` (`~/.ssh/config`).
- **VNC display:** `DISPLAY=:53099`, 1920x1080 nominal. The Zotero window size varies.
- **Zotero:** `~/.local/opt/zotero/zotero-bin`, launched by `~/.local/bin/zotero`.
- **Profile:** `~/.zotero/zotero/fdgw1hiw.default` (resolved automatically via `profiles.ini` when present). The plugin is `extensions/beaver@jlegewie.com.xpi` (the add-on ID stays upstream's on purpose).
- **Zotero HTTP:** `127.0.0.1:23119`. `/connector/ping` answers; `/beaver/test/ping` returns "No endpoint found" in local mode. That is normal, not a broken plugin.
- **Remote scratch dir:** `/tmp/bvx` on ManToGPU. Local scratch: `/tmp/bvx`.
- **Egress:** public IPv4 `202.127.205.186`. Zotero ignores the xray/mihomo proxies and connects directly.

## Rules for working there

- **It is the user's live desktop.** Check before restarting Zotero. A restart closes whatever windows or dialogs the user has open.
- **Never print API keys.** Use `getkey.py --list` to inspect configured models safely; only pipe raw `getkey.py` output into `apitest.py`.
- **Edit `prefs.js` only with Zotero closed.** Zotero rewrites it on quit and undoes edits made while it runs.

## Setup (once per session)

```bash
S=.agents/skills/vnc-zotero-testing/scripts   # from the project root
ssh ManToGPU 'mkdir -p /tmp/bvx'
scp -q "$S/xin.py" "$S/getkey.py" "$S/apitest.py" ManToGPU:/tmp/bvx/
```

The screenshot scripts (`shot.sh`, `wshot.sh`, `popup-shot.sh`) stream gzip-compressed
XWD over a single SSH call directly into `xwd2png.py` without leaving remote `.xwd` files.
They auto-discover Pillow from `BVX_PYTHON`, `python3`, or the `torch` conda env (loading
`mypy/torch` if needed). Optional environment overrides: `BVX_HOST` (`ManToGPU`),
`BVX_DISPLAY` (`:53099`), `BVX_DIR` (`/tmp/bvx`), `BVX_CONDA_ENV` (`torch`), `BVX_PYTHON`.

## Seeing the screen

No ImageMagick or `scrot` exists on ManToGPU. `xwd` captures raw frames and
`scripts/xwd2png.py` decodes them locally (reading pixel masks directly from the XWD header).

| Script | Captures | Coordinates |
|---|---|---|
| `bash $S/shot.sh NAME [x y w h] [--scale S]` | Whole root window | Screen |
| `bash $S/wshot.sh NAME [x y w h] [--scale S]` | Zotero main window only | Window-relative |
| `bash $S/popup-shot.sh NAME [x y w h] [--scale S]` | Topmost viewable menu/popup | Popup-relative |

Read the PNG at `/tmp/bvx/NAME.png` (or an explicit path ending in `.png` / containing `/`)
with the file reader. Crop and `--scale 2` to read small text.

Gotchas:

- **Root capture misses popups and some windows.** Menus are separate X windows titled "Zotero". Use `bash $S/popup-shot.sh`.
- **Colors look scrambled** (rainbow text) in some root captures due to the VNC framebuffer; window captures are cleaner.
- **Window position changes after a restart.** `wshot.sh` and `popup-shot.sh` print `window=<id> geometry=<WxH+X+Y>` (or `popup=<id> geometry=...`) to stderr so you have the `+X+Y` screen offset immediately. Add `+X+Y` to window-relative coordinates before clicking. You can also query it directly:

  ```bash
  ssh ManToGPU 'DISPLAY=:53099 xwininfo -root -tree | grep "\"Navigator\" \"Zotero\""'
  ```

## Driving input

`scripts/xin.py` sends XTEST events through `ctypes` (stdlib only, releases held modifiers on exit):

```bash
ssh ManToGPU 'DISPLAY=:53099 python3 /tmp/bvx/xin.py click:1239,105 sleep:2 key:Escape'
```

Supported commands (coordinates are absolute screen pixels):

- `move:X,Y` — move pointer
- `click:X,Y`, `rclick:X,Y`, `mclick:X,Y`, `dclick:X,Y` — left, right, middle, or double click
- `scroll:X,Y,N` — scroll at `X,Y` (`N > 0` up, `N < 0` down)
- `drag:X1,Y1,X2,Y2` — drag left button from `X1,Y1` to `X2,Y2`
- `type:TEXT` — type ASCII text (`\n`, `\t`, `\\` supported)
- `key:NAME` — press a keysym or modifier combo (`Return`, `Escape`, `Ctrl+q`, `Alt+F4`, `Shift+Tab`)
- `focus:WIN_ID` — raise and focus window ID (decimal or `0x...` hex)
- `sleep:SEC` — pause for `SEC` seconds

**Known limitation:** mouse clicks work (they open menus, switch tabs, close dialogs),
but typed text and key presses did not reach Zotero's content in testing, even with
correct focus and keymap. Do not report a typing-dependent flow (such as the `@` mention
menu) as verified from this setup. Either ask the user to type, or find a fix first.

## Installing a build and restarting

1. Build locally with Node 24, since Node 25 breaks the scaffold's logger:

   ```bash
   export PATH=$HOME/.nvm/versions/node/v24.20.0/bin:$PATH
   npm run build        # may exit 1 at the end if registry.npmjs.org is unreachable
   ```

   Check that the XPI and `update.json` in `.scaffold/build/` exist, then run
   `npx tsc --noEmit`, `npm run typecheck:core`, `npm run typecheck:ui`,
   `npm run typecheck:export` (or `typecheck:local` on the `local-mode` branch),
   and `npm run check:bundle` yourself if the build stopped before them.

2. Copy it over and swap atomically:

   ```bash
   scp -q .scaffold/build/beaver-local.xpi ManToGPU:/tmp/bvx/new.xpi
   ssh ManToGPU 'E=~/.zotero/zotero/fdgw1hiw.default/extensions; cp /tmp/bvx/new.xpi $E/.t && mv -f $E/.t $E/beaver@jlegewie.com.xpi'
   ```

3. Quit Zotero through the GUI (File, then the last item, Quit). The menu popup position depends on the window offset, so open File first and capture it with `bash $S/popup-shot.sh`. Confirm a clean exit: the process is gone and `~/Zotero/zotero.sqlite-wal` and `beaver.sqlite-wal` are 0 bytes.

4. Relaunch fully detached (a plain trailing `&` keeps the SSH call attached and times out):

   ```bash
   ssh -f ManToGPU 'cd ~ && DISPLAY=:53099 setsid nohup ~/.local/bin/zotero -ZoteroDebugText > /tmp/bvx/zotero.log 2>&1 < /dev/null &'
   ```

   Wait about 25 s, then verify the local HTTP server is up:

   ```bash
   ssh ManToGPU 'curl -sS -X POST http://127.0.0.1:23119/connector/ping'
   ```

   (HTTP 400 with a body means the server is up.)

5. **Confirm which version actually loaded.** Do not assume. `extensions.json` and `prefs.js` (`beaver.installedVersion`) lag behind the file swap and can show the old version even when the new code runs. Check the log for `Plugin version: X.Y.Z`, or check the Beaver Settings About text. A restart plus Tools, Plugins, gear, Check for Updates gives an authoritative install.

## Reading logs and prefs

Beaver log lines come in two lines: a `[Beaver Local]` tag, then the text:

```bash
ssh ManToGPU 'grep -A1 "\[Beaver Local\]" /tmp/bvx/zotero.log | grep -v "^--$" | tail -60'
```

Filter out `@jar:` stack-trace noise. Read configured models and non-secret prefs safely:

```bash
ssh ManToGPU 'python3 /tmp/bvx/getkey.py --list'
ssh ManToGPU 'grep -E "certificate_transparency|beaver\.(ctBypassHosts|installedVersion)" ~/.zotero/zotero/fdgw1hiw.default/prefs.js'
```

`getkey.py` without `--list` refuses interactive TTY output and prints compact JSON
strictly for piping into `apitest.py` (accepts `--index N`, `--match TEXT`, `--profile DIR`,
`--prefs PATH`). Zotero writes `prefs.js` a while after a change, not immediately.

## Testing the LLM provider from ManToGPU

Send the same streaming request Beaver's "Test Endpoint" sends. `apitest.py` reads the
JSON from `getkey.py`, defaults to `api_base` and `format` from that entry (override
with an explicit `URL_BASE` or `--format anthropic|openai`), and passes the key and body
through `curl -K -` stdin so secrets never appear in `argv`:

```bash
ssh ManToGPU 'python3 /tmp/bvx/getkey.py | python3 /tmp/bvx/apitest.py'
ssh ManToGPU 'python3 /tmp/bvx/getkey.py --match openrouter | python3 /tmp/bvx/apitest.py https://HOST:PORT -x http://127.0.0.1:50808'
```

It prints the endpoint URL, format, `curl` exit code, certificate verdict (`ssl_verify=0`
is good), and the model's streamed reply, while redacting non-empty keys from stdout and stderr.

Reading the result:

- **Timeout with `rc 28` and no TLS:** ManToGPU cannot reach the host. Check the server's firewall and cloud security group against `202.127.205.186`. Confirm with:

  ```bash
  ssh ManToGPU "timeout 8 bash -c 'exec 3<>/dev/tcp/HOST/PORT'"
  ```

- **Connects but Zotero says "NetworkError":** a certificate problem. Zotero 10 runs Firefox 140, which rejects Let's Encrypt IP-address certificates through Certificate Transparency. Beaver 0.25.6 and later exempt IP endpoints. Compare `curl` (passes) with Zotero (fails) to tell it apart from a network problem.
- **200 with a streamed reply:** endpoint and key are good.

Endpoints already seen: `https://146.56.207.178:58808` is reachable and works;
`https://43.161.196.229:58808` is blocked from ManToGPU by that server's firewall.

## Reaching the other servers

`ssh -J TxNj wan@TxHk` logs in to `43.161.196.229`. The plain `TxHk` alias uses a
nologin account and fails with "This account is currently not available". The `wan`
user has no sudo, so firewall changes there need the cloud console or the owner.

## What this setup has not verified

State these plainly rather than claiming a pass: the `@` mention fix attaching a
PDF on screen, and any flow that needs typed input.

Files in this skill

  • SKILL.md9.5 KB
  • scripts/_common.sh2 KB
  • scripts/apitest.py8.3 KB
  • scripts/getkey.py7.1 KB
  • scripts/popup-shot.sh1.5 KB
  • scripts/shot.sh621 B
  • scripts/wshot.sh1.3 KB
  • scripts/xin.py12.4 KB
  • scripts/xwd2png.py6.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.