Created
July 26, 2017 01:34
-
-
Save danielribeiro/975fbfe2ec867b5f68b1dcb0ba2c6f66 to your computer and use it in GitHub Desktop.
mitmproxyexample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Saves all webp images | |
""" | |
import io | |
from mitmproxy import http | |
def response(flow: http.HTTPFlow) -> None: | |
if flow.response.headers.get("content-type", "").startswith("image/webp"): | |
s = flow.response.content | |
name = flow.request.pretty_url.replace('/', '_').replace(':', '_').replace('http', 'req').replace('?', '_').replace('&', '_') | |
f = open("~/mitm/%s.webp" % name, "wb") | |
f.write(s) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment