Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mitmproxy script for showing omniture events, evars, and props
$ mitmdump -q -s mitm_omniture.py
import re
class color:
BLUE = '\033[94m'
GREEN = '\033[92m'
RED = '\033[91m'
END = '\033[0m'
def request(ctx, flow):
if not flow.request.host.endswith('2o7.net'):
return
q = flow.request.get_query()
evar_keys = [k for k in q.keys() if re.match('^v\d+$', k)]
prop_keys = [k for k in q.keys() if re.match('^c\d+$', k)]
evars = " ".join(["%s=%s"%(k, q[k][0]) for k in evar_keys])
props = " ".join(["%s=%s"%(k, q[k][0]) for k in prop_keys])
suite = re.search("/ss/([^/]+)", flow.request.path).group(1)
page_name = " ".join(q['pageName'])
events = " ".join(q['events'])
print "%s %s %s%s%s %s%s%s %s%s%s"%(suite, page_name,
color.BLUE, events, color.END,
color.RED, evars, color.END,
color.GREEN, props, color.END)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.