@CyanCoding/

C# Brute Force Password Cracker

C#

You thought your password was strong...

fork
loading
Files
  • main.cs
  • main.exe

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.7481918541149004","path":"main.cs","file":{"path":"main.cs","content":{"asEncoding":{"base64":"dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3M7CnVzaW5nIFN5c3RlbS5JTzsKCm5hbWVzcGFjZSBCcnV0ZV9Gb3JjZV9BdHRhY2tlciB7CiAgICBjbGFzcyBQcm9ncmFtIHsKICAgICAgICBwdWJsaWMgY2hhciBmaXJzdGNoYXIgPSAnYSc7CiAgICAgICAgcHVibGljIGNoYXIgbGFzcmNoYXIgPSAneic7CiAgICAgICAgcHVibGljIGludCBwYXNzd29yZExlbmd0aCA9IDY7CiAgICAgICAgcHVibGljIGxvbmcgdHJpZXMgPSAwOwogICAgICAgIHB1YmxpYyBib29sIGRvbmUgPSBmYWxzZTsKICAgICAgICBwdWJsaWMgc3RyaW5nIHBhc3N3b3JkID0gImhleSI7CiAgICAgICAgcHVibGljIHZvaWQgQ3JlYXRlUGFzc3dvcmRzKHN0cmluZyBrZXlzKSB7CiAgICAgICAgICAgIGlmIChrZXlzID09IHBhc3N3b3JkKSB7CiAgICAgICAgICAgICAgICBkb25lID0gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoa2V5cy5MZW5ndGggPT0gcGFzc3dvcmRMZW5ndGggfHwgZG9uZSA9PSB0cnVlKSB7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZm9yIChjaGFyIGMgPSBmaXJzdGNoYXI7IGMgPD0gbGFzcmNoYXI7IGMrKykgewogICAgICAgICAgICAgICAgdHJpZXMrKzsKICAgICAgICAgICAgICAgIENyZWF0ZVBhc3N3b3JkcyhrZXlzICsgYyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc3RhdGljIHZvaWQ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ItLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIik7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiUGFzc3dvcmQ6IHswfSIsIHByb2dyYW0ucGFzc3dvcmQpOwogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlBhc3N3b3JkIGxlbmd0aDogezB9IiwgcHJvZ3JhbS5wYXNzd29yZExlbmd0aCk7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVHJpZXM6IHswfSIsIHByb2dyYW0udHJpZXMpOwogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlRpbWUgdG8gY3JhY2s6IHswfSBzZWNvbmRzIiwgZWxhcHNlZFRpbWUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIFN5c3RlbS5UaHJlYWRpbmcuVGhyZWFkLlNsZWVwKDUwMDApOwogICAgICAgICAgICBDb25zb2xlLkZvcmVncm91bmRDb2xvciA9IENvbnNvbGVDb2xvci5EYXJrWWVsbG93OwogICAgICAgICAgICBDb25zb2xlLldyaXRlKCJcblxuUHJlc3MgYW55IGtleSB0byBjbG9zZSIpOwogICAgICAgICAgICBDb25zb2xlLlJlYWRLZXkoKTsKICAgICAgICB9CiAgICB9Cn0K"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using System.Diagnostics;
using System.IO;

namespace Brute_Force_Attacker {
    class Program {
        public char firstchar = 'a';
        public char lasrchar = 'z';
        public int passwordLength = 6;
        public long tries = 0;
        public bool done = false;
        public string password = "hey";
        public void CreatePasswords(string keys) {
            if (keys == password) {
                done = true;
            }
            if (keys.Length == passwordLength || done == true) {
                return;
            }
            for (char c = firstchar; c <= lasrchar; c++) {
                tries++;
                CreatePasswords(keys + c);
            }
        }
        static void Main(string[] args) {
            Program program = new Program();
            Console.ForegroundColor = ConsoleColor.DarkRed;
            Console.WriteLine("Welcome to the C# Brute Force Password Cracker!");
            System.Threading.Thread.Sleep(3000);
            Console.Write("This program was created by ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.Write("CyanCoding");
            Console.ForegroundColor = ConsoleColor.DarkRed;
            Console.WriteLine(".");
            System.Threading.Thread.Sleep(2800);
            Console.WriteLine("Note that passwords found in under a second won't tell you how many passwords per second they got.");
            System.Threading.Thread.Sleep(5000);
            Console.WriteLine("Also, for those of you who aren't patient, I made it so that it only guesses at lowercase letters.");
            System.Threading.Thread.Sleep(5000);
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.Write("\nPlease enter your password > ");
            program.password = Convert.ToString(Console.ReadLine());
            program.password = program.password.ToLower();
            Console.ForegroundColor = ConsoleColor.DarkRed;
            Console.WriteLine("\nCracking your password...");
            Stopwatch timer = Stopwatch.StartNew();
            program.passwordLength = program.password.Length;
            program.CreatePasswords(string.Empty);
            timer.Stop();
            long elapsedMs = timer.ElapsedMilliseconds;
            double elapsedTime = elapsedMs / 1000;
            if (elapsedTime > 0) {
                Console.WriteLine("\n\nYour password has been found! Here are the statistics:");
                Console.WriteLine("----------------------------------");
                Console.WriteLine("Password: {0}", program.password);
                Console.WriteLine("Password length: {0}", program.passwordLength);
                Console.WriteLine("Tries: {0}", program.tries);
                string plural = "seconds";
                if (elapsedTime == 1) {
                    plural = "second";
                }
                Console.WriteLine("Time to crack: {0} {1}", elapsedTime, plural);
                Console.WriteLine("Passwords per second: {0}", (long)(program.tries / elapsedTime));
            }
            else {
                Console.WriteLine("\n\nYour password has been found! Here are the statistics:");
                Console.WriteLine("----------------------------------");
                Console.WriteLine("Password: {0}", program.password);
                Console.WriteLine("Password length: {0}", program.passwordLength);
                Console.WriteLine("Tries: {0}", program.tries);
                Console.WriteLine("Time to crack: {0} seconds", elapsedTime);
            }
            System.Threading.Thread.Sleep(5000);
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.Write("\n\nPress any key to close");
            Console.ReadKey();
        }
    }
}