Advertisement
akaMeltDown

Simple SQLi tester MeltDown

Oct 28th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.35 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Net;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace SQLi_ToolKit
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             try
  16.             {
  17.                 Console.ForegroundColor = ConsoleColor.White;
  18.                 if (args.Length == 0)
  19.                 {
  20.                     Console.WriteLine("Usage:\nSQLi-ToolKit.exe {target url - Example: http://target.com/index.php?id=1}");
  21.                 }
  22.                 else
  23.                 {
  24.                     string url = args[0];
  25.                     string[] prams;
  26.                     prams = File.ReadAllLines("payloads.txt");
  27.                     string error = "You have an error in your SQL syntax;";
  28.                     Console.ForegroundColor = ConsoleColor.Yellow;
  29.                     Console.WriteLine("");
  30.                     Console.WriteLine("");
  31.                     Console.WriteLine(@"      _____  ____  _      _     _______          _ _  ___ _   ");
  32.                     Console.WriteLine(@"     / ____|/ __ \| |    (_)   |__   __|        | | |/ (_) |  ");
  33.                     Console.WriteLine(@"    | (___ | |  | | |     _ ______| | ___   ___ | | ' / _| |_ ");
  34.                     Console.WriteLine(@"     \___ \| |  | | |    | |______| |/ _ \ / _ \| |  < | | __|");
  35.                     Console.WriteLine(@"     ____) | |__| | |____| |      | | (_) | (_) | | . \| | |_ ");
  36.                     Console.WriteLine(@"    |_____/ \___\_\______|_|      |_|\___/ \___/|_|_|\_\_|\__|");
  37.                     Console.WriteLine("");
  38.                     Console.ForegroundColor = ConsoleColor.Red;
  39.                     Console.WriteLine("                       By: Josh");
  40.                     Console.WriteLine("");
  41.                     Console.WriteLine("");
  42.                     Console.WriteLine("");
  43.                     Console.WriteLine("");
  44.                     Console.ForegroundColor = ConsoleColor.White;
  45.  
  46.  
  47.                     Console.WriteLine("Beginning payload tests on target url: {0}", url);
  48.                     Console.WriteLine("");
  49.                     Console.WriteLine("");
  50.                     foreach (string line in prams)
  51.                     {
  52.                         HttpWebRequest r = (HttpWebRequest)WebRequest.Create(url + line);
  53.                         r.Method = "POST";
  54.                         StreamReader contents = new StreamReader(r.GetResponse().GetResponseStream());
  55.                         string response = contents.ReadToEnd();                  
  56.                         if (response.Contains(error))
  57.                         {
  58.                             Console.ForegroundColor = ConsoleColor.Green;
  59.                            
  60.                             Console.WriteLine("Payload success: {0}", line);
  61.                         }
  62.                         else
  63.                         if (!response.Contains(error))
  64.                         {
  65.                             Console.ForegroundColor = ConsoleColor.Red;
  66.                             Console.WriteLine("Payload failed: {0}", line);
  67.                         }
  68.                         Console.ForegroundColor = ConsoleColor.White;
  69.                     }
  70.              
  71.                 }
  72.             }
  73.  
  74.             catch
  75.             {
  76.                
  77.             }
  78.  
  79.  
  80.  
  81.             }
  82.         }
  83.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement