Created
November 28, 2014 00:31
-
-
Save fernyb/18a6654c1a526138367f to your computer and use it in GitHub Desktop.
mitmproxy (mitmdump) script to print response body
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
import sys | |
import cStringIO | |
from PIL import Image | |
from libmproxy.protocol.http import decoded | |
def response(context, flow): | |
content_type = flow.response.headers.get_first("content-type", "") | |
sys.stdout.write("Content Type: "+ content_type +"\n\n") | |
if content_type.startswith("text"): | |
sys.stdout.write("Response Content: "+ flow.response.content +"\n\n") | |
# with decoded(flow.response): | |
# try: | |
# s = cStringIO.StringIO(flow.response.content) | |
# sys.stdout.write("Response Content: "+ s +"\n\n") | |
# except: | |
# pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment