Skip to content

Instantly share code, notes, and snippets.

@secator
Created July 21, 2021 12:44
Show Gist options
  • Save secator/ab0424b5e08dff8127d5ef413a78d0e6 to your computer and use it in GitHub Desktop.
Save secator/ab0424b5e08dff8127d5ef413a78d0e6 to your computer and use it in GitHub Desktop.
fiddler url repeater
/*
https://example.com/?id={@start_decimal@,@limit_decimal@}
https://example.com/?id={@0@,@999@}
*/
static function OnBeforeRequest(oSession: Session) {
var regex = /{@([0-9]+)@,@([0-9]+)@}/i;
var repeater = oSession.PathAndQuery.match(regex);
if (repeater) {
var path = oSession.PathAndQuery;
var headers = oSession.oRequest.headers;
headers = headers.ToString();
headers = headers.Substring(headers.IndexOf(Environment.NewLine) + 1);
var body = oSession.GetRequestBodyAsString();
var start = Int32.Parse(repeater[1]);
var limit = Int32.Parse(repeater[2]);
for (var x = start; x < start+limit; x++){
oSession.PathAndQuery = path.replace(regex, x);
if (x < start+limit-1) {
FiddlerObject.utilIssueRequest("GET " + oSession.fullUrl + " HTTP/1.1" +
Environment.NewLine + headers.ToString().Trim() +
Environment.NewLine + Environment.NewLine + body.Trim());
}
System.Threading.Thread.Sleep(2000);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment