Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Security;
- using System.Security.Cryptography;
- using System.Net;
- using System.Text.RegularExpressions;
- namespace md5Generator
- {
- class Program
- {
- static string[] fUsr;
- static string nUsr;
- static string[] cHash;
- static string nHash;
- static bool log = false;
- static int lineFound;
- static string cPassHash;
- static string usrAddr= "C:\\Users\\atlan\\Documents\\accs\\usrs.txt";
- static string lstAddr = "C:\\Users\\atlan\\Documents\\accs\\lst.txt";
- static string usrsFile = System.IO.File.ReadAllText("C:\\Users\\atlan\\Documents\\accs\\usrs.txt");
- static string lstFile = System.IO.File.ReadAllText("C:\\Users\\atlan\\Documents\\accs\\lst.txt");
- static string nWrd;
- static string uname;
- static string pword;
- static void Main(string[] args)
- {
- Console.Title = "MD5 Accounts program - By smoc";
- existCheck("");
- Console.ForegroundColor = ConsoleColor.White;
- while (true)
- {
- if (log == false)
- {
- Console.WriteLine("1. Create account.");
- Console.WriteLine("2. Login to a current account.");
- Console.WriteLine();
- Console.Write(" > ");
- string inp = Console.ReadLine();
- if (inp == "1")
- {
- createAcc("");
- }
- else if (inp == "2")
- {
- login("");
- }
- else if (inp == "/admin")
- {
- admin("");
- }
- }
- else
- {
- Console.WriteLine("1. Youtube.");
- Console.WriteLine("2. Facebook.");
- Console.WriteLine("2. Smoc.");
- Console.WriteLine();
- Console.Write(" > ");
- string inp = Console.ReadLine();
- if (inp == "1")
- {
- System.Diagnostics.Process.Start("http://youtube.com/");
- Console.ReadKey();
- }
- else if (inp == "2")
- {
- System.Diagnostics.Process.Start("http://facebook.com/");
- Console.ReadKey();
- }
- else if (inp == "3")
- {
- System.Diagnostics.Process.Start("http://smoc.pw/");
- Console.ReadKey();
- } else if (inp == "/quit")
- {
- log = false;
- Thread.Sleep(300);
- }
- }
- }
- }
- static void admin(string text)
- {
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.Write("Root password > ");
- string ps = Console.ReadLine();
- if (ps == "admin")
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- while (true) {
- Console.WriteLine("1. Show all users & hashes.");
- Console.WriteLine("2. Show all passes & hashes.");
- Console.WriteLine();
- Console.Write(" > ");
- string vro = Console.ReadLine();
- if (vro == "1")
- {
- Console.Write(usrsFile);
- Console.WriteLine();
- }
- else if (vro == "2")
- {
- Console.Write(lstFile);
- Console.WriteLine();
- }
- else if (vro == "/quit")
- {
- Thread.Sleep(300);
- Console.Clear();
- break;
- }
- }
- Console.ForegroundColor = ConsoleColor.White;
- } else
- {
- Console.WriteLine("Incorrect password.");
- Console.ForegroundColor = ConsoleColor.White;
- }
- }
- static void existCheck(string args)
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.Clear();
- Console.WriteLine("Checking for directories...");
- Thread.Sleep(500);
- if (File.Exists(usrAddr))
- {
- if (File.Exists(lstAddr))
- {
- Console.Clear();
- Console.WriteLine("USRS Directory exists.");
- Thread.Sleep(300);
- Console.WriteLine("LST Directory exists.");
- Thread.Sleep(300);
- }
- }
- else
- {
- Console.Clear();
- Console.WriteLine("Directories do not exist, creating them now...");
- Thread.Sleep(300);
- Directory.CreateDirectory("C:\\Users\\atlan\\Documents\\aids\\");
- File.Create("C:\\Users\\atlan\\Documents\\acc\\usrs.txt");
- File.Create("C:\\Users\\atlan\\Documents\\accs\\lst.txt");
- Thread.Sleep(300);
- }
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.White;
- }
- static string md5Gen(string text)
- {
- MD5 hash = new MD5CryptoServiceProvider();
- hash.ComputeHash(ASCIIEncoding.ASCII.GetBytes(text));
- byte[] result = hash.Hash;
- StringBuilder strBldr = new StringBuilder();
- for (int i = 0; i < result.Length; i++)
- {
- strBldr.Append(result[i].ToString("x2"));
- }
- return strBldr.ToString();
- }
- static void login(string args)
- {
- Console.Write("Username: ");
- uname = Console.ReadLine();
- Console.Write("Password: ");
- pword = Console.ReadLine();
- while (true)
- {
- if (usrsFile.Contains(uname))
- {
- if (lstFile.Contains(pword))
- {
- cPassHash = md5Gen(pword);
- checkHash(cPassHash);
- break;
- } else
- {
- Console.WriteLine("Error...");
- break;
- }
- }
- else
- {
- Console.WriteLine("Error, incorrect username or password.");
- Console.Write("Username: ");
- uname = Console.ReadLine();
- Console.Write("Password: ");
- pword = Console.ReadLine();
- }
- }
- }
- static void createAcc(string args)
- {
- Console.Write("Username: ");
- string unameReg = Console.ReadLine();
- Console.Write("Password: ");
- string pwordReg = Console.ReadLine();
- Console.Write("Re-Enter Password: ");
- string pwordRegCheck = Console.ReadLine();
- while (true)
- {
- if (pwordReg == pwordRegCheck)
- {
- break;
- } else
- {
- Console.WriteLine();
- Console.WriteLine("Incorrect, please enter passwords that are the same.");
- Thread.Sleep(1000);
- Console.Clear();
- Console.Write("Password: ");
- pwordReg = Console.ReadLine();
- Console.Write("Re-Enter Password: ");
- pwordRegCheck = Console.ReadLine();
- }
- }
- while (true) {
- if (System.IO.File.ReadAllText("C:\\Users\\atlan\\Documents\\accs\\usrs.txt").Contains(unameReg))
- {
- Console.Write("That username is taken, please choose another username: ");
- unameReg = Console.ReadLine();
- }
- else
- {
- break;
- }
- }
- string pwordHash = md5Gen(pwordReg);
- string newWrd = "\n" + pwordHash + " " + pwordReg;
- string newAcc = "\n" + pwordHash + ":" + unameReg;
- System.IO.File.AppendAllText("C:\\Users\\atlan\\Documents\\accs\\usrs.txt", newAcc);
- if (System.IO.File.ReadAllText("C:\\Users\\atlan\\Documents\\accs\\lst.txt").Contains(newWrd))
- {
- }
- else
- {
- System.IO.File.AppendAllText("C:\\Users\\atlan\\Documents\\accs\\lst.txt", newWrd);
- }
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Account successfully created.");
- Console.ForegroundColor = ConsoleColor.White;
- Thread.Sleep(1000);
- Console.Clear();
- }
- static void checkHash(string args)
- {
- //Word file
- int counter = 0;
- TextReader tr = new StreamReader(lstAddr);
- int lineAmount = File.ReadLines(lstAddr).Count();
- string[] ListLines = new string[lineAmount];
- for (int i = 0; i < lineAmount; i++)
- {
- ListLines[i] = tr.ReadLine();
- if (ListLines[i].Contains(cPassHash))
- {
- nHash = ListLines[i];
- cHash = nHash.Split(' ');
- nHash = cHash[0];
- }
- counter++;
- }
- //User file
- counter = 0;
- tr = new StreamReader(usrAddr);
- lineAmount = File.ReadLines(usrAddr).Count();
- ListLines = new string[lineAmount];
- for (int i = 0; i < lineAmount; i++)
- {
- ListLines[i] = tr.ReadLine();
- if (ListLines[i].Contains(nHash))
- {
- nUsr = ListLines[i];
- fUsr = nUsr.Split(':');
- nUsr = fUsr[1];
- if(nUsr == uname)
- {
- log = true;
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Successfully logged in.");
- Thread.Sleep(100);
- Console.Title = "MD5 Accounts program - By smoc | Logged in as " + uname;
- Console.ForegroundColor = ConsoleColor.White;
- } else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Thread.Sleep(100);
- Console.WriteLine("Password and/or username incorrect!");
- Console.ForegroundColor = ConsoleColor.White;
- break;
- }
- }
- counter++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement