mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-05 04:07:20 +00:00
Add an example script that turns all PNGs upside down.
This commit is contained in:
parent
4ac59a7859
commit
b635112d36
1 changed files with 9 additions and 0 deletions
9
examples/upsidedownternet.py
Normal file
9
examples/upsidedownternet.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import Image, cStringIO
|
||||
def response(context, flow):
|
||||
if flow.response.headers["content-type"] == ["image/png"]:
|
||||
s = cStringIO.StringIO(flow.response.content)
|
||||
img = Image.open(s)
|
||||
img = img.rotate(180)
|
||||
s2 = cStringIO.StringIO()
|
||||
img.save(s2, "png")
|
||||
flow.response.content = s2.getvalue()
|
||||
Loading…
Add table
Add a link
Reference in a new issue