使用mitmproxy,我想在某些情况下重新提交带有其他头数据的请求。
看起来我可以复制流,调整标题并调用“ replay.client”来重新提交请求,但是看起来好像直到response()调用完成后才执行重新提交的请求。 mitmproxy显示屏显示命令最终被重新提交,但发回用户的响应是原始响应。
有没有更好的方法可以在response()中重新提交请求,以便可以根据重新提交的响应来更新原始响应?
我也对处理这种重新提交的非拟氨纶建议感兴趣。
下面是我的插件现在的样子:
class MyAddon:
def response(self, flow):
if some_condition:
flow_copy = flow.copy()
flow_copy.request_header['some-header'] = some_header_value
ctx.master.commands.call("replay.client", [flow_copy])
# flow_copy.response ends up being None here
# since it looks like the replay doesn't happen until
# after this method returns.
# Is there some other way to resubmit flow_copy
# so I could access it's response here ?
flow.response = flow_copy.response
addons = [
MyAddon()
]
我怀疑mtmproxy http get request in script可能会要求类似的内容。