telnet-client
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -8,8 +8,5 @@ { | ||
}, | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "./lib/telnet-client.js", | ||
"dependencies": { | ||
"log4js": ">= 0.6.9" | ||
}, | ||
"engine": "node >= 0.10.25", | ||
"engine": "node >= 0.10.23", | ||
"license": { | ||
@@ -16,0 +13,0 @@ "type": "MIT" |
100
README.md
@@ -1,1 +0,99 @@ | ||
Testing state | ||
# node-telnet-client | ||
A simple telnet client for node.js | ||
## Installation | ||
Locally in your project or globally: | ||
npm install telnet-client | ||
npm install -g telnet-client | ||
## Example usage | ||
var telnet = require('telnet-client'); | ||
var connection = new telnet(); | ||
var params = { | ||
host: 127.0.0.1, | ||
port: 23, | ||
shellPrompt: '/ # ', | ||
timeout: 1500, | ||
// removeEcho: 4 | ||
}; | ||
connection.on('ready', function(prompt) { | ||
connection.exec(cmd, function(response) { | ||
console.log(response); | ||
}); | ||
}); | ||
connection.on('timeout', function() { | ||
console.log('socket timeout!') | ||
connection.end(); | ||
); | ||
connection.on('close', function() { | ||
console.log('connection closed'); | ||
}); | ||
connection.connect(params); | ||
## API | ||
var telnet = require('telnet-client'); | ||
var connection = new telnet(); | ||
### connection.connect(options) | ||
Creates a new TCP connection to the specified host, where 'options' is an object | ||
which can include following properties: | ||
* host: Host the client should connect to. Defaults to 'localhost'. | ||
* port: Port the client should connect to. Defaults to '23'. | ||
* timeout: Sets the socket to timeout after the specified number of milliseconds | ||
of inactivity on the socket. | ||
* shellPrompt: Shell prompt that the host is using. Defaults to regex '/(?:\/ )?#\s/'. | ||
* loginPrompt: Username/login prompt that the host is using. Defaults to regex '/login[: ]*$/i'. | ||
* username: Username used to login. Defaults to 'root'. | ||
* irs: Input record separator. A separator used to distinguish between lines of the response. Defaults to '\r\n'. | ||
* ors: Output record separator. A separator used to execute commands (break lines on input). Defaults to '\n'. | ||
* echoLines: The number of lines used to cut off the response. Defaults to 1. | ||
### connection.exec(data, [callback]) | ||
Sends data on the socket (should be a compatible remote host's command if sane information is wanted). | ||
The optional callback parameter will be executed when the data is finally written out - this may not be immediately. | ||
### connection.end() | ||
Half-closes the socket. i.e., it sends a FIN packet. It is possible the server will still send some data. | ||
### connection.destroy() | ||
Ensures that no more I/O activity happens on this socket. Only necessary in case of errors (parse error or so). | ||
### Event: 'ready' | ||
Emitted when a socket connection is successfully established and the client is successfully connected to the specified remote host. | ||
### Event: 'writedone' | ||
Emitted when the write of given data is sent to the socket. | ||
### Event: 'timeout' | ||
Emitted if the socket times out from inactivity. This is only to notify that the socket has been idle. | ||
The user must manually close the connection. | ||
### Event: 'error' | ||
Emitted when an error occurs. The 'close' event will be called directly following this event. | ||
### Event: 'end' | ||
Emitted when the other end of the socket (remote host) sends a FIN packet. | ||
### Event: 'close' | ||
Emitted once the socket is fully closed. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9282
0
100
- Removedlog4js@>= 0.6.9
- Removeddate-format@4.0.14(transitive)
- Removeddebug@4.4.0(transitive)
- Removedflatted@3.3.2(transitive)
- Removedfs-extra@8.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removedlog4js@6.9.1(transitive)
- Removedms@2.1.3(transitive)
- Removedrfdc@1.4.1(transitive)
- Removedstreamroller@3.1.5(transitive)
- Removeduniversalify@0.1.2(transitive)