Ejemplo n.º 1
0
        private static char[] ToCharArray(Passes p)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(p.password);
            sb.Append(" ");
            sb.Append(p.MD5);
            sb.Append(" ");
            sb.Append(p.SHA1);
            sb.Append(" ");
            sb.Append(p.SHA256);
            sb.Append(" ");
            sb.Append(p.SHA384);
            sb.Append(" ");
            sb.Append(p.SHA512);


            return(sb.ToString().ToCharArray());
        }
Ejemplo n.º 2
0
        private static void Deserialize()
        {
            passwords.Clear();
            Stream       stream = new FileStream("MyFile.bin", FileMode.Open, FileAccess.Read, FileShare.Read);
            StreamReader sr     = new StreamReader(stream);
            string       pc     = sr.ReadLine();

            while (pc != null)
            {
                string[] pcTokens = pc.Split(' ');
                Passes   p        = new Passes();
                p.password = pcTokens[0];
                p.MD5      = pcTokens[1].ToCharArray();
                p.SHA1     = pcTokens[2].ToCharArray();
                p.SHA256   = pcTokens[3].ToCharArray();
                p.SHA384   = pcTokens[4].ToCharArray();
                p.SHA512   = pcTokens[5].ToCharArray();
                passwords.Add(p);
                pc = sr.ReadLine();
            }
            sr.Close();
            stream.Close();
        }
Ejemplo n.º 3
0
        private static void SendBulk()
        {
            passwords.Clear();
            int UpperLimit = passwords.Count;

            Stopwatch sw = new Stopwatch();

            sw.Start();
            sw.Stop();
            try
            {
                conn.Open();
                int count = 0;

                DataTable dt = new DataTable();
                dt.Columns.Add("Password", typeof(string));
                dt.Columns.Add("MD5", typeof(char[]));
                dt.Columns.Add("SHA1", typeof(char[]));
                dt.Columns.Add("SHA256", typeof(char[]));
                dt.Columns.Add("SHA384", typeof(char[]));
                dt.Columns.Add("SHA512", typeof(char[]));

                SqlBulkCopy bk = new SqlBulkCopy(conn);

                SqlBulkCopyColumnMapping cmpass = new SqlBulkCopyColumnMapping("Password", "Password");
                SqlBulkCopyColumnMapping cmmd5  = new SqlBulkCopyColumnMapping("MD5", "MD5");
                SqlBulkCopyColumnMapping cmsha1 = new SqlBulkCopyColumnMapping("SHA1", "SHA1");
                SqlBulkCopyColumnMapping cmsha2 = new SqlBulkCopyColumnMapping("SHA256", "SHA256");
                SqlBulkCopyColumnMapping cmsha3 = new SqlBulkCopyColumnMapping("SHA384", "SHA384");
                SqlBulkCopyColumnMapping cmsha5 = new SqlBulkCopyColumnMapping("SHA512", "SHA512");

                bk.ColumnMappings.Add(cmpass);
                bk.ColumnMappings.Add(cmmd5);
                bk.ColumnMappings.Add(cmsha1);
                bk.ColumnMappings.Add(cmsha2);
                bk.ColumnMappings.Add(cmsha3);
                bk.ColumnMappings.Add(cmsha5);

                bk.DestinationTableName = "HashRainbow";
                bk.BatchSize            = 10000;

                Stream       stream = new FileStream("MyFile.bin", FileMode.Open, FileAccess.Read, FileShare.Read);
                StreamReader sr     = new StreamReader(stream);
                string       pc     = sr.ReadLine();
                while (pc != null)
                {
                    string[] pcTokens = pc.Split(' ');
                    Passes   p        = new Passes();
                    p.password = pcTokens[0];
                    p.MD5      = pcTokens[1].ToCharArray();
                    p.SHA1     = pcTokens[2].ToCharArray();
                    p.SHA256   = pcTokens[3].ToCharArray();
                    p.SHA384   = pcTokens[4].ToCharArray();
                    p.SHA512   = pcTokens[5].ToCharArray();
                    DataRow dr = dt.NewRow();
                    dr["Password"] = p.password;
                    dr["MD5"]      = p.MD5.Take(32).ToArray();
                    dr["SHA1"]     = p.SHA1.Take(40).ToArray();
                    dr["SHA256"]   = p.SHA256.Take(64).ToArray();
                    dr["SHA384"]   = p.SHA384.Take(96).ToArray();
                    dr["SHA512"]   = p.SHA512.Take(128).ToArray();
                    dt.Rows.Add(dr);
                    count++;
                    pc = sr.ReadLine();

                    if (count > 3960458 || pc == null)
                    {
                        count = 0;
                        sw.Start();
                        bk.WriteToServer(dt);
                        sw.Stop();
                        dt.Rows.Clear();
                        Console.WriteLine("O treime");
                    }
                }
                sr.Close();
                stream.Close();
            }
            catch (SqlException e) { Console.WriteLine("conn failed to open. err: " + e.Message); }

            finally
            {
                conn.Close();
            }
            sw.Stop();
            TimeSpan ts      = sw.Elapsed;
            string   elapsed = String.Format("{0:00} : {1:00} : {2:00} : {3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);

            Console.WriteLine(elapsed);
        }
Ejemplo n.º 4
0
        private static void generatePasswords()
        {
            /*
             * MD5 32
             * SHA1 40
             * SHA256 64
             * SHA384 96
             * SHA512 128
             */

            Thread t1 = new Thread(() =>
            {
                char[] charArr = new char[5];
                for (char c1 = 'a'; c1 <= 'd'; c1++) //a=>d
                {
                    for (char c2 = 'a'; c2 <= 'z'; c2++)
                    {
                        for (char c3 = 'a'; c3 <= 'z'; c3++)
                        {
                            for (char c4 = 'a'; c4 <= 'z'; c4++)
                            {
                                for (char c5 = 'a'; c5 <= 'z'; c5++)
                                {
                                    charArr[0] = c1;
                                    charArr[1] = c2;
                                    charArr[2] = c3;
                                    charArr[3] = c4;
                                    charArr[4] = c5;

                                    string pass = String.Concat(charArr);

                                    if (c1 == c2 && c2 == c3 && c3 == c4 && c4 == c5)
                                    {
                                        Console.WriteLine(pass);
                                    }

                                    Passes p   = new Passes();
                                    p.password = pass;
                                    p.MD5      = MD5Hash(pass);
                                    p.SHA1     = SHA1Hash(pass);
                                    p.SHA256   = SHA256Hash(pass);
                                    p.SHA384   = SHA384Hash(pass);
                                    p.SHA512   = SHA512Hash(pass);

                                    passwordsSynchronized.Add(p);
                                }
                            }
                        }
                    }
                }
                Console.WriteLine("Thread1 done");
            });
            Thread t2 = new Thread(() =>
            {
                char[] charArr = new char[5];
                for (char c1 = 'e'; c1 <= 'h'; c1++)
                {
                    for (char c2 = 'a'; c2 <= 'z'; c2++)
                    {
                        for (char c3 = 'a'; c3 <= 'z'; c3++)
                        {
                            for (char c4 = 'a'; c4 <= 'z'; c4++)
                            {
                                for (char c5 = 'a'; c5 <= 'z'; c5++)
                                {
                                    charArr[0] = c1;
                                    charArr[1] = c2;
                                    charArr[2] = c3;
                                    charArr[3] = c4;
                                    charArr[4] = c5;

                                    string pass = String.Concat(charArr);

                                    if (c1 == c2 && c2 == c3 && c3 == c4 && c4 == c5)
                                    {
                                        Console.WriteLine(pass);
                                    }


                                    Passes p   = new Passes();
                                    p.password = pass;
                                    p.MD5      = MD5Hash(pass);
                                    p.SHA1     = SHA1Hash(pass);
                                    p.SHA256   = SHA256Hash(pass);
                                    p.SHA384   = SHA384Hash(pass);
                                    p.SHA512   = SHA512Hash(pass);

                                    passwordsSynchronized.Add(p);
                                }
                            }
                        }
                    }
                }
                Console.WriteLine("Thread2 done");
            });
            Thread t3 = new Thread(() =>
            {
                char[] charArr = new char[5];
                for (char c1 = 'i'; c1 <= 'l'; c1++)
                {
                    for (char c2 = 'a'; c2 <= 'z'; c2++)
                    {
                        for (char c3 = 'a'; c3 <= 'z'; c3++)
                        {
                            for (char c4 = 'a'; c4 <= 'z'; c4++)
                            {
                                for (char c5 = 'a'; c5 <= 'z'; c5++)
                                {
                                    charArr[0] = c1;
                                    charArr[1] = c2;
                                    charArr[2] = c3;
                                    charArr[3] = c4;
                                    charArr[4] = c5;

                                    string pass = String.Concat(charArr);

                                    if (c1 == c2 && c2 == c3 && c3 == c4 && c4 == c5)
                                    {
                                        Console.WriteLine(pass);
                                    }

                                    Passes p   = new Passes();
                                    p.password = pass;
                                    p.MD5      = MD5Hash(pass);
                                    p.SHA1     = SHA1Hash(pass);
                                    p.SHA256   = SHA256Hash(pass);
                                    p.SHA384   = SHA384Hash(pass);
                                    p.SHA512   = SHA512Hash(pass);

                                    passwordsSynchronized.Add(p);
                                }
                            }
                        }
                    }
                }
                Console.WriteLine("Thread3 done");
            });
            Thread t4 = new Thread(() =>
            {
                char[] charArr = new char[5];
                for (char c1 = 'm'; c1 <= 'p'; c1++)
                {
                    for (char c2 = 'a'; c2 <= 'z'; c2++)
                    {
                        for (char c3 = 'a'; c3 <= 'z'; c3++)
                        {
                            for (char c4 = 'a'; c4 <= 'z'; c4++)
                            {
                                for (char c5 = 'a'; c5 <= 'z'; c5++)
                                {
                                    charArr[0] = c1;
                                    charArr[1] = c2;
                                    charArr[2] = c3;
                                    charArr[3] = c4;
                                    charArr[4] = c5;

                                    string pass = String.Concat(charArr);

                                    if (c1 == c2 && c2 == c3 && c3 == c4 && c4 == c5)
                                    {
                                        Console.WriteLine(pass);
                                    }

                                    Passes p   = new Passes();
                                    p.password = pass;
                                    p.MD5      = MD5Hash(pass);
                                    p.SHA1     = SHA1Hash(pass);
                                    p.SHA256   = SHA256Hash(pass);
                                    p.SHA384   = SHA384Hash(pass);
                                    p.SHA512   = SHA512Hash(pass);

                                    passwordsSynchronized.Add(p);
                                }
                            }
                        }
                    }
                }
                Console.WriteLine("Thread4 done");
            });
            Thread t5 = new Thread(() =>
            {
                char[] charArr = new char[5];
                for (char c1 = 'q'; c1 <= 't'; c1++)
                {
                    for (char c2 = 'a'; c2 <= 'z'; c2++)
                    {
                        for (char c3 = 'a'; c3 <= 'z'; c3++)
                        {
                            for (char c4 = 'a'; c4 <= 'z'; c4++)
                            {
                                for (char c5 = 'a'; c5 <= 'z'; c5++)
                                {
                                    charArr[0] = c1;
                                    charArr[1] = c2;
                                    charArr[2] = c3;
                                    charArr[3] = c4;
                                    charArr[4] = c5;

                                    string pass = String.Concat(charArr);

                                    if (c1 == c2 && c2 == c3 && c3 == c4 && c4 == c5)
                                    {
                                        Console.WriteLine(pass);
                                    }

                                    Passes p   = new Passes();
                                    p.password = pass;
                                    p.MD5      = MD5Hash(pass);
                                    p.SHA1     = SHA1Hash(pass);
                                    p.SHA256   = SHA256Hash(pass);
                                    p.SHA384   = SHA384Hash(pass);
                                    p.SHA512   = SHA512Hash(pass);

                                    passwordsSynchronized.Add(p);
                                }
                            }
                        }
                    }
                }
                Console.WriteLine("Thread5 done");
            });
            Thread t6 = new Thread(() =>
            {
                char[] charArr = new char[5];
                for (char c1 = 'u'; c1 <= 'x'; c1++)
                {
                    for (char c2 = 'a'; c2 <= 'z'; c2++)
                    {
                        for (char c3 = 'a'; c3 <= 'z'; c3++)
                        {
                            for (char c4 = 'a'; c4 <= 'z'; c4++)
                            {
                                for (char c5 = 'a'; c5 <= 'z'; c5++)
                                {
                                    charArr[0] = c1;
                                    charArr[1] = c2;
                                    charArr[2] = c3;
                                    charArr[3] = c4;
                                    charArr[4] = c5;

                                    string pass = String.Concat(charArr);

                                    if (c1 == c2 && c2 == c3 && c3 == c4 && c4 == c5)
                                    {
                                        Console.WriteLine(pass);
                                    }

                                    Passes p   = new Passes();
                                    p.password = pass;
                                    p.MD5      = MD5Hash(pass);
                                    p.SHA1     = SHA1Hash(pass);
                                    p.SHA256   = SHA256Hash(pass);
                                    p.SHA384   = SHA384Hash(pass);
                                    p.SHA512   = SHA512Hash(pass);

                                    passwordsSynchronized.Add(p);
                                }
                            }
                        }
                    }
                }
                Console.WriteLine("Thread6 done");
            });
            Thread t7 = new Thread(() =>
            {
                char[] charArr = new char[5];
                for (char c1 = 'y'; c1 <= 'z'; c1++)
                {
                    for (char c2 = 'a'; c2 <= 'z'; c2++)
                    {
                        for (char c3 = 'a'; c3 <= 'z'; c3++)
                        {
                            for (char c4 = 'a'; c4 <= 'z'; c4++)
                            {
                                for (char c5 = 'a'; c5 <= 'z'; c5++)
                                {
                                    charArr[0] = c1;
                                    charArr[1] = c2;
                                    charArr[2] = c3;
                                    charArr[3] = c4;
                                    charArr[4] = c5;

                                    string pass = String.Concat(charArr);

                                    if (c1 == c2 && c2 == c3 && c3 == c4 && c4 == c5)
                                    {
                                        Console.WriteLine(pass);
                                    }

                                    Passes p   = new Passes();
                                    p.password = pass;
                                    p.MD5      = MD5Hash(pass);
                                    p.SHA1     = SHA1Hash(pass);
                                    p.SHA256   = SHA256Hash(pass);
                                    p.SHA384   = SHA384Hash(pass);
                                    p.SHA512   = SHA512Hash(pass);

                                    passwordsSynchronized.Add(p);
                                }
                            }
                        }
                    }
                }
                Console.WriteLine("Thread7 done");
            });

            t1.Start();
            t2.Start();
            t3.Start();
            t4.Start();
            t5.Start();
            t6.Start();
            t7.Start();

            t1.Join();
            t2.Join();
            t3.Join();
            t4.Join();
            t5.Join();
            t6.Join();
            t7.Join();
        }