pyTextFilter is a tool that allows you to edit text files on a remote machine using your favorite local text editor.
This project was originally inspired by TextEditAid, a now-defunct Google Chrome extension that allowed editing textarea contents in an external editor.
Note
The TextEditAid extension is no longer maintained or available. This project is no longer relevant to that extension.
Today, pyTextFilter is a standalone utility for seamless remote text editing.
The system consists of a local server and a remote client:
- Remote Client: You run a script (
edit-clientoreditclient.js) on the remote machine (e.g., via SSH or in a VM). - Send: The client sends the file content to the
pytextfilterserver running on your local machine. - Edit: The local server spawns your configured text editor with the content.
- Update: Once you save and close the editor, the modified content is sent back to the remote client.
- Overwrite: The remote client overwrites the original file with the changes.
- Server:
pytextfilter.py(Runs on your local machine) - Linux Client:
edit-client(Shell script for Linux SSH servers) - Legacy Windows Client:
editclient.js(WSH script for older Windows versions, e.g., Windows 98, where PowerShell is unavailable)
Important
No Authentication: pytextfilter involves NO permission checks or access
control. Anyone who can connect to the port can read/write files through your
editor.
It is strongly recommended to configure pytextfilter to listen only on
127.0.0.1 (localhost). Do not configure it to listen on 0.0.0.0 (all
interfaces) unless you completely trust the network.
Since the server listens on 127.0.0.1, you need to forward the port so the
remote client can reach your local machine.
- SSH Remote Forwarding: Use the
-Roption (orRemoteForwardin~/.ssh/config) to map the remote's port 31416 back to your local port 31416.- Command:
ssh -R 31416:127.0.0.1:31416 user@hostname - Config: Add
RemoteForward 31416 127.0.0.1:31416to your host configuration.
- Command:
If you are using QEMU with User Mode Networking to run Windows (e.g.,
Windows 98), the guest OS shares the host's network stack. You usually do not
need special port forwarding; the guest can often access the host IP directly,
or if using hostfwd, configuration varies.
- However, if the guest sees the host as a gateway (often
10.0.2.2in QEMU user networking),editclient.jsshould point to that IP. - Note:
editclient.jsin the repo hasvar edit_server = "http://10.0.2.2:31416";, which matches the QEMU default gateway address.
- Start Server: Run
./pytextfilter.pyon your local machine. - Connect: SSH to your remote server or open your Windows VM.
- Edit:
- Linux:
edit-client filename.txt - Windows:
cscript //nologo editclient.js filename.txt
- Linux:
To make it easier to launch the editor from Windows Explorer, you can add a
context menu item. Save the following content as a .reg file (e.g.,
install_context_menu.reg) and double-click to import it.
This adds an "Open with Edit Client" option to right-clicking any file.
REGEDIT4
[HKEY_CLASSES_ROOT\*\shell\editclient]
@="Open with Edit &Client"
[HKEY_CLASSES_ROOT\*\shell\editclient\command]
@="wscript C:\\Windows\\editclient.js \"%1\""
Note
This registry script assumes you have placed editclient.js inside
C:\Windows\. If you place it elsewhere, update the path in the script
accordingly.