What is best practice for replace response via mitmproxy My steps:
- write script (see below)
- run mitmdump -p 8080 -s myplugin.py
- open browser and via mitmproxy go to http://ift.tt/2nwb63x I got a blank screen (load a bit a page)
- open http://ift.tt/2nwb63x via curl with mitmproxy and get other bit of page
What is the best practice for replace response from one server to other server. plugin code:
def response(flow):
new_resp = requests.get('https://google.com')
new_resp_headers=dict(new_resp.headers.items())
#prepare byte headers
byte_headers = [(str.encode(k), str.encode(v)) for k, v in new_resp_headers.items()]
#replace responce
flow.response.status_code = new_resp.status_code
flow.response.content = new_resp.content
flow.response.data.headers = Headers(byte_headers)
another way is is
new_resp = Response.make(200,authenticated_responce.content,byte_headers )
flow.response = new_resp
call AttributeError: 'Response' object has no attribute 'is_replay'
What is true method for this? Site for replace is may be reach with ajax html5 and other technology
Aucun commentaire:
Enregistrer un commentaire