anyproxy icon indicating copy to clipboard operation
anyproxy copied to clipboard

Is there any way to pause the request before sending to server and then forward it or drop it

Open thepraveenpratap opened this issue 8 years ago • 3 comments

Plese fill the template when you reporting a new issue, thanks!

Which platform are you running AnyProxy

Windows

The version of the AnyProxy

4.0.9

Your expected behavior of AnyProxy

Is there any way to pause the request before sending to server and then forward it or drop it. For example in burp suit , in that we can turn intercept on and off which lets us pause and forward request. I am using electron to develop simple intercept project.

The actual behavior of AnyProxy

The log of the error

thepraveenpratap avatar May 16 '18 09:05 thepraveenpratap

Hi @impraveensingh Maybe the Rule Interface can help you, by rule you can do the program before sending the request.

codingfishman avatar May 17 '18 14:05 codingfishman

Hey, Thanks for quick response, I used the below code but, i was not able to pause the request.

var interceptrules = module.exports = { * beforeSendRequest(requestDetail) { requestDetail._req.client.server.pauseOnConnect = true; }, * beforeSendResponse(requestDetail, responseDetail) { } };

thepraveenpratap avatar May 18 '18 06:05 thepraveenpratap

Try this

function delay(ms, re) {
    return function(callback) { 
        setTimeout(() => {
            callback(re);
        }, ms);
    }
}

module.exports = {
    * beforeSendRequest(requestDetail) {
        //let re = yield new Promise(resolve => {
            //setTimeout(() => resolve(null), 5000);
        //});
        let re= yield delay(5000, null);
        return re;
    },
}

cuixiping avatar May 29 '19 06:05 cuixiping