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
| # (this script works best with --anticache) | |
| # run it like this: mitmdump -q -s ~/b/mitm/replace.py | |
| from mitmproxy import ctx, http | |
| import re | |
| DPREFIX = '[DEBUG]> ' # stupid | |
| """ | |
| Dict of url regexps with content-type matching and replacement pairs | |
| I would add regexp flags as a third element of replacement list |
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
| #!/usr/bin/env python3 | |
| import re | |
| import zlib | |
| pdf = open("some_doc.pdf", "rb").read() | |
| stream = re.compile(rb'.*?FlateDecode.*?stream(.*?)endstream', re.S) | |
| for s in stream.findall(pdf): | |
| s = s.strip(b'\r\n') | |
| try: |