Exemplo n.º 1
0
        public void PopulateAppLauncher(LauncherItem[] items)
        {
            apps.DropDownItems.Clear();

            foreach (var kv in items)
            {
                var item = new ToolStripMenuItem();
                item.Text   = kv.DisplayData.Name;
                item.Click += (o, a) =>
                {
                    Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
                };
                apps.DropDownItems.Add(item);
            }

            if (Shiftorium.UpgradeInstalled("al_shutdown"))
            {
                apps.DropDownItems.Add(new ToolStripSeparator());
                var item = new ToolStripMenuItem();
                item.Text   = Localization.Parse("{SHUTDOWN}");
                item.Click += (o, a) =>
                {
                    TerminalBackend.InvokeCommand("sos.shutdown");
                };
                apps.DropDownItems.Add(item);
            }
        }
Exemplo n.º 2
0
        void termmain_KeyDown(object sender, KeyEventArgs e)
        {
            // The below code disables the ability to paste anything other then text...

            if (e.Control && e.KeyCode == Keys.V)
            {
                //if (Clipboard.ContainsText())
                //    termmain.Paste(DataFormats.GetFormat(DataFormats.Text));
                e.Handled = true;
            }
            else if (e.KeyCode == Keys.Enter)
            {
                TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition), TerminalID);                 // The most horrific line in the entire application!
                Print();
                e.Handled = true;
            }
            else if (e.KeyCode == Keys.Up)
            {
                if (c.Count == 0)
                {
                    return;
                }
                termmain.AppendText(c.Pop());
            }
        }
Exemplo n.º 3
0
 private void btnshutdown_Click(object sender, EventArgs e)
 {
     userRequestClose = false;
     shuttingdown     = true;
     this.Close();
     SaveSystem.CurrentUser = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == "root");
     TerminalBackend.InvokeCommand("sos.shutdown");
 }
Exemplo n.º 4
0
        public void PopulateAppLauncher()
        {
            appsmenu.Children.Clear();

            double biggestWidth = 0;

            appsmenu.Background = LoadedSkin.Menu_ToolStripDropDownBackground.CreateBrush();

            foreach (var kv in AppLauncherDaemon.Available())
            {
                var item = new Button();
                if (kv.LaunchType.BaseType == typeof(System.Windows.Forms.UserControl))
                {
                    item.Content = kv.DisplayData.Name + " (Legacy)";
                }
                else
                {
                    item.Content = kv.DisplayData.Name;
                }
                item.Margin = new Thickness(2);
                double measure = item.Content.ToString().Measure(LoadedSkin.MainFont);
                if (measure > biggestWidth)
                {
                    biggestWidth = measure;
                }
                item.Click += (o, a) =>
                {
                    AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
                    appsmenu.Visibility = Visibility.Hidden;
                };
                item.HorizontalAlignment = HorizontalAlignment.Stretch;
                appsmenu.Children.Add(item);
            }

            if (Shiftorium.UpgradeInstalled("al_shutdown"))
            {
                var item = new Button();
                item.Content = ShiftOS.Engine.Localization.Parse("{SHUTDOWN}");
                item.Margin  = new Thickness(2);
                double measure = item.Content.ToString().Measure(LoadedSkin.MainFont);
                if (measure > biggestWidth)
                {
                    biggestWidth = measure;
                }


                item.Click += (o, a) =>
                {
                    TerminalBackend.InvokeCommand("sos.shutdown");
                };
                appsmenu.Children.Add(item);
            }

            appsmenu.Width = biggestWidth + 50;

            SkinAppLauncher();
        }
Exemplo n.º 5
0
        public static bool Connect(Dictionary <string, object> args)
        {
            string sysname  = args["sysname"].ToString();
            string username = args["username"].ToString();
            string password = args["password"].ToString();

            bool connectionFinished = false;


            new Thread(() =>
            {
                Thread.Sleep(10000);
                if (connectionFinished == false)
                {
                    Applications.Terminal.IsInRemoteSystem = false;
                    Applications.Terminal.RemoteSystemName = "";
                    Applications.Terminal.RemoteUser       = "";
                    Applications.Terminal.RemotePass       = "";
                    TerminalBackend.PrefixEnabled          = true;
                    Console.WriteLine("[rts] Connection failed, target system did not respond.");
                    TerminalBackend.PrintPrompt();
                }
            }).Start();

            ServerMessageReceived smr = null;

            smr = (msg) =>
            {
                if (msg.Name == "msgtosys")
                {
                    var m = JsonConvert.DeserializeObject <ServerMessage>(msg.Contents);
                    if (m.GUID.Split('|')[2] != ServerManager.thisGuid.ToString())
                    {
                        connectionFinished             = true;
                        ServerManager.MessageReceived -= smr;
                    }
                }
            };
            ServerManager.MessageReceived += smr;
            ServerManager.SendMessageToIngameServer(sysname, 21, "cmd", JsonConvert.SerializeObject(new RTSMessage
            {
                SenderSystemName = SaveSystem.CurrentSave.SystemName,
                Username         = username,
                Password         = password,
                Namespace        = "trm",
                Command          = "clear"
            }));
            Applications.Terminal.IsInRemoteSystem = true;
            Applications.Terminal.RemoteSystemName = sysname;
            Applications.Terminal.RemoteUser       = username;
            Applications.Terminal.RemotePass       = password;
            TerminalBackend.PrefixEnabled          = false;
            return(true);
        }
Exemplo n.º 6
0
        public void OnLoad()
        {
            MakeWidget(rtbterm);

            if (SaveSystem.CurrentSave != null)
            {
                TerminalBackend.PrintPrompt();
                if (!ShiftoriumFrontend.UpgradeInstalled("window_manager"))
                {
                    rtbterm.Select(rtbterm.TextLength, 0);
                }
            }
        }
Exemplo n.º 7
0
 public static void AidenShiftnet2()
 {
     Story.PushObjective("Register with a new Shiftnet service provider.", "You've just unlocked the Shiftnet, which has opened up a whole new world of applications and features for ShiftOS. Before you go nuts with it, you may want to register with a better service provider than Freebie Solutions.", () =>
     {
         return(SaveSystem.CurrentSave.ShiftnetSubscription != 0);
     },
                         () =>
     {
         Story.Context.MarkComplete();
         SaveSystem.SaveGame();
         TerminalBackend.PrintPrompt();
         Story.Start("hacker101_breakingbonds_1");
     });
     Story.Context.AutoComplete = false;
 }
Exemplo n.º 8
0
        public void MessageReceived(ServerMessage msg)
        {
            var rtsMessage = JsonConvert.DeserializeObject <RTSMessage>(msg.Contents);

            if (msg.Name == "disconnected")
            {
                if (Applications.Terminal.IsInRemoteSystem == true)
                {
                    if (Applications.Terminal.RemoteSystemName == rtsMessage.SenderSystemName)
                    {
                        if (Applications.Terminal.RemoteUser == rtsMessage.Username)
                        {
                            if (Applications.Terminal.RemotePass == rtsMessage.Password)
                            {
                                Applications.Terminal.IsInRemoteSystem = false;
                                Applications.Terminal.RemoteSystemName = "";
                                Applications.Terminal.RemoteUser       = "";
                                Applications.Terminal.RemotePass       = "";
                                TerminalBackend.PrefixEnabled          = true;
                                TerminalBackend.PrintPrompt();
                            }
                        }
                    }
                }
                return;
            }

            string currentUserName = SaveSystem.CurrentUser.Username;

            var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == rtsMessage.Username && x.Password == rtsMessage.Password);

            if (user == null)
            {
                ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 0, "Access denied.", "The username and password you have provided was denied.");
                return;
            }
            else
            {
                SaveSystem.CurrentUser = user;

                string cmd = rtsMessage.Namespace + "." + rtsMessage.Command + JsonConvert.SerializeObject(rtsMessage.Arguments);
                TerminalBackend.InvokeCommand(cmd, true);
                ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 1, "writeline", TerminalBackend.LastCommandBuffer);
                ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 1, "write", $"{rtsMessage.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");

                SaveSystem.CurrentUser = SaveSystem.Users.FirstOrDefault(x => x.Username == currentUserName);
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// Static constructor for the <see cref="LuaInterpreter"/> class.
 /// </summary>
 static LuaInterpreter()
 {
     ServerManager.MessageReceived += (msg) =>
     {
         if (msg.Name == "run")
         {
             TerminalBackend.PrefixEnabled = false;
             var cntnts = JsonConvert.DeserializeObject <dynamic>(msg.Contents);
             var interp = new LuaInterpreter();
             Desktop.InvokeOnWorkerThread(() =>
             {
                 interp.Execute(cntnts.script.ToString());
             });
             TerminalBackend.PrefixEnabled = true;
             TerminalBackend.PrintPrompt();
         }
     };
 }
Exemplo n.º 10
0
        public Terminal()
        {
            InitializeComponent();
            SaveSystem.GameReady += () =>
            {
                try
                {
                    this.Invoke(new Action(() =>
                    {
                        if (Shiftorium.UpgradeInstalled("first_steps"))
                        {
                            if (!Shiftorium.UpgradeInstalled("desktop"))
                            {
                                TerminalBackend.PrefixEnabled = true;
                                TerminalBackend.InStory       = false;
                                TerminalBackend.PrintPrompt();
                                if (Shiftorium.UpgradeInstalled("wm_free_placement"))
                                {
                                    this.ParentForm.Width  = 640;
                                    this.ParentForm.Height = 480;
                                    this.ParentForm.Left   = (Screen.PrimaryScreen.Bounds.Width - 640) / 2;
                                    this.ParentForm.Top    = (Screen.PrimaryScreen.Bounds.Height - 480) / 2;
                                }
                            }
                            else
                            {
                                AppearanceManager.Close(this);
                            }
                        }
                        else
                        {
                            Story.Start("first_steps");
                        }
                    }));
                }
                catch { }
            };


            this.DoubleBuffered = true;
        }
Exemplo n.º 11
0
        public void OpenFile(string file)
        {
            int    lastline     = 0;
            string lastlinetext = "";

            try
            {
                var lines = new List <string>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(file).Split(new[] { Environment.NewLine.ToString() }, StringSplitOptions.RemoveEmptyEntries));
                AppearanceManager.SetupWindow(this);
                var parser = CommandParser.GenerateSample();
                foreach (var line in lines)
                {
                    lastline     = lines.IndexOf(line) + 1;
                    lastlinetext = line;
                    var command = parser.ParseCommand(line);
                    TerminalBackend.InvokeCommand(command.Key, command.Value);
                }
            }
            catch (Exception ex)
            {
                ConsoleEx.ForegroundColor = ConsoleColor.Red;
                ConsoleEx.Bold            = true;
                Console.WriteLine("Script exception");
                ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
                ConsoleEx.Bold            = false;
                ConsoleEx.Italic          = true;
#if DEBUG
                Console.WriteLine(ex.Message);
#endif
                Console.WriteLine(ex.StackTrace);
                if (lastline > 0)
                {
                    Console.WriteLine(" at " + lastlinetext + " (line " + lastline + ") in " + file);
                }
            }
            TerminalBackend.PrintPrompt();
        }
Exemplo n.º 12
0
        /// <summary>
        /// Populates the app launcher.
        /// </summary>
        /// <returns>The app launcher.</returns>
        /// <param name="items">Items.</param>
        public void PopulateAppLauncher(LauncherItem[] items)
        {
            if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
            {
                pnladvancedal.Visible        = false;
                flapps.BackColor             = LoadedSkin.Menu_ToolStripDropDownBackground;
                flcategories.BackColor       = LoadedSkin.Menu_ToolStripDropDownBackground;
                pnlalsystemactions.BackColor = LoadedSkin.SystemPanelBackground;
                lbalstatus.BackColor         = LoadedSkin.ALStatusPanelBackColor;
                //Fonts
                lbalstatus.Font      = LoadedSkin.ALStatusPanelFont;
                lbalstatus.ForeColor = LoadedSkin.ALStatusPanelTextColor;
                btnshutdown.Font     = LoadedSkin.ShutdownFont;

                //Upgrades
                btnshutdown.Visible = Shiftorium.UpgradeInstalled("al_shutdown");

                //Alignments and positions.
                lbalstatus.TextAlign = LoadedSkin.ALStatusPanelAlignment;
                if (LoadedSkin.ShutdownButtonStyle == 2)
                {
                    btnshutdown.Hide();
                }
                else if (LoadedSkin.ShutdownButtonStyle == 1)
                {
                    btnshutdown.Parent = pnlstatus;
                    btnshutdown.BringToFront();
                }
                else
                {
                    btnshutdown.Parent = pnlalsystemactions;
                }
                if (LoadedSkin.ShutdownOnLeft)
                {
                    btnshutdown.Location = LoadedSkin.ShutdownButtonFromSide;
                }
                else
                {
                    btnshutdown.Left = (btnshutdown.Parent.Width - btnshutdown.Width) - LoadedSkin.ShutdownButtonFromSide.X;
                    btnshutdown.Top  = LoadedSkin.ShutdownButtonFromSide.Y;
                }

                //Images
                lbalstatus.BackgroundImage       = GetImage("al_bg_status");
                lbalstatus.BackgroundImageLayout = GetImageLayout("al_bg_status");

                pnlalsystemactions.BackgroundImage       = GetImage("al_bg_system");
                pnlalsystemactions.BackgroundImageLayout = GetImageLayout("al_bg_system");
                if (pnlalsystemactions.BackgroundImage != null)
                {
                    btnshutdown.BackColor = Color.Transparent;
                }

                btnshutdown.Font      = LoadedSkin.ShutdownFont;
                btnshutdown.ForeColor = LoadedSkin.ShutdownForeColor;

                pnladvancedal.Size = LoadedSkin.AALSize;

                pnlalsystemactions.Height = LoadedSkin.ALSystemActionHeight;
                pnlstatus.Height          = LoadedSkin.ALSystemStatusHeight;

                flcategories.Width = LoadedSkin.AALCategoryViewWidth;
                this.flapps.Width  = LoadedSkin.AALItemViewWidth;
            }


            if (DesktopFunctions.ShowDefaultElements == true)
            {
                apps.DropDownItems.Clear();

                Dictionary <string, List <ToolStripMenuItem> > sortedItems = new Dictionary <string, List <ToolStripMenuItem> >();

                flcategories.Controls.Clear();

                LauncherItemList.Clear();


                foreach (var kv in items)
                {
                    var item = new ToolStripMenuItem();
                    item.Text   = (kv.LaunchType == null) ? kv.DisplayData.Name : Applications.NameChangerBackend.GetNameRaw(kv.LaunchType);
                    item.Image  = (kv.LaunchType == null) ? null : SkinEngine.GetIcon(kv.LaunchType.Name);
                    item.Click += (o, a) =>
                    {
                        if (kv is LuaLauncherItem)
                        {
                            var interpreter = new Engine.Scripting.LuaInterpreter();
                            interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath);
                        }
                        else
                        {
                            Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
                        }
                    };
                    if (sortedItems.ContainsKey(kv.DisplayData.Category))
                    {
                        sortedItems[kv.DisplayData.Category].Add(item);
                        LauncherItemList[kv.DisplayData.Category].Add(kv);
                    }
                    else
                    {
                        sortedItems.Add(kv.DisplayData.Category, new List <ToolStripMenuItem>());
                        sortedItems[kv.DisplayData.Category].Add(item);
                        LauncherItemList.Add(kv.DisplayData.Category, new List <LauncherItem> {
                            kv
                        });
                    }
                }

                foreach (var kv in sortedItems)
                {
                    if (Shiftorium.IsInitiated == true)
                    {
                        if (Shiftorium.UpgradeInstalled("app_launcher_categories"))
                        {
                            var cat = GetALCategoryWithName(kv.Key);
                            foreach (var subItem in kv.Value)
                            {
                                cat.DropDownItems.Add(subItem);
                            }
                            if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
                            {
                                var catbtn = new Button();
                                catbtn.Font      = LoadedSkin.AdvALItemFont;
                                catbtn.FlatStyle = FlatStyle.Flat;
                                catbtn.FlatAppearance.BorderSize         = 0;
                                catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected;
                                catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin;
                                catbtn.BackColor   = LoadedSkin.Menu_ToolStripDropDownBackground;
                                catbtn.TextAlign   = ContentAlignment.MiddleLeft;
                                catbtn.ForeColor   = LoadedSkin.Menu_TextColor;
                                catbtn.MouseEnter += (o, a) =>
                                {
                                    catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor;
                                };
                                catbtn.MouseLeave += (o, a) =>
                                {
                                    catbtn.ForeColor = LoadedSkin.Menu_TextColor;
                                };
                                catbtn.Text   = kv.Key;
                                catbtn.Width  = flcategories.Width;
                                catbtn.Height = 24;
                                flcategories.Controls.Add(catbtn);
                                catbtn.Show();
                                catbtn.Click += (o, a) => SetupAdvancedCategory(catbtn.Text);
                            }
                        }

                        else
                        {
                            foreach (var subItem in kv.Value)
                            {
                                apps.DropDownItems.Add(subItem);
                            }
                        }
                    }
                }

                if (Shiftorium.IsInitiated == true)
                {
                    if (Shiftorium.UpgradeInstalled("al_shutdown"))
                    {
                        apps.DropDownItems.Add(new ToolStripSeparator());
                        var item = new ToolStripMenuItem();
                        item.Text   = Localization.Parse("{SHUTDOWN}");
                        item.Click += (o, a) =>
                        {
                            TerminalBackend.InvokeCommand("shutdown");
                        };
                        apps.DropDownItems.Add(item);
                        if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
                        {
                            if (LoadedSkin.ShutdownButtonStyle == 2)
                            {
                                var catbtn = new Button();
                                catbtn.Font      = LoadedSkin.AdvALItemFont;
                                catbtn.FlatStyle = FlatStyle.Flat;
                                catbtn.FlatAppearance.BorderSize         = 0;
                                catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected;
                                catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin;
                                catbtn.BackColor   = LoadedSkin.Menu_ToolStripDropDownBackground;
                                catbtn.ForeColor   = LoadedSkin.Menu_TextColor;
                                catbtn.MouseEnter += (o, a) =>
                                {
                                    catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor;
                                };
                                catbtn.MouseLeave += (o, a) =>
                                {
                                    catbtn.ForeColor = LoadedSkin.Menu_TextColor;
                                };

                                catbtn.TextAlign = ContentAlignment.MiddleLeft;
                                catbtn.Text      = "Shutdown";
                                catbtn.Width     = flcategories.Width;
                                catbtn.Height    = 24;
                                flcategories.Controls.Add(catbtn);
                                catbtn.Show();
                                catbtn.Click += (o, a) => TerminalBackend.InvokeCommand("shutdown");
                            }
                        }
                    }
                }
            }
            LuaInterpreter.RaiseEvent("on_al_populate", items);
        }
