Closed camposfyi closed 7 years ago
Hey!
The way TCP works in Node is that it's a stream you need to read from to get the bytes.
Does https://github.com/moll/node-mitm#intercepting-tcp-connections shine light in the right direction? The server object Mitm.js returns works exactly like a regular TCP server documented at https://nodejs.org/api/net.html.
Thanks for the info. I was able to get it.
One more thing, when you call socket.bypass(), it seems it doesn't let the request proceed to the original destination (which is not localhost). Is that the case? Is that how to module works? Or is there a way I can let a tcp request proceed to the actual destination? I noticed in your docs you mentioned you can use bypass() to forward it to the original destination (but it's not working for me). I assume it's only for localhost?
Are you doing something like the example in https://github.com/moll/node-mitm#bypassing-interception and it's still not getting through? Would you mind sharing that piece of code? It should definitely allow the original request to go through.
Theoretically, bypassing every connection should allow my application to run as normal, but it just ends up hanging.
var ldapInterceptor = require("mitm")(); ldapInterceptor.enable();
ldapInterceptor.on('connection', function (socket, opts) { socket.bypass(); });
I also tried inside the 'connection' event callback: socket.on('data', function(data) { socket.bypass(); });
I suspect this could be because you're calling bypass
in the connection
event and not in the connect
event. Sorry, they are similarly named, but happen at two different times in the lifecycle.
Can I close this or is there anything else, @jac0117?
Yes
On Wednesday, August 17, 2016, Andri Möll notifications@github.com wrote:
Can I close this or is there anything else, @jac0117 https://github.com/jac0117?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moll/node-mitm/issues/32#issuecomment-240339967, or mute the thread https://github.com/notifications/unsubscribe-auth/AFBZeJpr4DA5Fj6a4PmQ5OHmCRYWzCkcks5qgr5jgaJpZM4ItDHD .
Love the single answer to a disjunctive question. :D
I need to capture the payload from the request. I'm intercepting calls to LDAP. The opts variable only contains host and port. Is there a way to capture the payload?