Lurker News

Comments (85) 38 threads

Earlier comments
Cilvic1 reply#
The question is maybe a bit off-topic a d vague. That's because I struggle to express it with the right terms:

I'm looking for a generic tool to build and then serve:
Accept Incoming request (API contract A) Send outgoing request (API contract B) potentially with parameters from the incoming request Receiving incoming response (API contract B) Do some translations/string manipulation Send outgoing response (API contract A)

jeroenhd1 reply#
mitmproxy (https://mitmproxy.org/) has scripting support that will let you do most of this.

For example, you can expose mitmproxy, listen to HTTP requests for a specific host (using this API: https://docs.mitmproxy.org/stable/api/mitmproxy/http.html), intercept the request, do whatever API calls you need, and inject a response without ever forwarding the request to the original server.
Alternatively, you could modify the request and then change the request destination, like in this example here: https://docs.mitmproxy.org/stable/addons-examples/#http-redi.... Using the WSGI support, you could even use normal Python annotations to build your own API without doing too much pattern matching: https://docs.mitmproxy.org/stable/addons-examples/#wsgi-flas...

Cilvic1 reply#
Ok. This sounds great for easy developing. But when I'm hosting this I'm not a mitmproxy. I want to act like a normal server/endpoint for API A.
lsferreira42#
Congrats, this is really awsome and i have a use for it right now, it will be really useful for debuging old and undocumented api's
andrewstuart21 reply#
I've always wanted to build something similar to this, by reading HAR files captured right out of the devtools. Have you given any thought to that as an alternative input?
alufers#
Hey! Just writing to let you know that I've added HAR input support to mitmproxy2swagger.
ducktective1 reply#
Is it possible to do this on wireshark/tcpdump pcap dumps? Like for finding out hostnames, endpoints and request packets of HTTPS requests that an android app is making?
alufers1 reply#
The problem with pcap is that whe requests there would be encrypted and basically there is no way to practically decrypt them.

Mitmproxy solves that by being between the client and server and injecting it's own self-signed certificate (which you need to add to the trusted certificates on the phone, which requires root).

resoluteteeth1 reply#
See SSLKEYLOGFILE
ducktective1 reply#
explain bit more please? Do you mean root is not needed? Isn't that a curl feature?

Continue this thread — 1 reply

Load more comments