I’d post on Stack Overflow, but I know it would get closed…
I need some sort of simple proxy server software that can act as a go-between for an API endpoint, so that I can see all traffic outgoing and incoming.
In other words, let’s say I’m using some Meteor or npm packages to send commands to a SOAP (ugh) API endpoint, at https://super-tech.net/lame?wsdl. I’m getting errors back but I need to see the exact XML being sent to the API endpoint. So I’d like to instead put in my Meteor code a SOAP call to http://localhost:9876/lame?wsdl which would dump any incoming requests to the console, and then forward them to https://super-tech.net. Any responses will get channeled through the proxy.
In other words, a sort of sniffer that will let me see the raw traffic. Does such a thing exist?
In the windows world there is a thing called fiddler, it injects itself as a proxy and lets you look at all the traffic, very useful for rest/soap debugging
well, fiddler will do the job. It will also inject itself into ssl connections if you add it as a trusted CA. I’ve used it extensively for exactly this kind of thing.
Thanks for that! I’m not totally sure how to set this up. I’m using an npm soap package, and there’s no option for proxies. So I just have to specify an API endpoint to connect to. Maybe I can set up mitmproxy so that whatever connection it gets, it will pass to a specific URL.
So my code can make an API call to http://localhost:8080/something but mitmproxy will always pass that traffic to https://api.someservice.net and preserve the querystring and/or POST, request body, etc.
Oh it isn’t the simplest thing to setup, however it is a complete proxy.
All your network traffic would run through the proxy.
Not sure how you need the topology to work but this is how I used it in the past.
My LAN is pretty typical - a couple of PCs and mobile devices connected.
I setup my Macbook as the MITMProxy, installed the certificate on my mobile, and set my mobile wifi interface up to use the Macbook as the proxy server.
Once completed, all my network traffic from my mobile ran through the Macbook and I could intercept view and edit all network traffic, from any application in real time.
Ugh. I’m afraid mitmproxy is beyond me. I don’t know how to set up the certificate, because I’m not running this on a mobile device nor from the browser, but rather invoking my code from the command line on my Mac (node soap.js).
I’ve got mitmproxy running on a virtual Ubuntu server on my Mac.
You don’t actually need the certificate, that is only if you want to use HTTPS without getting a certificate error…
You just need to route all your network traffic through the computer running MITMProxy.
It does sound like way more than you need, but it is pretty cool to play with.
I spent a good few hours getting my head around it and think it is a pretty neat tool to understand.
edit: not sure how you would do it (or if you can do it) if you’re running MITMProxy on a VM, look up if there are any tutorials…
I think I’m done for the day. I’ve spent at least 6 hours trying to figure this out. My calls to a SOAP API (via the npm soap package) are failing, and all I want to do is “spy” on the HTTPS traffic to figure out what XML is being sent.