{"_id":"@distrentic/high-jump","_rev":"2-3ccce244b6595ba695e2d6f0a2504423","name":"@distrentic/high-jump","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@distrentic/high-jump","version":"0.1.0","description":"An SSH jump server library using ssh2 and socket.io","homepage":"https://github.com/distrentic/high-jump","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"build":"tsc --project ."},"keywords":["ssh","ssh2","web-ssh","jump-server","gateway","ssh-gateway"],"author":{"name":"distrentic"},"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/distrentic/high-jump.git"},"dependencies":{"socket.io":"^4.0.0","ssh2":"^0.8.9"},"devDependencies":{"@types/socket.io":"^2.1.13","@types/ssh2":"^0.5.46","typescript":"^4.2.3"},"peerDependencies":{"socket.io":"^4.0.0","ssh2":"^0.8.9"},"bugs":{"url":"https://github.com/distrentic/high-jump/issues"},"_id":"@distrentic/high-jump@0.1.0","_nodeVersion":"15.12.0","_npmVersion":"7.6.3","dist":{"integrity":"sha512-13KfMnc4G3Q3FKblvAWTYsNwyzuSAJjV0HoDtd9AQDzjhPd+mvmOpp+ILmmerp67OcTLgGR6qIfMq/hWJ5lR2Q==","shasum":"241f54eec21e81d5986ea2f85e55cd461ee05fbe","tarball":"https://registry.npmjs.org/@distrentic/high-jump/-/high-jump-0.1.0.tgz","fileCount":12,"unpackedSize":14417,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgZkKJCRA9TVsSAnZWagAA3AoP/RXaQiP6xzgASGXeqjco\noaqgujIZAkYfeY5L8nVof+NK7c8La1VgHuo6krpO8EPPp572/ZRd+kTK8FaY\nuFKbgKCwVjMUekpSkAuhJXdYMx55V2nJ6mNW4kf9A6WkFL7Ue8Uw8bWI3iw2\n7boFkO6tTug9r1qNtWnYGcydwa+gRbvB5QQ4JRJQtgMT23UtQ6DVI4zb4ist\nEQtBX09RR8cYi74xHxx86uCfsWWhUVkw6m2UtY14BcHMsiFRVz3DqeL+XEPv\nnD+l3ZB7aROF8PFxYUhn/ePbWxb5qMuxSpSzbtFTvqsxYtrZFfW3XUP/rmzH\nfU/FdgQdgJ+TI0DZdn6J+Yinpixu8/FwiHXQlzLeJpP6oNbHbUJrjjUmprKL\n0Jor83WK69SlsOhhLB+AunlItqbysi6wTKRmKJSoAvsTj83ZX0ApmO86yo3S\np0bmQ1dCGaKIuY0IauXyDhKNr5tTZASPp5i9bEJMaZwC/tFSz9Q4o+hfDdjX\nTpoAVblOEMrLTVTu0A4AKKL/00abna3ae9htybFLR7LRXxrV7hGShsetazeb\nW/B2osE1jp3p4rXu3XJ7ZMs/VKzhzuHtJTE0dwQieD1PEtcAKOsiUpRR0nGI\n/vgDweGh3kvXt9m2rezph9DN/6PqxZW4HXffr0Crrr5Os68sVR5/rmbMLgIx\nBw6Z\r\n=5CaQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBG8I7jNZA6TGxpWAYfbHesLmRmo8MHdXdOn3SHSV1eFAiAOVcaIllBzUZhUzOxGpqvkHLBACz8A6aQ5NswebnRCvg=="}]},"_npmUser":{"name":"onatm","email":"onatmercan@gmail.com"},"directories":{},"maintainers":[{"name":"idursun","email":"ibrahim.dursun@gmail.com"},{"name":"onatm","email":"onatmercan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/high-jump_0.1.0_1617314440611_0.18471525031301206"},"_hasShrinkwrap":false},"0.1.1":{"name":"@distrentic/high-jump","version":"0.1.1","description":"An SSH jump server library using ssh2 and socket.io","homepage":"https://github.com/distrentic/high-jump","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"build":"tsc --project ."},"keywords":["ssh","ssh2","web-ssh","jump-server","gateway","ssh-gateway"],"author":{"name":"distrentic"},"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/distrentic/high-jump.git"},"dependencies":{"socket.io":"^4.0.0","ssh2":"^0.8.9"},"devDependencies":{"@types/socket.io":"^2.1.13","@types/ssh2":"^0.5.46","typescript":"^4.2.3"},"peerDependencies":{"socket.io":"^4.0.0","ssh2":"^0.8.9"},"bugs":{"url":"https://github.com/distrentic/high-jump/issues"},"_id":"@distrentic/high-jump@0.1.1","_nodeVersion":"15.12.0","_npmVersion":"7.6.3","dist":{"integrity":"sha512-C3pWL2tRyXNGUTcGx92nbkNwLvweNmPWy4/G2LdNhPGgI9Txjs2HH76MjoSdUeeX6cBs6rU7kFwN15V2WwVnGg==","shasum":"3c4019fb65ee3bdbefa10404872e271ca823b403","tarball":"https://registry.npmjs.org/@distrentic/high-jump/-/high-jump-0.1.1.tgz","fileCount":14,"unpackedSize":21078,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgZmBLCRA9TVsSAnZWagAAlwkP/iPAnfx+OD8oLXClsf86\nBC2E9o9ZvVpKWfE1lin3svaQw32tgsuPDEuk/x+0lruCuTUbmDuOSLZMn7xc\nvZ1KehtRmQ5Fy7jF3sN4OTz0t7kyA8ZJsP24dAzLnXYjanKuA4vdVhKMBi4p\nPziduSGi0EmJh3Bh9nTOMhFMc5i+DMQdW8L30AJ27sj4Y9UNEiRW+CVvtgw2\nTB/JRvmxq5ltV1vstKuGoo9DbDViVBNDnQm3v/pUleQbbrcAZLq+UmSijCdt\nHutmYH4TvbXQou7M27iuXfZ6I9uA+G6uRP7YGTT+7MXroJlqQzau5xOmtoZ1\nrtRIcdkgWRbZaZEie1fZqMK2JDnh4VWODM2xTodPMQkBw6POpCaj6DwXM5Ht\npT6LVTe8d2u85Lrt3vIf19N8yDkozlfuil0nVq59nqFHxARsoENAJI97IMwA\nroiCMjuLQ36OSt5VJs0s4I/RrcZ6zXg7noWk2IaiN6dhyd6DnoIUF24ZR1LA\nOCqZoLYxnBAfq4KJyHXL7IYt4kbWiNMUTE+72hNjDD4xLUIHtyWPQ3r/OtYQ\n8Yh8k4bBUiWn3iS2/ptfGVampL4I1jgm6wC8s0XXWsdH7miZSQVwtwjLHSSu\nEBtc7yK4FOljqzP89kBm9vHBRI6Tr2GD9rq4qt8h/3aWGob7Um0TgO6PUr1O\n6kNr\r\n=MrvC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0EBrH3hn83FgMZdvbmtRznQtRW1SS6OrlHuhYkQMa1wIhAJWAhRphwOCukhqcxAR6DmZ7UEJPyBnpgNW1bpT877JS"}]},"_npmUser":{"name":"onatm","email":"onatmercan@gmail.com"},"directories":{},"maintainers":[{"name":"idursun","email":"ibrahim.dursun@gmail.com"},{"name":"onatm","email":"onatmercan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/high-jump_0.1.1_1617322058878_0.34333526040622364"},"_hasShrinkwrap":false}},"time":{"created":"2021-04-01T22:00:40.352Z","0.1.0":"2021-04-01T22:00:40.739Z","modified":"2022-04-05T04:46:28.176Z","0.1.1":"2021-04-02T00:07:39.037Z"},"maintainers":[{"name":"idursun","email":"ibrahim.dursun@gmail.com"},{"name":"onatm","email":"onatmercan@gmail.com"}],"description":"An SSH jump server library using ssh2 and socket.io","homepage":"https://github.com/distrentic/high-jump","keywords":["ssh","ssh2","web-ssh","jump-server","gateway","ssh-gateway"],"repository":{"type":"git","url":"git+ssh://git@github.com/distrentic/high-jump.git"},"author":{"name":"distrentic"},"bugs":{"url":"https://github.com/distrentic/high-jump/issues"},"license":"MIT","readme":"# high-jump (library)\n\nAn SSH jump server library using `ssh2` and `socket.io`.\n\n## Installation\n\n```sh\nnpm install @distrentic/high-jump\n```\n\n```sh\nyarn add @distrentic/high-jump\n```\n\n## Usage\n\nYou can either run ready-to-use [`high-jump-server`](../server) or implement your own server using this library.\n\n### Express server example (typescript)\n\n```typescript\nimport express from \"express\";\nimport { Server as HttpServer } from \"http\";\nimport { Server as SocketServer } from \"socket.io\";\nimport shell from \"@distrentic/high-jump\";\n\nconst PORT = process.env[\"PORT\"] || 8022;\n\nconst log = console;\n\nconst app = express();\nconst server = new HttpServer(app);\nconst io = new SocketServer(server, {\n  serveClient: false,\n  path: \"/ssh\",\n  cors: { origin: \"*\" },\n});\n\nio.on(\"connection\", (socket) => shell(socket, log));\n\nserver.listen(PORT, () => {\n  log.info(`high-jump is running at ::${PORT}`);\n});\n```\n\n### Client example (typescript)\n\n```typescript\nimport io from \"socket.io-client\";\nimport { Terminal } from \"xterm\";\nimport { FitAddon } from \"xterm-addon-fit\";\n\nconst term = new Terminal({ cursorBlink: true });\nconst terminalContainer = document.getElementById(\"terminal-container\")!;\nconst fitAddon = new FitAddon();\nterm.loadAddon(fitAddon);\nterm.open(terminalContainer);\nterm.focus();\nfitAddon.fit();\n\nconst socket = io(\"http://localhost:8022/\", { path: \"/ssh\" }).open();\n\nwindow.addEventListener(\"resize\", resize, false);\n\nfunction resize() {\n  fitAddon.fit();\n  socket.emit(\"resize\", {\n    cols: term.cols,\n    rows: term.rows,\n    width: terminalContainer.clientWidth,\n    height: terminalContainer.clientHeight,\n  });\n}\n\nsocket.on(\"connect\", () => {\n  socket.emit(\"shell\", {\n    host: \"\",\n    port: 22,\n    username: \"\",\n    password: \"\",\n    cols: term.cols,\n    rows: term.rows,\n    width: terminalContainer.clientWidth,\n    height: terminalContainer.clientHeight,\n  });\n});\n\nterm.onData((data: string) => {\n  socket.emit(\"data\", data);\n});\n\nsocket.on(\"data\", (data: ArrayBuffer) => {\n  term.write(new TextDecoder().decode(data));\n});\n\nsocket.on(\"shell_error\", (type: string) => {\n  alert(type);\n});\n```\n\n## API\n\n`require('@distrentic/high-jump)` returns a function to construct the shell socket listener.\n\n### Methods\n\n- **shell**(< _Socket_ > socket, < _Logger_ > logger) - (_void_) - Constructs the shell socket listener.\n  - **socket** - _Socket_ - `socket.io` connection handler.\n  - **logger** - _Logger_ - An instance of a logging library. Accepts `console`, `winston.Logger`, `bunyan.Logger`, etc.\n\n### Events\n\n#### Emitted events\n\nThese are the\n\n- **data**(< _ArrayBuffer_ > data) - `UTF-8` encoded buffer.\n- **shell_error** - < _\"SSH_CONNECTION_ERROR\" | \"SSH_AUTHENTICATION_ERROR\" | \"SHELL_ERROR\" | \"SOCKET_ERROR\"_ > error) - Emitted when an error occurs. Message received indicates the type of error.\n\n#### Listened events\n\n- **shell**(< object > config) - Client emitted event to request a new shell. You can either authenticate with a `password` or a `privateKey` (and a `passphrase` if you set one).\n\n```json\n{\n  \"host\": \"\",\n  \"port\": 22,\n  \"username\": \"\",\n  \"password\": \"P@ssw0rd\",\n  \"privateKey\": \"\",\n  \"passphrase\": \"\",\n\n  // pseudo tty configuration\n  \"cols\": 80,\n  \"rows\": 60,\n  \"width\": 1600,\n  \"height\": 1200\n}\n```\n\n- **data**(< _string_ > data) - Sends data to remote shell.\n- **resize**(< _object_ > config) - Event to resize pseudo tty.\n\n```json\n{\n  \"cols\": 80,\n  \"rows\": 60,\n  \"width\": 1600,\n  \"height\": 1200\n}\n```\n\n## License\n\nLicensed under MIT license ([LICENSE](LICENSE) or <http://opensource.org/licenses/MIT>)\n","readmeFilename":"README.md"}