joaquimserafim / node-netcat Goto Github PK
View Code? Open in Web Editor NEWArbitrary TCP and UDP connections and listens
License: ISC License
Arbitrary TCP and UDP connections and listens
License: ISC License
I used the code below in server as app.js:
var NetcatServer = require('node-netcat').server;
var server = NetcatServer(81);
server.on('ready', function() {
console.log('server ready');
});
server.on('data', function(client, data) {
console.log('server rx: ' + data + ' from ' + client);
});
server.on('client_on', function(client) {
console.log('client on ', client);
});
server.on('client_of', function(client) {
console.log('client off ', client);
});
server.on('error', function(err) {
console.log(err);
});
server.on('close', function() {
console.log('server closed');
});
server.listen();// start to listening
and connect using command from bash:
nc localhost 81
app.js throw below error:
timers.js:156
throw new TypeError('msecs must be a number');
^
TypeError: msecs must be a number
at Object.exports.enroll (timers.js:156:11)
at Socket.setTimeout (net.js:337:12)
at Server.handler (/home/1111hui/public_html/pdf/node_modules/node-netcat/lib/server.js:38:12)
at Server.emit (events.js:129:20)
at TCP.onconnection (net.js:1320:8)
seems there's bug in server.js
Is it possible to use it in the browser (using browserify)?
I am getting this error:
this._client = net.connect({port: self._port, host: self._host}, connect);
Uncaught TypeError: undefined is not a function
this is my code, when i send data to the client , client.on('data') should be invoked again but it doesn't happen.
var Netcat = require('node-netcat')
var rpn = require('rpn');
var BigNumber = require('bignumber.js');
options = {
// define a connection timeout
timeout: 60000,
// buffer(default, to receive the original Buffer objects), ascii, hex,utf8, base64
read_encoding: 'ascii'
}
var client = new Netcat.client("10119", "35.158.25.165",options)
client.on('data', function(data){
s = data.toString()
try{
res = rpn(s)
if (res != null){
client.send(res, false);
}
}
catch(e){
}
})
client.on('error', function (err){
console.log(err)
})
client.start()
Hello,
I'm new to node.js. I am able to connect and send netcat client commands using node-netcat.
What I've been struggling with is - I need to send a series of commands.
client.send (password)
(handle authentication)
client.send (command)
(handle result)
It would be incredibly helpful to see an example chaining a series of client.send to each other using callbacks.
I've tried a variety of ways, and I'm getting undefined in the callback, like it's not waiting for the result before proceeding.
I suspect it'd be a common usecase to chain client commands together, so it would be a huge help to provide an example.
Thank you!
I recently started getting the following error:
{ Error: read ECONNRESET
at exports._errnoException (util.js:1007:11)
at TCP.onread (net.js:563:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
I've had this process running for a couple of months, and it just randomly started throwing these errors. Any idea why?
Hi,
I have been using node-netcat's portscan facility to test the status of a port tunneled to a VNC server over an SSH tunnel. This works well to determine whether the tunnel has finished opening, and the port is available on the local system, however there's something about the VNC server's response (possibly?) that causes an error in your respMsg function. I don't see it when I scan a web server for example.
Essentially what happens is the function fires, but the desc
object is undefined, therefore the library raises an error when attempting to construct the return string like so:
/opt/quetzal-web/app/programs/server/npm/npm/main/node_modules/node-netcat/lib/portscan.js:32
' [' + desc.prot +
^
TypeError: Cannot read property 'prot' of undefined
at respMsg (/opt/quetzal-web/app/programs/server/npm/npm/main/node_modules/node-netcat/lib/portscan.js:32:20)
at cb_call (/opt/quetzal-web/app/programs/server/npm/npm/main/node_modules/node-netcat/lib/portscan.js:77:27)
at Client.send (/opt/quetzal-web/app/programs/server/npm/npm/main/node_modules/node-netcat/lib/client.js:80:5)
at Client.cb_open (/opt/quetzal-web/app/programs/server/npm/npm/main/node_modules/node-netcat/lib/portscan.js:75:13)
at Client.emit (events.js:92:17)
at Socket.connect (/opt/quetzal-web/app/programs/server/npm/npm/main/node_modules/node-netcat/lib/client.js:37:30)
at Socket.g (events.js:180:16)
at Socket.emit (events.js:117:20)
at Object.afterConnect [as oncomplete] (net.js:886:10)
error: Forever detected script exited with code: 8
error: Script restart attempt #1
Commenting out the return string allows the program to continue as expected.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.