Advertisement
SirSpamModz

bypass url black list on most forum software.

Jun 27th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.07 KB | None | 0 0
  1.         private static class FilterBypaser
  2.         {
  3.             private static bool hasInitialized = false;
  4.  
  5.             private static void Initialize()
  6.             {
  7.                 if (hasInitialized)
  8.                     return;
  9.                 else
  10.                     hasInitialized = true;
  11.  
  12.                 exclusionList = new char[] { '.', '/' };
  13.  
  14.                 bool excluded = false;
  15.  
  16.                 for (uint i = 0x20; i < 255; i++, excluded = false)
  17.                 {
  18.                     for (int j = 0; j < exclusionList.Length && !excluded; j++)
  19.                         excluded = exclusionList[j] == (char)i;
  20.  
  21.                     if (excluded)
  22.                         continue;
  23.  
  24.                     replacments.Add(new Replacments()
  25.                     {
  26.                         Character = ((char)((byte)i)),
  27.                         CharacterReplacment = string.Format("%{0}", i.ToString("X")),
  28.                     });
  29.                 }
  30.             }
  31.  
  32.             private static char[] exclusionList;
  33.             private static List<Replacments> replacments = new List<Replacments>();
  34.  
  35.             private struct Replacments
  36.             {
  37.                 public char Character;
  38.                 public string CharacterReplacment;
  39.             }
  40.  
  41.             public static string GetBbCodeFilter(string url)
  42.             {
  43.                 Initialize();
  44.  
  45.                 string encodedUrl = null;
  46.                 bool foundReplacment = false;
  47.  
  48.                 for (int i = 0; i < url.Length; i++, foundReplacment = false)
  49.                 {
  50.                     for (int j = 0; j < replacments.Count && !foundReplacment; j++)
  51.                         if ((foundReplacment = (url[i] == replacments[j].Character)))
  52.                             encodedUrl = string.Format("{0}{1}", encodedUrl, replacments[j].CharacterReplacment);
  53.  
  54.                     if (!foundReplacment)
  55.                         encodedUrl += url[i];
  56.                 }
  57.  
  58.                 return string.Format("[url=\"{0}\"]Enter click here text[/url]", encodedUrl);
  59.             }
  60.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement