Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
mitmproxy script for showing omniture events, evars, and props
$ mitmdump -q -s
import re
class color:
BLUE = '\033[94m'
GREEN = '\033[92m'
RED = '\033[91m'
END = '\033[0m'
def request(ctx, flow):
if not''):
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 ="/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