Duplicate Flow and Replay


My old script with mitmproxy 0.15 was works great, but when I switched to 1.0.2 version, duplicate and replay not works as I expected and I don’t know how fix it.

def makeDictAndRequest(data):
   list = foo(data)
   for item in list:
      dict = createDict(item)

    global allData
    nf = allData['flow'].copy() #Previos flow saved on allData global variable
    newFlow = changeFlowRequest(nf, dict)

The behaviour I want is make a new request per every item in list and every request is paused three seconds before the next request, but I get all requests without pause and without order.

How can I get pause between requests and in the same order in list.

Another question is how can I create a new thread with a replay request?

Hi, @paskyorg, did you have any luck in replaying the request? Actually, there is this dup_and_replay script in the mitmproxy repository. I tested that script but “ctx.master.replay_request” keeps sending http request without pause.
Do you know how to send the request exactly once?

When you play this script, replay_request makes a new call to request function. It’s recursive.

Put a condition to break this behaviour or do replay_request in response function, instead request.

@ppsun You can do this:

   ctx.master.replay_request() ```

Thanks for the advice!

Thanks. This works perfectly!