问题
I am new to the mitmproxy world. I need to write a python script that would log all the requests made from a certain app on Genymotion emulator. Now, I learned that mitmproxy can be helpful for my requirement. So I have successfully set up mitmproxy and now I am able to monitor all the traffic HTTP/S from any app on Gennymotion through the mitm client.
However, what I want is :
The app would be explored manually by the user and there should be this Python script running that would simply log all the requests being made while the user is exploring the app.
I have tried going through the Github examples of mitmproxy APIs, but have not been able to understand them. Could someone please point me to a more detailed explanation/usage guide for these APIs ?
Through some more digging, I figured out that I need something similar to https://github.com/mitmproxy/mitmproxy/blob/master/examples/flowbasic but I do not understand what is happening inside the script in the above resource. Like
what is f.reply() ?
what is flow.State() ?
what is m.run() ?
what is flow.FlowMaster ?
And more importantly, is there a place i can learn about these various methods and others used in the above ?
Similarly, found this as well : get a "raw" request\response from MITM Proxy
Can someone please explain how to or where do I call the request() from ?
What is the context and flow parameters there ?
回答1:
mitmproxy -w log_file.txt
should work for what you want. As for the docs, mitmproxy --help
gives you some insight on the available options.
来源:https://stackoverflow.com/questions/32195882/libmproxy-and-mitmproxy-documentation