特定の URL ( ) に送信される POST 要求はhttp://test.com
次のようになります。
{
"messageType": "OK",
"city": {
"Name": "Paris",
"Views": {
"1231": {
"id": 4234,
"enableView": false
},
},
"Views": [5447, 8457],
"messages": [{
"id": "message_6443",
"eTag": 756754338
}]
},
"client": {
"Id": 53,
"email": "test@test.us",
"firstName": "test",
"lastName": "test",
"id": 52352352,
"uuid": "5631f-grdeh4",
"isAdmin": false
}
}
isAdmin
リクエストをインターセプトして trueに変更する必要があります。
また、特定の URL ( https://test.com/profiles/{Random_Numbers}/{id}
) への GET 要求には、次のような (エンコードされた) 応答があります。
{
"id": 0,
"Code": "Admin",
"display": "RRRR"
}
5に変更id
する必要があります。
したがって、基本的には、これらの両方のアクションを実行する 1 つのスクリプトを作成する必要があります。
これまでのところ、GitHub のいくつかの例を利用しようとしましたが、まだ取得できていません。
from libmproxy.protocol.http import decoded
def start(context, argv):
if len(argv) != 3:
raise ValueError('Usage: -s "modify-response-body.py old new"')
context.old, context.new = argv[1], argv[2]
def response(context, flow):
with decoded(flow.response): # automatically decode gzipped responses.
flow.response.content = flow.response.content.replace(context.old, context.new)`
シナリオにこれを実装するにはどうすればよいですか?
おそらく libmproxy を使用して http-request と response を取得する方が良いでしょう。