1.0.14 • Published 5 years ago

sshbulkcommander v1.0.14

Weekly downloads
1
License
GNU GPLv3
Repository
gitlab
Last release
5 years ago

SSH Bulk Commander

An event based SSH bulk command runner with promise based request handler.
  • Automatically handles sudo
  • Returns array of objects listing commands which were run and associated responses.
  • Run command to multiple ssh devices in parallel

If you need to connect to a bunch of devices via SSH and run any number of consecutive commands on them this tool is for you.

Code Example

Below is a basic code example :

import { SuperSSH, IConnectConfig } from "sshbulkcommander";

interface IResponse {
  [key: string]: any;

// Array of devices commands must be run on.
const devices: Array<IConnectConfig> = [
  {
    host: '',
    username: '',
    port: 22,
    password: '',
    algorithms: {
      serverHostKey: ['ssh-rsa', 'ssh-dss'],
      cipher: ['aes256-cbc']
    },
    enableTTY:true
  }
];

// Array of commands
const commands: Array<string> = [
  'ls -lah',
  'mkdir /nice'
];

// Include your device and commands arrays here.
const ssh = new SuperSSH({
  devices,
  commands
});

// Specify how many devices you would like to run commands on in parallel
ssh.parallelThreads = 2;

// Create your event listeners which will stream responses
ssh.on('processed', (data: IResponse) => {
  console.log(data);
});
ssh.on('error', (data: IResponse) => {
  console.log(data);
});
ssh.on('complete', data => {
  console.log(data);
});

// Initialise your request via a promise.
ssh.request().catch(err => {
  console.log(err);
});

If you have any questions or suggestions email me: shaun.botsis@mytelnet.co.za

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago