Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fiddler Auto Responder + Regular Expression

Tags:

regex

fiddler

I know that the title is not very descriptive but here's what I just cant figure out!! Okay so I have something like the following URL:

http://realsite.com/Stuff/start.ashx?blah=blah1&RandomStuffHere&blah=false

So I need to either redirect it or supply it with my site:

http://My_Site.com/Stuff/newstart.ashx?blah=blah1&RandomStuffHere&blah=true

Realize how I kept everything the same except for the domain which I changed to mine, and the bool value at the end. I have searched, and searched and still cant find anything that works.

I currently am trying a REGEX solution but it wont let me change the bool at end. REGEX:.*/Stuff/start.ashx(.*)

So if anyone can provide something like this that lets me redirect to my site with everything the same as the New url except for changing the bool at end, I will be forever in your debt! :D

Thank you in advance :)

like image 560
Jackendra Avatar asked Feb 16 '14 22:02

Jackendra


1 Answers

Fiddler Auto Responder might not be the right thing for you, the position of the query string parameters and other strings in the URL is important for a regex.

Alternative

Consider using FiddlerScript where you can redirect traffic to your domain like this:

Inside OnBeforeRequest

if (oSession.HostnameIs("realsite.com") && oSession.uriContains("Stuff/start.ashx")) {
    oSession.hostname = "My_Site.com";
    oSession.url = oSession.url.Replace("Stuff/start.ashx", "newstuff/start.ashx");
    oSession.url = oSession.url.Replace("&blah=false", "&blah=true");
}

Although this example is not 100% accurate this should get you going in the right direction. This gives you more control over manipulating complex URLs, which your URL's look like they could get complex.

Auto Responder

The regex would look something like this, capturing the "random" parts of the URL, assumes blah=false is always at the end:

regex:(?insx)^http://realsite.com/Stuff/start.ashx?(.*)&blah=false$ #Match the query string always with blah=false at end

And the replacement:

http://My_Site.com/Stuff/newstart.ashx?$1&blah=true

Here is a screen grab for completeness: Screen grab of regex in place in Fiddler

like image 130
Dean Taylor Avatar answered Oct 02 '22 13:10

Dean Taylor