Last active
August 29, 2015 14:17
-
-
Save trcio/02fc7210beb6a3953b18 to your computer and use it in GitHub Desktop.
A simple bypass of opticcdn protection, set the cookie "optic_auth" to the value the method returns (returns null on failure)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetOpticCdnCookie(string source) | |
{ | |
var matches = Regex.Matches(source, "var .* = \"(.*)\""); | |
if (matches.Count != 10) return null; | |
var combined = string.Concat(matches[0].Groups[1].Value, matches[1].Groups[1].Value, | |
matches[2].Groups[1].Value, matches[3].Groups[1].Value, matches[8].Groups[1].Value, | |
matches[9].Groups[1].Value, matches[4].Groups[1].Value, matches[5].Groups[1].Value, | |
matches[6].Groups[1].Value, matches[7].Groups[1].Value); | |
using (var sha = new SHA1Managed()) | |
{ | |
return BitConverter.ToString(sha.ComputeHash(Encoding.UTF8.GetBytes(combined))).Replace("-", "").ToLowerInvariant().Substring(0, 30); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment