mitm script位置修改
This commit is contained in:
parent
8c10aa1848
commit
a595bcf731
25
proxy_script.py
Normal file
25
proxy_script.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# ! IMPORT ! make sure you ran mitmproxy with this script,
|
||||||
|
# eg: `/path/to/mitmproxy -s mitmproxy.py`
|
||||||
|
import time
|
||||||
|
from mitmproxy import http
|
||||||
|
import re
|
||||||
|
import requests
|
||||||
|
|
||||||
|
session = requests.session()
|
||||||
|
|
||||||
|
|
||||||
|
class Writer:
|
||||||
|
def websocket_message(self, flow: http.HTTPFlow):
|
||||||
|
re_c = re.search('webcast\d-ws-web-.*\.douyin\.com', flow.request.host)
|
||||||
|
if re_c:
|
||||||
|
message = flow.websocket.messages[-1]
|
||||||
|
if message.from_client:
|
||||||
|
return
|
||||||
|
content = message.content
|
||||||
|
session.post("http://127.0.0.1:5000/message", headers={
|
||||||
|
"X-MITM-TS": str(time.time()),
|
||||||
|
"X_REFERER": flow.request.host
|
||||||
|
}, data=content, timeout=(1, 1))
|
||||||
|
|
||||||
|
|
||||||
|
addons = [Writer()]
|
Reference in New Issue
Block a user