sensepost / wsproxy

A websocket proxy
GNU General Public License v2.0
55 stars 17 forks source link

Error: read ECONNRESE #8

Open testanull opened 7 years ago

testanull commented 7 years ago

I got this error when run wsproxy events.js:141 throw er; // Unhandled 'error' event ^

Error: read ECONNRESET at exports._errnoException (util.js:907:11) at TCP.onread (net.js:561:26) After that, it crash Do you have any solutions for this problems?? Tks!

staaldraad commented 7 years ago

Hey!

I'm not too sure, looks like it's a problem in one of the import libraries, specifically net.js

Could you try binding to another port. I also just merged a PR that might contain a fix, if you don't mind testing with that.

testanull commented 7 years ago

Thank you But i still get that error :( I have try on both my laptop and virtual machine It still return that error after get the first request

0xdevalias commented 7 years ago

Not sure if this is strictly related, but just hit the following error, which crashed out the program:

events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND foo.example.com foo.example.com:443
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)

It was for a domain that doesn't currently have an A record. At this stage, not sure where it grabbed that from.. somewhere in the application I presume, it happened during a huge stream of other websocket messages.

staaldraad commented 7 years ago

@0xdevalias is right, there was a missing error handler for the http.request

Thus any exception while trying to connect to a remote server, be it connection refused or DNS not resolving, the whole proxy would crash.

I've added an error handler and made a PR (https://github.com/sensepost/wsproxy/pull/9). Otherwise my fork has an updated version: https://github.com/staaldraad/wsproxy

0xdevalias commented 7 years ago

@staaldraad Awesome! Thanks for that :3

0xdevalias commented 7 years ago

Running your updated version, seem to have managed to hit it again (or similar)

Trace
    at Server.<anonymous> (/Users/foo/sec/wsproxy/wsproxy.js:92:15)
    at emitTwo (events.js:106:13)
    at Server.emit (events.js:194:7)
    at parserOnIncoming (_http_server.js:563:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)

events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at exports._errnoException (util.js:1050:11)
    at TCP.onread (net.js:581:26)