Example #1
0
        static void Main(string[] args)
        {
            // Variables
            Guest guest  = new Guest();
            int   choice = default;

            // Displays
            choice = Displays.DisplayInitialMenuMethodForProgram();

            if (choice == 1)
            {
                // Variables for brute force and running while true
                int      bruteForce = 0;
                bool     run        = true;
                DateTime date       = new DateTime();

                while (run == true)
                {
                    // Check the guest's credentials
                    guest = PasswordLogin();

                    // Run a query with the information
                    run = SQLWork.SQLPasswordMatch(guest);

                    // Count login attempts
                    bruteForce += 1;

                    if (bruteForce >= 3)
                    {
                        // Write the bruteforce attempts to a file
                        WriteToFile.WriteBruteForceAttemptsToFile(guest, date);

                        // Display the brute force message
                        BruteForceMessage();
                    }
                }
            }
            if (choice == 2)
            {
                AddInformation();
            }
        }
Example #2
0
        public static void AddInformation()
        {
            // Variables
            string adminName = default;
            string empName   = default;

            byte[] encryptedPassword = default;
            var    admin             = new Admin();
            var    adminList         = new List <Admin>();
            var    emp              = new Employee <DateTime>();
            var    employeeList     = new List <Employee <DateTime> >();
            var    guest            = new Guest();
            var    hashedPassword   = String.Empty;
            var    password         = String.Empty;
            var    sortedDictionary = new SortedDictionary <int, Tuple <string, char, string> >();

            // Ask Admin's name
            adminName = AskAdminName();

            // Checking how I would save a byte to SQL ?
            encryptedPassword = AskPassword();

            // AES to SHA512
            hashedPassword = SHA512Crypto.Hash(encryptedPassword);

            admin = AddAdministrator(adminName, hashedPassword);

            // Add admin to a list
            adminList.Add(admin);

            // Menu
            Menu(adminName);

            // Add employee and return to list
            employeeList = AddEmployeeToList(empName);

            // Loop through Employee
            LoopThroughEmployeeList(employeeList);

            // Add Employee list to a file
            WriteToFile.WriteEmployeeListToFile(employeeList);
            WriteToFile.WriteAdminToFile(admin, DateTime.Now);

            // Assign a sorted dictionary from emp list and adminlist
            sortedDictionary = AllPersonnel(employeeList, adminList);

            // Display the sorted dictionary on console
            Displays.DisplaySortedDictionary(sortedDictionary);

            // Write the sorted dictionary to a file
            WriteToFile.WriteSortedDictionaryToFile(sortedDictionary);

            // Write password to File
            WriteToFile.WriteToPasswordFile(admin, hashedPassword);

            // DB Insert
            SQLWork.SQLInsert(sortedDictionary);

            // Enum test
            Console.ReadKey();
            Console.Clear();
            Console.WriteLine("Emp enum");
            Employee <DateTime> .EnumEmployees(employeeList);
        }