Skip to content

Instantly share code, notes, and snippets.

@alexalwks
alexalwks / mitmproxy_dumb_injector_example.py
Created June 26, 2020 18:32 — forked from digitalist/mitmproxy_dumb_injector_example.py
Little quick and dirty mitmproxy response rewrite example
# (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
@alexalwks
alexalwks / pdf_flatedecode.py
Created May 18, 2020 20:28 — forked from averagesecurityguy/pdf_flatedecode.py
Decompress FlateDecode Objects in PDF
#!/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: