dessel191

Untitled

Feb 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.90 KB | None | 0 0
  1. public static string SqlChujection(string userInput)
  2.         {
  3.             string[] sqlCheckList = {   "'",
  4.                                         "--",
  5.                                         ";--",
  6.                                         ";",
  7.                                         "/*",
  8.                                         "*/",
  9.                                         "@@",
  10.                                         "@",
  11.                                         "char",
  12.                                         "nchar",
  13.                                         "varchar",
  14.                                         "nvarchar",
  15.                                         "alter",
  16.                                         "begin",
  17.                                         "cast",
  18.                                         "create",
  19.                                         "cursor",
  20.                                         "declare",
  21.                                         "delete",
  22.                                         "drop",
  23.                                         "end",
  24.                                         "exec",
  25.                                         "execute",
  26.                                         "fetch",
  27.                                         "insert",
  28.                                         "kill",
  29.                                         "select",
  30.                                         "sys",
  31.                                         "sysobjects",
  32.                                         "syscolumns",
  33.                                         "table",
  34.                                         "update"};
  35.             for (int i = 0; i <= sqlCheckList.Length - 1; i++)
  36.             {
  37.                 userInput = userInput.Replace(sqlCheckList[i].ToLower(), " ");
  38.                 userInput = userInput.Replace(sqlCheckList[i].ToUpper(), " ");
  39.             }
  40.             return userInput;
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment