🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-ssh2-hook

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ssh2-hook

React hooks for SSH

0.5.0
latest
Source
npm
Version published
Weekly downloads
22
-53.19%
Maintainers
1
Weekly downloads
 
Created
Source

Description

React hook to init shell connection via ssh.

Requirements

  • node.js -- v10.16.0 or newer

Installation

Using npm:

npm install react-ssh2-hook

Using yarn:

yarn add react-ssh2-hook

Get started

Simple example

const { initShell, stream } = useShell({
  // See ssh2 lib documentation
  config: {host: 'host', username: 'username', password: 'password'},
  window: { term: 'xterm-256color' },
  onConnect: () => console.log('connected'),
  onData: (data: string) => console.log(data),
  onClose: () => console.log('closed'),
  onError: (err: Error) => console.error(err),
});

Connection hopping

const { initShell, stream } = useShell({
  // Pass an array of SSH2 ConnectConfig
  config: [
      {host: 'host1', username: 'username1', password: 'password1'},
      {host: 'host2', username: 'username2', password: 'password2'}
  ],
  window: { term: 'xterm-256color' },
});

Keywords

ssh2

FAQs

Package last updated on 07 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts