Exemple #1
0
 public override void Execute()
 {
     Console.Clear();
     Console.WriteLine("Hello World!");
     KernelExtensions.PressAnyKey();
     // Place the code that should be executed here
 }
Exemple #2
0
        public override void Execute()
        {
            Console.WriteLine("Enter string to be hashed using SHA256");
            string hash = StringExtensions.SHA256(Console.ReadLine());

            Console.WriteLine(hash);
            KernelExtensions.PressAnyKey();
        }
        public static void UserLogin()
        {
            Installer.ScreenSetup(true);
            Console.BackgroundColor = ConsoleColor.Gray;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.WriteLine("User Login:\n\n");
            ResetConsoleColor();
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.WriteLine("You can either log in as an existing user or create a new one.");
            Console.Write("Username >");
            string usrlogon = Console.ReadLine();

            if (usrlogon == "root")
            {
                Console.Write("Password >");
                Console.ForegroundColor = ConsoleColor.Blue;
                string pass = Console.ReadLine();
                Console.ForegroundColor   = ConsoleColor.White;
                MEnvironment.rootpass_sha = File.ReadAllLines(MEnvironment.rpf)[0];
                if (pass == MEnvironment.rootpass)
                {
                    Kernel.username = "******";
                    KernelExtensions.PressAnyKey();
                }
                else
                {
                    Console.WriteLine("Incorrect root password. ");
                    KernelExtensions.PressAnyKey();
                    UserLogin();
                }
            }
            else if (Directory.Exists(Paths.Users + MEnvironment.dir_ext + usrlogon))
            {
                Console.Write("Password >");
                Console.ForegroundColor = ConsoleColor.Blue;
                string pass = Console.ReadLine();
                Console.ForegroundColor = ConsoleColor.White;
                //MEnvironment.usrpass_sha = File.ReadAllLines(MEnvironment.upf)[0];
                MEnvironment.usrpass_sha = File.ReadAllLines((Paths.Users + MEnvironment.dir_ext + usrlogon + MEnvironment.dir_ext + "pass.sys"))[0];
                if (AIC.Main.Crypto.SHA256.Hash(pass) == MEnvironment.usrpass_sha)
                {
                    Kernel.username = usrlogon;
                }
                else
                {
                    Console.WriteLine("Incorrect password.");
                    KernelExtensions.PressAnyKey("Press any key to retry...");
                    UserLogin();
                }
            }
            else
            {
                Console.WriteLine("User does not exist!");
                KernelExtensions.PressAnyKey("Press any key to retry...");
                UserLogin();
            }
        }
        public static void CreateUser(string usrname, string pass, byte type, bool is_installer = true)
        {
            if (is_installer == true)
            {
                Installer.ScreenSetup();
                Installer.WritePrefix("Adding user - " + usrname + ":" + pass);
            }
            else
            {
                KernelExtensions.PressAnyKey();
                Console.Write("\nAdding user - " + usrname + ":" + pass);
            }

            new AccountDef(usrname, pass, type);
        }
Exemple #5
0
        /// <summary>
        /// Pauses output of the command to allow the user to catch all of the information, useful if not piping output to another file.
        /// </summary>
        private void DisplayPage_Pause()
        {
            int lines = 0;

            for (int i = 0; i < _commands.Count; i++)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("  ");
                Console.Write(_commands[i].Name);
                Console.Write(":  ");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(_commands[i].Summary);
                lines++;
                if (lines == 15)
                {
                    KernelExtensions.PressAnyKey();
                    lines = 0;
                    Console.Clear();
                }
            }
        }
Exemple #6
0
        public static void Crash(string exception, string description, string lastknownaddress, string ctxinterrupt)
        {
            Console.BackgroundColor = ConsoleColor.DarkMagenta;
            Console.Clear();

            Console.CursorTop += 1;
            Console.WriteLine(ErrorSplash);
            Console.CursorTop += 1;
            // Print exception information
            //Console.WriteLine("Kernel version: " + Kernel.KernelVersion);
            Console.WriteLine("CPU Exception: " + ctxinterrupt);
            Console.WriteLine("Exception: " + exception);
            Console.WriteLine("Exception description: " + description);
            if (lastknownaddress != "")
            {
                Console.WriteLine("Last known address: " + lastknownaddress);
            }
            Console.CursorTop = 24;
            KernelExtensions.PressAnyKey("Press any key to restart...");
            Cosmos.System.Power.Reboot();
        }
Exemple #7
0
 public override void Execute()
 {
     Console.Clear();
     KernelExtensions.PressAnyKey("Press any key to start a test Stop Error");
     Console.WriteLine(breakme().ToString());
 }
 /// <summary>
 /// Initializes the installer service and allows the user to choose a machine name
 /// Sets the machine name as a variable and writes it to the disk
 /// </summary>
 /// <returns></returns>
 public static bool Init()
 {
     if (FSService.Active == false)
     {
         Kernel.username = "******";
         Kernel.pcname   = "testing";
         mDebugger.Send("Installer - Skipping Installer due to live filesystem.");
         return(false);
     }
     else if (Kernel.IsLive == true)
     {
         Kernel.username = "******";
         Kernel.pcname   = "testing";
         mDebugger.Send("Installer - Skipping Installer due to live filesystem.");
         return(false);
     }
     else if (FSService.Active == true && Kernel.IsLive == false)
     {
         if (File.Exists(Kernel.pcinfo))
         {
             try
             {
                 string[] pcnames = File.ReadAllLines(Kernel.pcinfo);
                 Kernel.pcname = pcnames[0];
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.Message);
             }
         }
         Console.WriteLine("Does usrinfo exist?");
         Console.WriteLine(File.Exists(Kernel.usrinfo));
         KernelExtensions.PressAnyKey();
         if (File.Exists(Kernel.usrinfo))
         {
             Console.Clear();
             try
             {
                 Accounts.UserLogin();
                 AConsole.Fill(ConsoleColor.Blue);
                 Console.ForegroundColor = ConsoleColor.White;
                 Console.WriteLine("Welcome back, " + Kernel.username + @"!");
                 KernelExtensions.PressAnyKey();
             }
             catch (Exception ex)
             {
                 AConsole.Error.WriteLine("Medli encountered an exception during the pre-initialization stage.\nError: " + ex.Message);
                 KernelExtensions.PressAnyKey();
             }
         }
         else
         {
             Console.Clear();
             Installer.ScreenSetup();
             Installer.WriteLine("Medli was unable to find any info regarding your PC.");
             Installer.WriteLine("The Medli installer will now run.");
             ServiceLogger = new LoggingService(Paths.SystemLogs + @"\ins.log");
             ServiceLogger.Record("Installer Service logger initialized.");
             ServiceLogger.Record("Installer Service running on " + Paths.Root);
             mDebugger.Send("Running setup...");
             Installer.PressAnyKey();
             Console.Clear();
             Active = true;
             Installer.Main();
         }
         Active = false;
         return(true);
     }
     else
     {
         return(false);
     }
 }