Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

telnet-client

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telnet-client

A simple node.js telnet client

  • 0.14.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
266K
increased by4.05%
Maintainers
1
Weekly downloads
 
Created

What is telnet-client?

The telnet-client npm package is a simple and easy-to-use library for creating and managing Telnet connections in Node.js. It allows you to connect to Telnet servers, send commands, and receive responses, making it useful for automating tasks, remote server management, and network device configuration.

What are telnet-client's main functionalities?

Establishing a Telnet Connection

This feature allows you to establish a connection to a Telnet server using specified parameters such as host, port, shell prompt, and timeout.

const Telnet = require('telnet-client');
let connection = new Telnet();

let params = {
  host: '127.0.0.1',
  port: 23,
  shellPrompt: '/ # ',
  timeout: 1500
};

connection.connect(params)
  .then(() => {
    console.log('Connected to the Telnet server');
  })
  .catch((error) => {
    console.error('Connection failed:', error);
  });

Sending Commands

Once connected, you can send commands to the Telnet server and handle the responses. This is useful for executing remote commands and automating tasks.

connection.send('ls -l')
  .then((response) => {
    console.log('Command response:', response);
  })
  .catch((error) => {
    console.error('Command failed:', error);
  });

Handling Connection Events

You can handle various connection events such as timeout and close to manage the connection lifecycle and handle errors or disconnections gracefully.

connection.on('timeout', () => {
  console.log('Connection timed out');
  connection.end();
});

connection.on('close', () => {
  console.log('Connection closed');
});

Other packages similar to telnet-client

FAQs

Package last updated on 09 May 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc