Lurker News

Comments (85) 38 threads

alufers5 replies#
Wanted to show off my little project which helps whith reverse engneering APIs used by various apps. It takes HTTP traffic capturewd by mitmproxy and generates an OpenAPI specification for a given REST API.

I have used it already on two apps and the results are good enough to write an alternative client or quickly automate some stuff.

upupandup1 reply#
does it capture route/server rendered pages too?
alufers#
It does, but it will only generate schema descriptions for JSON endpoints. Whis means that the URL and method will appear in the spec, but not the response/request schema.
mhils1 reply#
mitmproxy dev here, very awesome! :) This seems to be particularly useful to quickly generate clients for reverse-engineered APIs.
mohsen11 reply#
Swagger Editor dev which now works at Airbnb here. This is hilarious!
SOLAR_FIELDS2 replies#
Hilarious indeed! The first thing I thought of with this project is actually AirBnB, because the sort/filter/map view is so terrible and missing features. AirBnB captures data on a bunch of stuff, but doesn't make it possible to search for in the UI (ever want a property with a lake view or a sauna? AirBnB knows which ones have those things, but they won't let you look for them!)

AirBnB doesn't have an official API but changes the tags so often that scrapers people put up on Github go out of date quickly. Now I can run this whenever I want to have actual search functionality (instead of the hobbled crap available on the website) and ensure that whatever flavor of API is available on the website that day is easily queryable!

Continue this thread — 2 replies

lancebeet#
This is a really clever project. It seems like an obvious idea once you've seen it, but it clearly isn't. Thank you for sharing it.
anitil#
What a fantastic idea! I have so many half baked things that some idiot (me) built without documenting the underlying API. This will make life so much easier
andreidd1 reply#
That's interesting, but it won't work with native code that statically links a SSL implementation.
jeroenhd#
In many applications you can bypass built-in verifications with some Frida [1] code. It requires more effort to do so, of course, as you'd need to find the OpenSSL methods (with a script like this [2] and bypass the verification in there.

If you're really intent on getting it to work, downloading the binary, patching out the verification function and putting it back is also possible if you're root.
[1]: https://frida.re/docs/android/
[2]: https://mobsecguys.medium.com/exploring-native-functions-wit...

SemanticStrengh1 reply#
Can this be used to generate a REST documentation for your own frontend just by interacting with it? This should be augmented via a crawler, that click everyclickable element recursively.
alufers1 reply#
Totally, but you would need to do some manual cleanup and naming afterwards to make it more useful than just reading the source code. You could also for example use your integration tests if you have some to capture as much routes as possible.
SemanticStrengh1 reply#
of course the generated doc should be refined (e.g. filling missing types, error codes) but your lib would save us a lot of work and make the world a better place.
tomatowurst3 replies#
"...and we expect it to be free and open source as our budget for this is zero."

Continue this thread — 3 replies

Labo3332 replies#
Very nice!

On the same note, I wrote a program to generate Python code (requests) from a HAR capture: https://github.com/louisabraham/har2requests
I think using HAR captures is simpler for the end user than spawning mitmproxy as they don't require any installation and are extracted from the network tab of the browser devtools. Is there a reason why you didn't use them?
EDIT: I realized that mitmproxy can also get traffic from other devices like phones. Very cool project, I will think about modifying mine to support mitmproxy captures!

olabyne1 reply#
Oh, I used a python script to generate pre-made requests from HAR recently, I'm pretty sure it was your git ! Very useful :)
Labo333#
Thanks!
alufers1 reply#
Hey! Just writing to let you know that I've added HAR input support to mitmproxy2swagger.
Labo333#
Wow that's super cool! Thanks!

Load more comments