Skip to content

Instantly share code, notes, and snippets.

@alexfdezsauco
Created September 26, 2020 23:10
Show Gist options
  • Save alexfdezsauco/7935045536e7df3d4b32a0d8bf0b2b2a to your computer and use it in GitHub Desktop.
Save alexfdezsauco/7935045536e7df3d4b32a0d8bf0b2b2a to your computer and use it in GitHub Desktop.
Capturing Anti-Scrapping Cookie
var httpClient = new HttpClient();
var requester = new HttpClientRequester(httpClient);
var config = Configuration.Default.WithRequester(requester).WithDefaultLoader(new LoaderOptions { IsResourceLoadingEnabled = true }).WithJs();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync("https://www.tuenvio.cu/stores.json").WaitUntilAvailable();
// Capturing parameters
var toNumbersACall = RegexA.Match(content).Groups[1].Value;
var toNumbersBCall = RegexB.Match(content).Groups[1].Value;
var toNumbersCCall = RegexC.Match(content).Groups[1].Value;
var parameters = parametersMatch.Groups[2].Value;
parameters = parameters.Replace("a", "%A%").Replace("b", "%B%").Replace("c", "%C%");
parameters = parameters.Replace("%A%", toNumbersACall).Replace("%B%", toNumbersBCall).Replace("%C%", toNumbersCCall);
//...
cookieValue = document.ExecuteScript($"toHex(slowAES.decrypt({parameters}))").ToString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment