mscdex/ssh2 — reverse-engineered prompt

Reverse engineered prompt

Build me a pure JavaScript SSH toolkit for Node that works as both a client and a server. I want someone using it to be able to connect to a remote machine with either a password or an SSH key, run one off commands, open an interactive shell, browse and move files over SFTP, and tunnel network traffic through the connection for things like local or remote port forwarding and simple proxy style use. On the server side, it should be possible to spin up a basic SSH server with password and public key login, support exec style command handling, and also offer an SFTP only mode.

Please make it feel like a real reusable library, with a clean API, solid error handling, and example scripts that show the main flows like command execution, shell access, SFTP directory listing, and forwarding connections. Add tests too. Keep it compatible with modern Node, and look up current SSH behavior or OpenSSH quirks online if you need to.

Want more depth? Deep Reverse