Skip to content

Instantly share code, notes, and snippets.

@gabriel-lopez
Created December 14, 2019 21:03
Show Gist options
  • Select an option

  • Save gabriel-lopez/9cf869e795c5eb7124a1d156c24aa251 to your computer and use it in GitHub Desktop.

Select an option

Save gabriel-lopez/9cf869e795c5eb7124a1d156c24aa251 to your computer and use it in GitHub Desktop.
Link Protector (protect-link.me) Bypass
using System;
using System.Collections.Generic;
using System.Net.Http;
using HtmlAgilityPack;
public sealed class LinkProtectorBypass
{
private const string URL = "https://protect-link.me/";
private const string USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36";
public static string GetLink(string id)
{
using (HttpClient client = new HttpClient())
{
client.BaseAddress = new Uri(URL);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.UserAgent.Clear();
client.DefaultRequestHeaders.Add("User-Agent", USER_AGENT);
Dictionary<string, string> form = new Dictionary<string, string>();
form.Add("submit1", "Continuer");
HttpResponseMessage response = client.PostAsync(id, new FormUrlEncodedContent(form)).Result;
if (response.IsSuccessStatusCode)
{
string html = response.Content.ReadAsStringAsync().Result;
HtmlDocument htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(html);
HtmlNode link = htmlDocument.DocumentNode.SelectNodes("//a[@href]")[1];
return link.GetAttributeValue("href", string.Empty);
}
}
return string.Empty;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment