I have this brute force code, where you input a password and runs through combinations of numbers, lowercase and uppercase letters, and special characters until it match the password given.
The problem with it, is that it took about 2 days just to crack the password "password".
What is a way that I can speed up this process and get the passwords faster? Is there a way I can implement multi-threading to speed up the process?
All I'm really asking is, is there a better way for the program to run through all of the characters and match the password faster?
//This program is used for a school project, where I have to create a list of commonly used passwords and run them through the program and see how long it take for the program to crack them. *I would like to get the best result possible and speed up the process*
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
namespace Bruteforce
{
class Program
{
//define likely password characters
static char[] Match = {'0','1','2','3','4','5','6','7','8','9','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','C','L','M','N','O','P',
'Q','R','S','T','U','V','X','Y','Z','!','?',' ','*','-','+'};
//your password
static string FindPassword;
static int Combi;
static string space;
static int Characters;
static void Main(string[] args)
{
Console.Title = "Brute Force";
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("ALL FILES LOADED...");
Console.ForegroundColor = ConsoleColor.White;
space = " ";
int Count;
//user types in a password
Console.WriteLine("Welcome to BRUTE FORCE");
Console.WriteLine("This program was crated by Nick");
Console.WriteLine(space);
Console.WriteLine("Enter your Password:");
//initialize your password
FindPassword = (Console.ReadLine());
Characters = FindPassword.Length;
Console.Clear();
DateTime today = DateTime.Now;
today.ToString("yyyy-MM-dd_HH:mm:ss");
Console.WriteLine(space);
Console.WriteLine("START:\t{0}", today);
for (Count = 0; Count <= 15; Count++)
{
Recurse(Count, 0, "");
}
}
static void Recurse(int Lenght, int Position, string BaseString)
{
int Count = 0;
for (Count = 0; Count < Match.Length ; Count++)
{
Combi++;
if (Position < Lenght - 1)
{
Recurse(Lenght, Position + 1, BaseString + Match[Count]);
}
if (BaseString + Match[Count] == FindPassword)
{
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("Your password is: " + FindPassword);
Console.WriteLine("Your password is: " + Characters + " character(s) long");
Console.ForegroundColor = ConsoleColor.White;
DateTime today = DateTime.Now;
today.ToString("yyyy-MM-dd_HH:mm:ss");
Console.WriteLine(space);
Console.WriteLine("END:\t{0}\nCombi:\t{1}", today, Combi);
Console.ReadLine();
Environment.Exit(0);
}
}
}
}
}