Mitmdump 0.16 stops working and only passes "clientdisconnect" errors after a couple of hundred requests
See original GitHub issueI am currently running mitmdump via a bash script (rerun.sh) with following parameters:
gtimeout 30s mitmdump -p 8513 -T --host --anticache -s py.py --ignore :443$’ ./rerun.sh
this is quick and (very) dirty solution because mitmdump stops working and only passes “clientdisconnect” errors after a couple of hundred requests.
this is my py.py:
# This function is run on each response from websites
def response(context, flow):
with decoded(flow.response):
if "application/javascript" == flow.response.headers.get('Content-Type', None) and ".js" == flow.request.url[-3:]:
flow.response.content = flow.response.content + open('js.js', 'r').read()
from libmproxy.models import decoded
and I am getting a lot of these as well, that might or might not be related to the above issue, but perhaps might provide further clues as to what is up:
mitmproxy has crashed!
Please lodge a bug report at: https://github.com/mitmproxy/mitmproxy
192.168.2.7:50851: Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/libmproxy/proxy/server.py", line 120, in handle
root_layer()
File "/usr/local/lib/python2.7/site-packages/libmproxy/proxy/modes/transparent_proxy.py", line 21, in __call__
layer()
File "/usr/local/lib/python2.7/site-packages/libmproxy/protocol/tls.py", line 272, in __call__
layer()
File "/usr/local/lib/python2.7/site-packages/libmproxy/protocol/http.py", line 130, in __call__
layer()
File "/usr/local/lib/python2.7/site-packages/libmproxy/protocol/http.py", line 338, in __call__
self.get_response_from_server(flow)
File "/usr/local/lib/python2.7/site-packages/libmproxy/protocol/http.py", line 469, in get_response_from_server
if flow.response.stream:
AttributeError: 'NoneType' object has no attribute 'response'
while the present workaround is somewhat underperforming it is serviceable for now as i have to deployed this Saturday. But there must be less “hacky” way of solving this issue long term? This is my first time submitting an issue on GitHUb so please bear with me if I am not 100% up to protocol.
Mitmproxy Version: mitmproxy-0.16-osx.tar.gz Operating System: OSX
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
I enden up using this Quick and Dirty solution, with a self referring bashscript rerun.sh:
gtimeout 30s mitmdump -p 8513 -T --host --anticache -s py.py --ignore :443$
./rerun.sh
basically restarting it every 30 seconds - Not a perfect solution by any means, but serviceable in a pinch - Hope it helps…
Maybe you know how to get the clients ip from inside a script while running mitmdump?