Exemplo n.º 13
0
        public static void FirstSteps()
        {
            TerminalBackend.PrefixEnabled = false;
            TerminalBackend.InStory       = true;
            Console.WriteLine("Hey there, and welcome to ShiftOS.");
            Thread.Sleep(2000);
            Console.WriteLine("My name is DevX. I am the developer of this operating system.");
            Thread.Sleep(2000);
            Console.WriteLine("Right now, I am using the Terminal application as a means of talking to you.");
            Thread.Sleep(2000);
            Console.WriteLine("ShiftOS is a very early operating system, but I have big plans for it.");
            Thread.Sleep(2000);
            Console.WriteLine("I can't reveal all my plans to you at this moment, but you play a big role.");
            Thread.Sleep(2000);
            Console.WriteLine("Your role in all of this is to help me develop ShiftOS more.");
            Thread.Sleep(2000);
            Console.WriteLine("You may not know how to program, but that's perfectly fine. You don't need to.");
            Thread.Sleep(2000);
            Console.WriteLine("What you do need to do, is simply use the operating system - like you would a regular computer.");
            Thread.Sleep(2000);
            Console.WriteLine("As you use ShiftOS, you will earn a special currency called Codepoints.");
            Thread.Sleep(2000);
            Console.WriteLine("The more things you do, the more Codepoints you get! Simple, right?");
            Thread.Sleep(2000);
            Console.WriteLine("Once you rack up enough Codepoints, you can use them inside the Shiftorium to buy new features for ShiftOS.");
            Thread.Sleep(2000);
            Console.WriteLine("These features include new programs, system enhancements, Terminal commands, and so much more!");
            Thread.Sleep(2000);
            Console.WriteLine("Ahh, that reminds me. I suppose you don't know how to use the Terminal yet, do you...");
            Thread.Sleep(2000);
            Console.WriteLine("Well, you know what you say, things are best learned by doing them!");
            Thread.Sleep(2000);
            Console.WriteLine("Give it a try! Type \"help\" in the following prompt to view a list of all ShiftOS commands.");
            Thread.Sleep(2000);
            TerminalBackend.InStory       = false;
            TerminalBackend.PrefixEnabled = true;
            TerminalBackend.PrintPrompt();
            bool help_entered = false;

            TerminalBackend.CommandProcessed += (text, args) =>
            {
                if (text.EndsWith("help") && help_entered == false)
                {
                    help_entered = true;
                }
            };
            while (help_entered == false)
            {
                Thread.Sleep(10);
            }
            TerminalBackend.InStory       = true;
            TerminalBackend.PrefixEnabled = false;
            Thread.Sleep(2000);
            Console.WriteLine("Good job! Next, we will look at how to pass data to a command, such as buy.");
            Thread.Sleep(2000);
            Console.WriteLine("In ShiftOS, passing data to a command is quite simple! All you have to do is put --, and then the name of the argument! For example, you could do \"buy --upgrade \"name_of_upgrade\"\"!");
            Thread.Sleep(2000);
            Console.WriteLine("However, you can't just spam a bunch of 1s and 0s and call it a day, nonono! You have to give it a value!");
            Thread.Sleep(2000);
            Console.WriteLine("There are three main types of values. Booleans, which can be either \"true\" or \"false\", Numbers, which can be any integer number, positive or negative, and Strings - any piece of text as long as it is surrounded by double-quotes.");
            Thread.Sleep(10000);
            Console.WriteLine("Now that you've got the gist of using ShiftOS, I have a goal for you.");
            Thread.Sleep(2000);
            Console.WriteLine("As you know, ShiftOS doesn't have very many features.");
            Thread.Sleep(2000);
            Console.WriteLine("Using the applications you have, I need you to earn as many Codepoints as you can.");
            Thread.Sleep(2000);
            Console.WriteLine("You can use the Codepoints you earn to buy new applications and features in the Shiftorium, to help earn even more Codepoints.");
            Thread.Sleep(2000);
            Console.WriteLine("Once you earn 1,000 Codepoints, I will check back with you and see how well you've done.");
            Thread.Sleep(2000);
            Console.WriteLine("I'll leave you to it, you've got the hang of it! One last thing, if ever you find yourself in another program, and want to exit, simply press CTRL+T to return to the Terminal.");
            Thread.Sleep(2000);
            TerminalBackend.PrefixEnabled = true;
            TerminalBackend.InStory       = false;
            SaveSystem.SaveGame();
            Thread.Sleep(1000);

            Story.Context.AutoComplete = false;

            Console.WriteLine(@"Welcome to the ShiftOS Newbie's Guide.

This tutorial will guide you through the more intermediate features of ShiftOS,
such as earning Codepoints, buying Shiftoorium Upgrades, and using the objectives system.

Every now and then, you'll get a notification in your terminal of a ""NEW OBJECTIVE"".
This means that someone has instructed you to do something inside ShiftOS. At any moment
you may type ""status"" in your Terminal to see your current objectives.

This command is very useful as not only does it allow you to see your current objectives
but you can also see the amount of Codepoints you have as well as the upgrades you've
installed and how many upgrades are available.

Now, onto your first objective! All you need to do is earn 200 Codepoints using any
program on your system.");

            Story.PushObjective("First Steps: Your First Codepoints", "Play a few rounds of Pong, or use another program to earn 200 Codepoints.", () =>
            {
                return(SaveSystem.CurrentSave.Codepoints >= 200);
            }, () =>
            {
                Desktop.InvokeOnWorkerThread(() =>
                {
                    AppearanceManager.SetupWindow(new Terminal());
                });
                Console.WriteLine("Good job! You've earned " + SaveSystem.CurrentSave.Codepoints + @" Codepoints! You can use these inside the
Shiftorium to buy new upgrades inside ShiftOS.

These upgrades can give ShiftOS more features, fixes and programs,
which can make the operating system easier to use and navigate around
and also make it easier for you to earn more Codepoints and thus upgrade
the system further.

Be cautious though! Only certain upgrades offer the ability to earn more
Codepoints. These upgrades are typically in the form of new programs.

So, try to get as many new programs as possible for your computer, and save
the system feature upgrades for later unless you absolutely need them.

The worst thing that could happen is you end up stuck with very little Codepoints
and only a few small programs to use to earn very little amounts of Codepoints.

Now, let's get you your first Shiftorium upgrade!");

                Story.PushObjective("First Steps: The Shiftorium", "Buy your first Shiftorium upgrade with your new Codepoints using the upgrades, upgradeinfo and buy commands.",
                                    () =>
                {
                    return(SaveSystem.CurrentSave.CountUpgrades() > 0);
                }, () =>
                {
                    Console.WriteLine("This concludes the ShiftOS Newbie's Guide! Now, go, and shift it your way!");
                    Console.WriteLine(@"
Your goal: Earn 1,000 Codepoints.");
                    Story.Context.MarkComplete();
                    Story.Start("first_steps_transition");
                });
                TerminalBackend.PrintPrompt();
            });

            TerminalBackend.PrintPrompt();
        }
Exemplo n.º 14
0
 public void executeCommand(string cmd)
 {
     TerminalBackend.InvokeCommand(cmd);
 }
Exemplo n.º 15
0
        public static void MakeWidget(Controls.TerminalBox txt)
        {
            AppearanceManager.StartConsoleOut();
            txt.GotFocus += (o, a) =>
            {
                AppearanceManager.ConsoleOut = txt;
            };
            txt.KeyDown += (o, a) =>
            {
                if (a.Control == true || a.Alt == true)
                {
                    a.SuppressKeyPress = true;
                    return;
                }

                if (a.KeyCode == Keys.Enter)
                {
                    try
                    {
                        if (!TerminalBackend.InStory)
                        {
                            a.SuppressKeyPress = false;
                        }
                        if (!TerminalBackend.PrefixEnabled)
                        {
                            string textraw = txt.Lines[txt.Lines.Length - 1];
                            TextSent?.Invoke(textraw);
                            TerminalBackend.SendText(textraw);
                            return;
                        }
                        var text  = txt.Lines.ToArray();
                        var text2 = text[text.Length - 1];
                        var text3 = "";
                        txt.AppendText(Environment.NewLine);
                        var text4 = Regex.Replace(text2, @"\t|\n|\r", "");

                        if (IsInRemoteSystem == true)
                        {
                            ServerManager.SendMessage("trm_invcmd", JsonConvert.SerializeObject(new
                            {
                                guid    = RemoteGuid,
                                command = text4
                            }));
                        }
                        else
                        {
                            if (TerminalBackend.PrefixEnabled)
                            {
                                text3 = text4.Remove(0, $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
                            }
                            TerminalBackend.LastCommand = text3;
                            TextSent?.Invoke(text4);
                            TerminalBackend.SendText(text4);
                            if (TerminalBackend.InStory == false)
                            {
                                if (text3 == "stop theme")
                                {
                                    CurrentCommandParser.parser = null;
                                }
                                else
                                {
                                    var result = SkinEngine.LoadedSkin.CurrentParser.ParseCommand(text3);

                                    if (result.Equals(default(KeyValuePair <string, Dictionary <string, string> >)))
                                    {
                                        Console.WriteLine("{ERR_SYNTAXERROR}");
                                    }
                                    else
                                    {
                                        TerminalBackend.InvokeCommand(result.Key, result.Value);
                                    }
                                }
                            }
                            if (TerminalBackend.PrefixEnabled)
                            {
                                TerminalBackend.PrintPrompt();
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                else if (a.KeyCode == Keys.Back)
                {
                    try
                    {
                        var tostring3   = txt.Lines[txt.Lines.Length - 1];
                        var tostringlen = tostring3.Length + 1;
                        var workaround  = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                        var derp        = workaround.Length + 1;
                        if (tostringlen != derp)
                        {
                            AppearanceManager.CurrentPosition--;
                        }
                        else
                        {
                            a.SuppressKeyPress = true;
                        }
                    }
                    catch
                    {
                        Debug.WriteLine("Drunky alert in terminal.");
                    }
                }
                else if (a.KeyCode == Keys.Left)
                {
                    if (SaveSystem.CurrentSave != null)
                    {
                        var getstring = txt.Lines[txt.Lines.Length - 1];
                        var stringlen = getstring.Length + 1;
                        var header    = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                        var headerlen = header.Length + 1;
                        var selstart  = txt.SelectionStart;
                        var remstrlen = txt.TextLength - stringlen;
                        var finalnum  = selstart - remstrlen;

                        if (finalnum != headerlen)
                        {
                            AppearanceManager.CurrentPosition--;
                        }
                        else
                        {
                            a.SuppressKeyPress = true;
                        }
                    }
                }
                else if (a.KeyCode == Keys.Up)
                {
                    var tostring3 = txt.Lines[txt.Lines.Length - 1];
                    if (tostring3 == $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ")
                    {
                        Console.Write(TerminalBackend.LastCommand);
                    }
                    ConsoleEx.OnFlush?.Invoke();
                    a.SuppressKeyPress = true;
                }
                else
                {
                    if (TerminalBackend.InStory)
                    {
                        a.SuppressKeyPress = true;
                    }
                    AppearanceManager.CurrentPosition++;
                }
            };

            AppearanceManager.ConsoleOut = txt;

            txt.Focus();

            txt.Font      = LoadedSkin.TerminalFont;
            txt.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC);
            txt.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC);
        }
Exemplo n.º 16
0
 public static void InvokeCommand(string text)
 {
     TerminalBackend.InvokeCommand(text);
 }
Exemplo n.º 17
0
 public void shutdown()
 {
     TerminalBackend.InvokeCommand("sys.shutdown");
 }
Exemplo n.º 18
0
 private void btnshutdown_Click(object sender, EventArgs e)
 {
     TerminalBackend.InvokeCommand("shutdown");
 }
Exemplo n.º 19
0
        public static void MakeWidget(Controls.TerminalBox txt)
        {
            AppearanceManager.StartConsoleOut();
            txt.GotFocus += (o, a) => {
                AppearanceManager.ConsoleOut = txt;
            };
            txt.KeyDown += (o, a) => {
                if (a.KeyCode == Keys.Enter)
                {
                    try {
                        a.SuppressKeyPress = true;
                        Console.WriteLine("");
                        var text  = txt.Lines.ToArray();
                        var text2 = text[text.Length - 2];
                        var text3 = "";
                        var text4 = Regex.Replace(text2, @"\t|\n|\r", "");

                        if (TerminalBackend.PrefixEnabled)
                        {
                            text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
                        }
                        TerminalBackend.LastCommand = text3;
                        TextSent?.Invoke(text4);
                        if (TerminalBackend.InStory == false)
                        {
                            TerminalBackend.InvokeCommand(text3);
                        }
                        if (TerminalBackend.PrefixEnabled)
                        {
                            Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
                        }
                    } catch {
                    }
                }
                else if (a.KeyCode == Keys.Back)
                {
                    var tostring3   = txt.Lines[txt.Lines.Length - 1];
                    var tostringlen = tostring3.Length + 1;
                    var workaround  = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                    var derp        = workaround.Length + 1;
                    if (tostringlen != derp)
                    {
                        AppearanceManager.CurrentPosition--;
                    }
                    else
                    {
                        a.SuppressKeyPress = true;
                    }
                }
                else if (a.KeyCode == Keys.Left)
                {
                    var getstring = txt.Lines[txt.Lines.Length - 1];
                    var stringlen = getstring.Length + 1;
                    var header    = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                    var headerlen = header.Length + 1;
                    var selstart  = txt.SelectionStart;
                    var remstrlen = txt.TextLength - stringlen;
                    var finalnum  = selstart - remstrlen;

                    if (finalnum != headerlen)
                    {
                        AppearanceManager.CurrentPosition--;
                    }
                    else
                    {
                        a.SuppressKeyPress = true;
                    }
                }
                //( ͡° ͜ʖ ͡° ) You found the lennyface without looking at the commit message. Message Michael in the #shiftos channel on Discord saying "ladouceur" somewhere in your message if you see this.
                else if (a.KeyCode == Keys.Up)
                {
                    var tostring3 = txt.Lines[txt.Lines.Length - 1];
                    if (tostring3 == $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ")
                    {
                        Console.Write(TerminalBackend.LastCommand);
                    }
                    a.SuppressKeyPress = true;
                }
                else
                {
                    if (TerminalBackend.InStory)
                    {
                        a.SuppressKeyPress = true;
                    }
                    AppearanceManager.CurrentPosition++;
                }
            };

            AppearanceManager.ConsoleOut = txt;

            txt.Focus();

            txt.Font      = LoadedSkin.TerminalFont;
            txt.ForeColor = LoadedSkin.TerminalForeColor;
            txt.BackColor = LoadedSkin.TerminalBackColor;
        }
Exemplo n.º 20
0
        public static void DevX1000CPStory()
        {
            Desktop.InvokeOnWorkerThread(() =>
            {
                var t = new Applications.Terminal();
                AppearanceManager.SetupWindow(t);
            });
            TerminalBackend.InStory       = true;
            TerminalBackend.PrefixEnabled = false;
            Thread.Sleep(3000);
            Engine.AudioManager.PlayStream(Properties.Resources._3beepvirus);
            Console.WriteLine("devx@anon_127420: Connection established.");
            Thread.Sleep(1500);
            Console.WriteLine("DevX: Hello, " + SaveSystem.CurrentUser.Username + "@" + SaveSystem.CurrentSave.SystemName + "! I see you've gotten a decent amount of Codepoints.");
            Thread.Sleep(2000);
            Console.WriteLine("DevX: Have you gotten a chance to install my \"Shifter\" application yet?");
            Thread.Sleep(1500);
            if (!Shiftorium.UpgradeInstalled("shifter"))
            {
                Console.WriteLine("You: Not yet. What's it for?");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: The Shifter is a very effective way to make ShiftOS look however you want it to.");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: It can even be adapted to support other applications, features and upgrades.");
                Thread.Sleep(2000);
            }
            else
            {
                Console.WriteLine("You: Yeah. Just seems kinda lackluster to me. What is it supposed to do?");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: The Shifter is a very effective way to make ShiftOS look however you want it to.");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: It can even be adapted to support other applications, features and upgrades.");
                Thread.Sleep(2000);
                Console.WriteLine("DevX: I haven't finished it just yet. Keep upgrading it and you'll notice it gets a lot better.");
                Thread.Sleep(2000);
            }
            Console.WriteLine("DevX: I'd also recommend going for the Skin Loader, that way you can save your creations to the disk. Also, go for the Skinning upgrade - which will allow more rich customization of certain elements.");
            Thread.Sleep(2000);
            Console.WriteLine("You: This still ain't gonna help me get back to my old system and out of this stupid Digital Society, is it?");
            Thread.Sleep(2000);
            Console.WriteLine("DevX: How the...How do you know about the Digital Societ....Who the hell talked!?");
            Thread.Sleep(2000);
            Console.WriteLine("You: Whoa! Just... calm down, will ya? I heard about it in the news, shortly before I got infected by this damn virus of an operating system.");
            Thread.Sleep(2000);
            Console.WriteLine("DevX: Whatever. That doesn't matter yet. Just focus on upgrading ShiftOS and earning Codepoints. I'll let you know when we're done. I've gotta go...work on something else.");
            Thread.Sleep(1500);
            Console.WriteLine("User disconnected.");
            Thread.Sleep(2000);
            Console.WriteLine("You: Something doesn't seem right about DevX. I wonder what he's really up to.");

            if (Shiftorium.UpgradeInstalled("shifter"))
            {
                PushObjectives();
            }
            else
            {
                Story.PushObjective("Buy the Shifter.", "The Shifter is a super-effective way to earn more Codepoints. It is an essential buy if you haven't already bought it. Save up for the Shifter, and buy it using shiftorium.buy{upgrade:\"shifter\"}.", () =>
                {
                    return(Shiftorium.UpgradeInstalled("shifter"));
                }, () =>
                {
                    PushObjectives();
                });
            }
            Story.Context.AutoComplete    = false;
            TerminalBackend.InStory       = false;
            TerminalBackend.PrefixEnabled = false;
            TerminalBackend.PrintPrompt();
        }
Exemplo n.º 21
0
        /// <summary>
        /// Run a command in the Terminal.
        /// </summary>
        /// <param name="cmd">The command to run, using regular ShiftOS syntax.</param>
        /// <returns>Whether the command was found and ran.</returns>
        public bool runCommand(string cmd)
        {
            var args = TerminalBackend.GetArgs(ref cmd);

            return(TerminalBackend.RunClient(cmd, args));
        }
Exemplo n.º 22
0
 private void pnlminimize_Click(object sender, EventArgs e)
 {
     TerminalBackend.InvokeCommand($"win.mini{{id:{this.ParentForm.GetHashCode()}}}");
 }
Exemplo n.º 23
0
        public static void BreakingTheBonds_Outro()
        {
            Story.Context.AutoComplete = false;
            CharacterName = "hacker101";
            SysName       = "pebcak";

            if (!terminalOpen())
            {
                var term = new Applications.Terminal();
                AppearanceManager.SetupWindow(term);
            }

            WriteLine("Now let's teach you how to hack others' systems.");
            WriteLine("I'll start up a safe virtual environment for you to mess with.");
            VirtualEnvironments.Create("pebcak_devel", new List <Objects.ClientSave>
            {
                new Objects.ClientSave
                {
                    Username    = "******",
                    Password    = GenRandomPassword(),
                    Permissions = Objects.UserPermissions.Root
                },
                new Objects.ClientSave
                {
                    Username    = "******",
                    Password    = "",
                    Permissions = Objects.UserPermissions.Admin,
                }
            }, 6500l, JsonConvert.DeserializeObject <ShiftOS.Objects.ShiftFS.Directory>(Properties.Resources.PebcakDevelFS));
            Thread.Sleep(2000);
            WriteLine("It's all set up now. The system name for this environment is \"pebcak_devel\".");
            WriteLine("This server allows FTP connections through your File Skimmer.");
            WriteLine("Other systems can allow RTS connections (which allows you to control their terminals remotely), SMTP (mail transfer), etc. It depends on the system's role.");

            bool isFsCopyInstalled = Shiftorium.UpgradeInstalled("fs_copy");

            if (isFsCopyInstalled == false)
            {
                WriteLine("Before we can begin, one last thing. You need the FS Copy Shiftorium upgrade.");
                Story.PushObjective("Breaking The Bonds: Preparations", "You need to buy the FS Copy upgrade from the Shiftorium.", () => { return(Shiftorium.UpgradeInstalled("fs_copy")); }, () =>
                {
                    isFsCopyInstalled = true;
                });
            }
            while (isFsCopyInstalled == false)
            {
                Thread.Sleep(10);
            }

            WriteLine("Alright, open your File Skimmer, click \"Start Remote Session\", and connect to the system name \"pebcak_devel\" with user name \"user\" and no password.");

            Story.PushObjective("Breaking The Bonds: A little practice...", "hacker101 has set up a virtual environment for you to connect to. Its system name is \"pebcak_local\", and has an unsecured user account with the name \"user\". Log into that user using your File Skimmer.",
                                () => { return(Applications.FileSkimmer.OpenConnection.SystemName == "pebcak_devel"); },
                                () =>
            {
                WriteLine("Good work. You're in. This user only has Admin privileges, and doesn't have anything useful on it. This is where hacking comes in.");
                WriteLine("See that \"super private personal stuff\" folder? It can only be accessed as a root user. You'll need the root password for pebcak_devel to get in there.");
                WriteLine("I'll send you a password cracking utility that can use open ShiftOS connections to sniff out all the users on the system and allow you to brute-force into an account.");
                Console.WriteLine("New program unlocked: brute");
                SaveSystem.CurrentSave.StoriesExperienced.Add("brute");
                WriteLine("Go ahead and open it! Use it to breach the root user on pebcak_devel.");
                WriteLine("Once you've got the root password, click the Reauthenticate button in File Skimmer and it will ask you to log in as a new user.");
                WriteLine("Use the new credentials to log in.");
                Story.PushObjective("Breaking The Bonds: The Brute", "Use your new \"brute\" application to breach the root account on pebcak_local so you can access the super secret folder and download its contents.", () =>
                {
                    return(Applications.FileSkimmer.CurrentRemoteUser == Applications.FileSkimmer.OpenConnection.Users.FirstOrDefault(x => x.Username == "root"));
                },
                                    () =>
                {
                    WriteLine("Now, open the folder and you can copy files and folders from it to your system.");
                    WriteLine("You've got 60 seconds before ShiftOS's internet daemon terminates this connection.");
                    int counter = 60;
                    while (counter > 0 && Applications.FileSkimmer.OpenConnection.SystemName == "pebcak_devel")
                    {
                        Thread.Sleep(1000);
                        Console.WriteLine("Connection termination in " + counter + " seconds...");
                        if (counter == 30 || counter == 15)
                        {
                            Engine.AudioManager.PlayStream(Properties.Resources._3beepvirus);
                        }
                        if (counter <= 10)
                        {
                            Engine.AudioManager.PlayStream(Properties.Resources.writesound);
                        }
                        counter--;
                    }
                    VirtualEnvironments.Clear();
                    Applications.FileSkimmer.DisconnectRemote();
                    WriteLine("Connections terminated I see.. Alright. Have fun with those dummy documents - you can keep them if you'd like. There's nothing important in them.");
                    WriteLine("That's one thing you can do with brute and other hacking utilities. I'd recommend buying some of brute's Shiftorium upgrades to make it faster and more efficient.");
                    WriteLine("Also, along the way, you're going to find a lot of new tricks. Some of them will require more than just brute to get into.");
                    WriteLine("So be on the lookout on the Shiftnet for other hacking-related tools. You won't find any on Appscape, however...");
                    WriteLine("That darn Aiden Nirh guy can't stand hackers.");
                    WriteLine("Looking at your logs, I see he's contacted you before... Seriously... don't let him find out about brute. He'll report it directly to DevX.");
                    WriteLine("Oh yeah, one more thing... that virus scanner... you may want to scan any files that you transfer from other systems with it.");
                    WriteLine("You never know what sorts of digital filth is hidden within such innocent-looking files.");
                    WriteLine("ALWAYS scan before opening - because if you open a file containing malicious code, it'll get run. It's just how ShiftOS's kernel works.");
                    WriteLine("Oh yeah, one last thing. Things are going to start getting pretty open in the Digital Society..");
                    WriteLine("Multiple people are going to want you to help them out with multiple things.");
                    WriteLine("I've written a little command-line utility that'll help you keep track of these missions and see how far you've gotten.");
                    WriteLine("Use the missions command to list out all the available missions, then use the startmission command to start one.");
                    WriteLine("When you complete a mission, you'll earn Codepoints depending on the mission.");
                    WriteLine("Allow me to demonstrate...");
                    Console.WriteLine("User has disconnected.");



                    Story.Context.MarkComplete();
                    TerminalBackend.PrefixEnabled = true;
                    SaveSystem.SaveGame();
                    TerminalBackend.PrintPrompt();
                });
            });
        }
Exemplo n.º 24
0
        public void SetupBuildUpdate(ShiftOS.Objects.Unite.Download download)
        {
            string devUpdate = "";

            if (!string.IsNullOrEmpty(download.DevUpdateId))
            {
                devUpdate = $@"## Development update

<iframe src=""http://youtube.com/embed/{download.DevUpdateId}"" allowfullscreen width=""720"" height=""480""></iframe>
";
            }

            string screenshot = "";

            if (!string.IsNullOrEmpty(download.ScreenshotUrl))
            {
                screenshot = $"<img src=\"http://getshiftos.ml{download.ScreenshotUrl}\" style=\"max-width:720px;width:auto;height:auto;\"/>";
            }

            lbupdatetitle.Text = download.Name;
            string markdown = $@"**Built on {download.PostDate}**

{devUpdate}

{screenshot}

## Changelog

{download.Changelog}";

            ConstructHtml(markdown);

            pgdownload.Value = 0;
            pgdownload.Text  = "Waiting.";
            btnaction.Text   = "Update";
            btnaction.Show();
            OnActionButtonClick = () =>
            {
                pgdownload.Show();
                var wc = new WebClient();
                wc.DownloadProgressChanged += (o, a) =>
                {
                    this.Invoke(new Action(() =>
                    {
                        pgdownload.Text  = "Downloading " + download.Name + "...";
                        pgdownload.Value = a.ProgressPercentage;
                    }));
                };

                wc.DownloadDataCompleted += (o, a) =>
                {
                    if (Directory.Exists("updater-work"))
                    {
                        Directory.Delete("updater-work", true);
                    }
                    Directory.CreateDirectory("updater-work");

                    string temp_guid = Guid.NewGuid().ToString();

                    File.WriteAllBytes($"{temp_guid}.zip", a.Result);

                    ZipFile.ExtractToDirectory($"{temp_guid}.zip", "updater-work");

                    File.Delete($"{temp_guid}.zip");

                    //Start the updater helper.
                    System.Diagnostics.Process.Start("ShiftOS.Updater.exe");

                    //Now we stop the engine.
                    TerminalBackend.InvokeCommand("sos.shutdown");
                };

                wc.DownloadDataAsync(new Uri($"http://getshiftos.ml{download.DownloadUrl}"));
            };
        }
Exemplo n.º 25
0
        public static void Brute()
        {
            TerminalBackend.PrefixEnabled = false;
            bool cracked = false;
            var  brute   = Properties.Resources.brute;
            var  str     = new System.IO.MemoryStream(brute);
            var  reader  = new NAudio.Wave.Mp3FileReader(str);
            var  _out    = new NAudio.Wave.WaveOut();

            _out.Init(reader);
            _out.PlaybackStopped += (o, a) =>
            {
                if (cracked == false)
                {
                    cracked = true;
                    TerminalCommands.Clear();
                    ConsoleEx.Bold            = true;
                    ConsoleEx.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(" - access denied - ");
                    ConsoleEx.ForegroundColor = ConsoleColor.Gray;
                    ConsoleEx.Bold            = false;
                    ConsoleEx.Italic          = true;
                    Console.WriteLine("password could not be cracked before connection termination.");
                }
                TerminalBackend.PrefixEnabled = true;
                TerminalBackend.PrintPrompt();
                _out.Dispose();
                reader.Dispose();
                str.Dispose();
            };
            _out.Play();

            var t = new Thread(() =>
            {
                Console.WriteLine("brute - version 1.0");
                Console.WriteLine("Copyright (c) 2018 hacker101. All rights reserved.");
                Console.WriteLine();
                Thread.Sleep(4000);
                Console.WriteLine("Scanning outbound connections...");
                if (string.IsNullOrWhiteSpace(Applications.FileSkimmer.OpenConnection.SystemName))
                {
                    Thread.Sleep(2000);
                    Console.WriteLine(" - no outbound connections to scan, aborting - ");
                    _out.Stop();
                    _out.Dispose();
                    reader.Dispose();
                    str.Dispose();
                }
                else
                {
                    Thread.Sleep(2000);
                    var con = Applications.FileSkimmer.OpenConnection;
                    Console.WriteLine($@"{con.SystemName}
------------------

Active connection: ftp, rts
System name: {con.SystemName}
Users: {con.Users.Count}");
                    Thread.Sleep(500);
                    var user = con.Users.FirstOrDefault(x => x.Permissions == Objects.UserPermissions.Root);
                    if (user == null)
                    {
                        Console.WriteLine(" - no users found with root access - this is a shiftos bug - ");
                    }
                    else
                    {
                        Console.WriteLine(" - starting bruteforce attack on user: "******" - ");

                        char[] pass = new char[user.Password.Length];
                        for (int i = 0; i < pass.Length; i++)
                        {
                            if (cracked == true)
                            {
                                break;
                            }
                            for (char c = (char)0; c < (char)255; c++)
                            {
                                if (!char.IsLetterOrDigit(c))
                                {
                                    continue;
                                }
                                pass[i] = c;
                                if (pass[i] == user.Password[i])
                                {
                                    break;
                                }
                                Console.WriteLine(new string(pass));
                            }
                        }
                        if (cracked == false)
                        {
                            cracked = true;
                            TerminalCommands.Clear();
                            Console.WriteLine(" - credentials cracked. -");
                            Console.WriteLine($@"sysname: {con.SystemName}
user: {user.Username}
password: {user.Password}");
                        }
                    }
                }
            });

            t.Start();
        }