Hello,
I am fairly new to mitmproxy, proxy/network related topics and also python. Though I am not so great at it, i managed to get some scripts started. I ran into a snag. Not sure if this is a mitmproxy issue or a python issue for me. Basically, what i am trying to accomplish is I want to parse the flow.response.body using regex. I am having a hard time because the response flow.response.body is an xml response. Here is an example of what i would like to do below. Can someone help me to do it the correct way?
Thank you
import xml.etree.ElementTree as ET
import re
def response(context, flow):
requestUrl = flow.request.url
if 'https://blahblahblah.com' == requestUrl:
tree = ET.parse(flow.response.body)
root = tree.getroot()
responseString = ET.tostring(root).decode('utf-8')
parsedVal = re.findall(r'(?<=over.).*?(?=here)', responseString)
print('this is the paresed value ' + parsedVal)