Code Monkey home page Code Monkey logo

node-netcat's People

Contributors

joaquimserafim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-netcat's Issues

timeout error

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

Doesn't work in the browser

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

Data is not received after client.send

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()

Please provide an example with client.send using callback

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!

ECONNRESET

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?

Undefined error during portscan

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.