Inline script loaded several times with mitmproxy/mitmdump log option


#1

Hello, i’m facing an issue with mitmproxy/mitmdump v0.18.1 and v0.18.2 (everything was working fine with v0.17.1).

When you run this command:
mitmproxy --script ./sslstrip.py --eventlog

You surf on http://www.ameli.fr, click on “Mon compte ameli”, the page is well displayed (stripping has been well done)

Now run:
mitmproxy --script ./sslstrip.py --eventlog -a test.log
You surf on http://www.ameli.fr, click on “Mon compte ameli”, we have a HttpReadDisconnect(‘Server disconnected’,) issue because the script sslstrip.py is reloaded, so the variable secure_hosts is reinitialized (empty).

So this behavior happens only when mitmproxy (or mitmdump) is writing to file. This issue has been reproduced with the flowwriter.py inline script too in addition to sslstrip.py.

I created an issue for that https://github.com/mitmproxy/mitmproxy/issues/1750, so any help should be appreciated or if this behavior has already been identified ?

EDIT

Seems things are working with git master v0.19

Thanks in advance,


#2

Hi,

this reloading comes from the fact that the script and the log output reside in the same directory. The change of a file in the directory triggers the script reloading.

BR
Michael


#3

Hello Michael,

Thanks for your answer, it seems that i do not have this issue with git master (v0.19). it’s quite weird to reload every scripts due to a directory update. By the way i changed my directories structure.

Cheers,


#4

Yes, sorry about the current behaviour - it is not quite optimal in some cases. We plan to change it to reload on changes to *.py files only:


#5

OK great thanks Maximilian