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

expect-telnet

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect-telnet

telnet automation through expect-send sequences, like in Tcl

1.0.0
latest
Source
npm
Version published
Weekly downloads
957
3.8%
Maintainers
1
Weekly downloads
 
Created
Source

expect-telnet

telnet automation through expect-send sequences, like in Tcl.

Installation

$ npm install --save expect-telnet

Examples

Log the output of a command

var et = require("expect-telnet");

et("1.2.3.4:23", [
  {expect: "Username", send: "username\r"},
  {expect: "Password", send: "password\r"},
  {expect: "#"       , send: "command\r" },
  {expect: "#"       , out: function(output) {
    console.log(output);
  }, send: "exit\r"}
], function(err) {
  if (err) console.error(err);
});

Start an interactive session

var et = require("expect-telnet");

et("1.2.3.4:23", [
  {expect: "Username", send: "username\r"},
  {expect: "Password", send: "password\r"},
  {expect: "#"       , interact: true    }
], {exit: true}, function(err) {
  if (err) console.error(err);
});

API

expect-telnet(dest, seq, [opts], cb)

  • dest string : Target host and port separated by a colon.
  • seq array : Array of expect steps (objects).
  • opts object : Options object.
  • cb function: Called when an error happens.

Expect step object

  • expect string / regexp : String or RegExp to expect.
  • send string : String to send when expect is found.
  • out function: Output function, receives the output since the previous step.
  • interact boolean : Enter interacive mode with stdin/stdout. There's currently no way out of this mode, so this should be last.

Options

  • timeout *number: Timeout for connection and expect sequences in milliseconds. Set to infinity for no timeout.
  • exit boolean: Whether to exit the process when interacting ends.

© silverwind, distributed under BSD licence

Keywords

expect

FAQs

Package last updated on 31 May 2018

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