private static void CopyHostileFileToLocalSystem()
 {
     if (!Directory.Exists(HostileHackerBreakinSequence.HostileDirectory))
     {
         Directory.CreateDirectory(HostileHackerBreakinSequence.HostileDirectory);
     }
     try
     {
         if (File.Exists(HostileHackerBreakinSequence.HostileFilePath))
         {
             return;
         }
         File.Copy("Content/DLC/Misc/VMBootloaderTrap.dll", HostileHackerBreakinSequence.HostileFilePath);
         if (Environment.OSVersion.Platform == PlatformID.Win32NT)
         {
             HostileHackerBreakinSequence.LockFileToPreventDeletionWin32(HostileHackerBreakinSequence.HostileFilePath);
         }
         else
         {
             HostileHackerBreakinSequence.LockFileToPreventDeletionUnix(HostileHackerBreakinSequence.HostileDirectory, HostileHackerBreakinSequence.HostileFilePath);
         }
     }
     catch (UnauthorizedAccessException ex)
     {
         Utils.AppendToErrorFile("HHBreakinSequence error : Insufficient permissions for folder access.\r\n" + Utils.GenerateReportFromException((Exception)ex));
         Console.WriteLine("HHSequence Error " + Utils.GenerateReportFromException((Exception)ex));
     }
 }
        private static void MinimizeAllOpenWindows()
        {
            Process currentProcess = Process.GetCurrentProcess();

            foreach (Process process in Process.GetProcesses())
            {
                if (process != currentProcess)
                {
                    IntPtr mainWindowHandle = process.MainWindowHandle;
                    if (!(mainWindowHandle == IntPtr.Zero))
                    {
                        HostileHackerBreakinSequence.MinimizeWindow(mainWindowHandle);
                    }
                }
            }
        }
        internal static void Execute(object osobj, Computer source, Computer target)
        {
            Console.WriteLine("Breakin Started!");
            PostProcessor.EndingSequenceFlashOutActive             = true;
            PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f;
            OS       os  = (OS)osobj;
            DateTime now = DateTime.Now;

            os.Flags.AddFlag("startupBreakinTrapActivated");
            os.threadedSaveExecute(true);
            HostileHackerBreakinSequence.CopyHostileFileToLocalSystem();
            Console.WriteLine("Copied files to local system...");
            double totalSeconds = (DateTime.Now - now).TotalSeconds;
            double time         = totalSeconds <= 3.0 ? 4.0 - totalSeconds : 1.5;

            os.delayer.Post(ActionDelayer.Wait(time), (Action)(() =>
            {
                PostProcessor.EndingSequenceFlashOutActive = false;
                PostProcessor.EndingSequenceFlashOutPercentageComplete = 0.0f;
                os.thisComputer.crash(source.ip);
            }));
        }
Example #4
0
        public override void Draw(float t)
        {
            base.Draw(t);
            this.spriteBatch.Draw(Utils.white, this.bounds, this.os.darkBackgroundColor);
            Vector2   pos = new Vector2((float)this.bounds.X + 10f, (float)(this.bounds.Y + this.bounds.Height) - (GuiData.ActiveFontConfig.tinyFontCharHeight + 16f));
            Rectangle destinationRectangle = new Rectangle((int)pos.X, (int)pos.Y, 10, 14);

            this.spriteBatch.Draw(Utils.white, destinationRectangle, (double)this.os.timer % 0.300000011920929 < 0.150000005960464 ? Color.White : Color.White * 0.05f);
            List <string> stringList = new List <string>();
            Color         c          = Color.Lerp(Utils.AddativeWhite, Utils.makeColor((byte)204, byte.MaxValue, (byte)249, (byte)0), 0.5f);
            float         num1       = this.blocksComplete < 11 ? -8.3f : 0.0f;

            pos.Y -= 6f;
            if (this.AwaitingInput)
            {
                pos.Y -= 46f;
                if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                {
                    if (Button.doButton(464191001, (int)pos.X, (int)pos.Y - 4, 220, 30, LocaleTerms.Loc("Proceed"), new Color?(Color.White)))
                    {
                        HostileHackerBreakinSequence.CopyHelpFile();
                        HostileHackerBreakinSequence.OpenWindowsHelpDocument();
                        HostileHackerBreakinSequence.OpenTerminal();
                        HostileHackerBreakinSequence.CrashProgram();
                    }
                }
                else
                {
                    if (Button.doButton(464191002, (int)pos.X, (int)pos.Y - 4, 220, 30, LocaleTerms.Loc("README"), new Color?(Color.White)))
                    {
                        this.SequenceBlocks.Add("");
                        this.SequenceBlocks.Add("");
                        this.SequenceBlocks.Add("");
                        this.SequenceBlocks.Add(HostileHackerBreakinSequence.GetHelpText());
                        this.SequenceBlocks.Add("");
                        this.blocksComplete = this.SequenceBlocks.Count - 1;
                    }
                    if (Button.doButton(464191003, (int)pos.X + 230, (int)pos.Y - 4, 220, 30, LocaleTerms.Loc("Terminal"), new Color?(Color.White)))
                    {
                        this.SequenceBlocks.Add("---------------------------------------");
                        this.SequenceBlocks.Add("TERMINAL SHOULD BE OPEN ON YOUR SYSTEM.");
                        this.SequenceBlocks.Add("");
                        this.SequenceBlocks.Add("IF NOT, OPEN A TERMINAL TO");
                        this.SequenceBlocks.Add(HostileHackerBreakinSequence.OpenTerminal());
                        this.SequenceBlocks.Add("---------------------------------------");
                        this.SequenceBlocks.Add("");
                        this.blocksComplete = this.SequenceBlocks.Count - 1;
                    }
                    if (Button.doButton(464191001, (int)pos.X + 460, (int)pos.Y - 4, 220, 30, LocaleTerms.Loc("Crash VM"), new Color?(Color.White)))
                    {
                        HostileHackerBreakinSequence.CopyHelpFile();
                        HostileHackerBreakinSequence.CrashProgram();
                    }
                }
            }
            if (this.blocksComplete + 1 < this.SequenceBlocks.Count)
            {
                string[] strArray = this.SequenceBlocks[this.blocksComplete + 1].Split(Utils.robustNewlineDelim, StringSplitOptions.None);
                int      num2     = (int)(Math.Min(1f, this.elapsedTime / (num1 + 9.2f)) * (float)(strArray.Length - 1));
                for (int index = num2; index >= 0; --index)
                {
                    string str = strArray[index];
                    if (index == num2 && this.blocksComplete + 1 >= 11)
                    {
                        float val1   = (num1 + 9.2f) / (float)Math.Max(1, strArray.Length - 1);
                        float num3   = Math.Min(val1, this.elapsedTime - (float)num2 * val1);
                        int   length = (int)((double)str.Length * ((double)num3 / (double)val1));
                        str = str.Substring(0, length);
                    }
                    stringList.Add(str);
                }
            }
            for (int blocksComplete = this.blocksComplete; blocksComplete >= 0; --blocksComplete)
            {
                string[] strArray = this.SequenceBlocks[blocksComplete].Split(Utils.robustNewlineDelim, StringSplitOptions.None);
                for (int index = strArray.Length - 1; index >= 0; --index)
                {
                    stringList.Add(strArray[index]);
                }
            }
            for (int index = 0; index < stringList.Count; ++index)
            {
                pos.Y -= GuiData.ActiveFontConfig.tinyFontCharHeight + 6f;
                this.DrawMonospace(stringList[index], GuiData.smallfont, pos, c, LocaleActivator.ActiveLocaleIsCJK() ? 13f : 10f);
            }
        }
Example #5
0
        private static void executeThreadedScript(string[] script, OS os)
        {
            KeyValuePair <string, string>?nullable = new KeyValuePair <string, string>?();
            bool     flag1   = false;
            Computer target  = os.thisComputer;
            Computer source  = (Computer)null;
            TimeSpan timeout = TimeSpan.FromSeconds(0.5);

            for (int index1 = 0; index1 < script.Length; ++index1)
            {
                if (source != null && source.disabled)
                {
                    Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cDisconnect", target, source), os);
                    Console.WriteLine("Early Script Exit on Source Disable");
                    return;
                }
                if (!string.IsNullOrWhiteSpace(script[index1]))
                {
                    string[]    strArray    = script[index1].Trim().Split(Utils.spaceDelim, StringSplitOptions.RemoveEmptyEntries);
                    CultureInfo cultureInfo = new CultureInfo("en-au");
                    bool        flag2       = target == os.thisComputer;
                    try
                    {
                        switch (strArray[0])
                        {
                        case "config":
                            target = Programs.getComputer(os, strArray[1]);
                            if (target == null)
                            {
                                if (!OS.DEBUG_COMMANDS)
                                {
                                    return;
                                }
                                os.write(" ");
                                os.write("Error: ");
                                os.write("Hack Script target " + strArray[1] + " not found! Aborting.");
                                os.write("This error will not show up if debug commands are disabled.");
                                os.write(" ");
                                return;
                            }
                            source = Programs.getComputer(os, strArray[2]);
                            if (source == null)
                            {
                                if (!OS.DEBUG_COMMANDS)
                                {
                                    return;
                                }
                                os.write(" ");
                                os.write("Error: ");
                                os.write("Hack Script source " + strArray[2] + " not found! Aborting.");
                                os.write("This error will not show up if debug commands are disabled.");
                                os.write(" ");
                                return;
                            }
                            timeout  = TimeSpan.FromSeconds(Convert.ToDouble(strArray[3], (IFormatProvider)cultureInfo));
                            flag2    = false;
                            nullable = new KeyValuePair <string, string>?(new KeyValuePair <string, string>(source.ip, target.ip));
                            os.ActiveHackers.Add(nullable.Value);
                            break;

                        case "delay":
                            if (!OS.TestingPassOnly)
                            {
                                Thread.Sleep(TimeSpan.FromSeconds(Convert.ToDouble(strArray[1], (IFormatProvider)cultureInfo)));
                            }
                            flag2 = false;
                            break;

                        case "connect":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cConnection", target, source), os);
                            if (!flag1 && target.ip == os.thisComputer.ip)
                            {
                                os.IncConnectionOverlay.Activate();
                                flag1 = true;
                                break;
                            }
                            break;

                        case "openPort":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cPortOpen", target, source) + " " + strArray[1], os);
                            break;

                        case "delete":
                            string pathString = HackerScriptExecuter.getPathString(strArray[1], os, target.files.root);
                            Multiplayer.parseInputMessage("cDelete #" + target.ip + "#" + source.ip + "#" + strArray[2] + pathString, os);
                            break;

                        case "reboot":
                            if (target == os.thisComputer)
                            {
                                if (os.connectedComp == null || os.connectedComp == os.thisComputer)
                                {
                                    os.runCommand("reboot");
                                    break;
                                }
                                os.rebootThisComputer();
                                break;
                            }
                            target.reboot(source.ip);
                            break;

                        case "forkbomb":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("eForkBomb", target, source), os);
                            break;

                        case "disconnect":
                            target.disconnecting(source.ip, true);
                            break;

                        case "systakeover":
                            HostileHackerBreakinSequence.Execute((object)os, source, target);
                            break;

                        case "clearTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.reset();
                                break;
                            }
                            break;

                        case "write":
                            string str1 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str1 = str1 + strArray[index2] + " ";
                            }
                            string str2 = ComputerLoader.filter(str1.Trim());
                            if (target == os.thisComputer)
                            {
                                os.terminal.write(" " + str2);
                                os.warningFlash();
                                break;
                            }
                            break;

                        case "write_silent":
                            string str3 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str3 = str3 + strArray[index2] + " ";
                            }
                            string str4 = ComputerLoader.filter(str3.Trim());
                            if (target == os.thisComputer)
                            {
                                os.terminal.write(" " + str4);
                            }
                            flag2 = false;
                            break;

                        case "writel":
                            string str5 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str5 = str5 + strArray[index2] + " ";
                            }
                            string text1 = ComputerLoader.filter(str5.Trim());
                            if (string.IsNullOrWhiteSpace(text1))
                            {
                                flag2 = false;
                            }
                            if (target == os.thisComputer)
                            {
                                os.terminal.writeLine(text1);
                                os.warningFlash();
                                break;
                            }
                            break;

                        case "writel_silent":
                            string str6 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str6 = str6 + strArray[index2] + " ";
                            }
                            string text2 = ComputerLoader.filter(str6.Trim());
                            if (string.IsNullOrWhiteSpace(text2))
                            {
                                flag2 = false;
                            }
                            if (target == os.thisComputer)
                            {
                                os.terminal.writeLine(text2);
                            }
                            flag2 = false;
                            break;

                        case "hideNetMap":
                            if (target == os.thisComputer)
                            {
                                os.netMap.visible = false;
                                break;
                            }
                            break;

                        case "hideRam":
                            if (target == os.thisComputer)
                            {
                                os.ram.visible = false;
                                break;
                            }
                            break;

                        case "hideDisplay":
                            if (target == os.thisComputer)
                            {
                                os.display.visible = false;
                                break;
                            }
                            break;

                        case "hideTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.visible = false;
                                break;
                            }
                            break;

                        case "showNetMap":
                            if (target == os.thisComputer)
                            {
                                os.netMap.visible = true;
                                break;
                            }
                            break;

                        case "showRam":
                            if (target == os.thisComputer)
                            {
                                os.ram.visible = true;
                                break;
                            }
                            break;

                        case "showTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.visible = true;
                                break;
                            }
                            break;

                        case "showDisplay":
                            if (target == os.thisComputer)
                            {
                                os.display.visible = true;
                                break;
                            }
                            break;

                        case "stopMusic":
                            flag2 = false;
                            if (target == os.thisComputer)
                            {
                                if (HackerScriptExecuter.MusicStopSFX == null)
                                {
                                    HackerScriptExecuter.MusicStopSFX = !DLC1SessionUpgrader.HasDLC1Installed ? os.content.Load <SoundEffect>("SFX/MeltImpact") : os.content.Load <SoundEffect>("DLC/SFX/GlassBreak");
                                }
                                MusicManager.stop();
                                if (HackerScriptExecuter.MusicStopSFX != null)
                                {
                                    HackerScriptExecuter.MusicStopSFX.Play();
                                }
                                break;
                            }
                            break;

                        case "startMusic":
                            flag2 = false;
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    MusicManager.playSong();
                                }
                                break;
                            }
                            break;

                        case "trackseq":
                            try
                            {
                                if (target == os.thisComputer)
                                {
                                    TrackerCompleteSequence.FlagNextForkbombCompletionToTrace(source != null ? source.ip : (string)null);
                                    break;
                                }
                                break;
                            }
                            catch (Exception ex)
                            {
                                os.write(Utils.GenerateReportFromExceptionCompact(ex));
                                break;
                            }

                        case "instanttrace":
                            if (target == os.thisComputer)
                            {
                                TrackerCompleteSequence.TriggerETAS((object)os);
                                break;
                            }
                            break;

                        case "flash":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    os.warningFlash();
                                }
                                break;
                            }
                            break;

                        case "openCDTray":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    target.openCDTray(source.ip);
                                }
                                break;
                            }
                            break;

                        case "closeCDTray":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    target.closeCDTray(source.ip);
                                }
                                break;
                            }
                            break;

                        case "setAdminPass":
                            target.setAdminPassword(strArray[1]);
                            break;

                        case "makeFile":
                            string        folderName    = strArray[1];
                            StringBuilder stringBuilder = new StringBuilder();
                            for (int index2 = 3; index2 < strArray.Length; ++index2)
                            {
                                stringBuilder.Append(strArray[index2]);
                                if (index2 + 1 < strArray.Length)
                                {
                                    stringBuilder.Append(" ");
                                }
                            }
                            Folder     folder     = target.files.root.searchForFolder(folderName);
                            List <int> folderPath = new List <int>();
                            if (folder == null)
                            {
                                folderPath.Add(0);
                            }
                            else
                            {
                                folderPath.Add(target.files.root.folders.IndexOf(folder));
                            }
                            target.makeFile(source.ip, strArray[2], ComputerLoader.filter(stringBuilder.ToString()), folderPath, true);
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        if (OS.TestingPassOnly)
                        {
                            throw new FormatException("Error Parsing command " + strArray[0] + " in HackerScript:", ex);
                        }
                        if (OS.DEBUG_COMMANDS)
                        {
                            os.terminal.write(Utils.GenerateReportFromException(ex));
                            os.write("HackScript error: " + strArray[0]);
                            os.write("Report written to Warnings file");
                            Utils.AppendToWarningsFile(Utils.GenerateReportFromException(ex));
                        }
                    }
                    try
                    {
                        if (flag2 && !os.thisComputer.disabled)
                        {
                            if (!OS.TestingPassOnly)
                            {
                                os.beepSound.Play();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        os.terminal.write(Utils.GenerateReportFromException(ex));
                        Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                        return;
                    }
                    if (!OS.TestingPassOnly)
                    {
                        Thread.Sleep(timeout);
                    }
                }
            }
            if (!nullable.HasValue)
            {
                return;
            }
            os.ActiveHackers.Remove(nullable.Value);
        }
 public static void OpenWindowsHelpDocument()
 {
     HostileHackerBreakinSequence.MinimizeAllOpenWindows();
     Process.Start("notepad.exe", HostileHackerBreakinSequence.HelpFilePath);
 }
Example #7
0
 public override void Update(float t)
 {
     base.Update(t);
     this.elapsedTime += t;
     if (this.IsInHostileFileCrash)
     {
         if ((double)this.elapsedTime % 0.5 < 0.0333333350718021)
         {
             ++this.extraErrors;
         }
         if ((double)this.elapsedTime < 15.0)
         {
             return;
         }
         if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed)
         {
             this.os.BootAssitanceModule.IsActive = true;
         }
         this.reset();
         this.os.canRunContent = false;
         this.os.bootingUp     = false;
     }
     else if ((double)this.elapsedTime < (double)CrashModule.BLUESCREEN_TIME / 4.0)
     {
         this.state = 0;
     }
     else if ((double)this.elapsedTime < (double)CrashModule.BLUESCREEN_TIME)
     {
         this.state = 1;
     }
     else if ((double)this.elapsedTime < (double)CrashModule.BLUESCREEN_TIME + (double)CrashModule.BLACK_TIME)
     {
         this.state = 2;
     }
     else if ((double)this.elapsedTime < (double)CrashModule.BLUESCREEN_TIME + (double)CrashModule.BLACK_TIME + (double)CrashModule.BOOT_TIME + (double)this.bootTextErrorDelay)
     {
         this.state          = 3;
         this.bootTextTimer -= t;
         if ((double)this.bootTextTimer <= 0.0)
         {
             this.bootTextTimer = this.bootTextDelay - (float)Utils.random.NextDouble() * this.bootTextDelay + (float)Utils.random.NextDouble() * this.bootTextDelay;
             ++this.bootTextCount;
             if (this.bootTextCount >= this.bootText.Length - 1)
             {
                 this.bootTextCount = this.bootText.Length - 1;
             }
             if (this.bootText[this.bootTextCount].Equals(" "))
             {
                 this.bootTextTimer = this.bootTextDelay * 12f;
             }
             if (this.bootText[this.bootTextCount].StartsWith("ERROR:"))
             {
                 this.bootTextTimer = this.bootTextDelay * 29f;
                 this.os.thisComputer.bootupTick((float)-((double)this.bootTextDelay * 42.0));
                 this.bootTextErrorDelay += this.bootTextDelay * 42f;
             }
             if (this.bootTextCount == 50 && HostileHackerBreakinSequence.IsInBlockingHostileFileState((object)this.os))
             {
                 this.bootTextTimer             = 999999f;
                 this.os.thisComputer.bootTimer = 9999f;
                 this.IsInHostileFileCrash      = true;
                 this.elapsedTime = 0.2f;
             }
         }
         if (!this.hasPlayedBeep)
         {
             if (!Settings.soundDisabled)
             {
                 CrashModule.beep.Play(0.5f, 0.5f, 0.0f);
                 this.os.delayer.Post(ActionDelayer.Wait(0.1), (Action)(() => CrashModule.beep.Play(0.5f, 0.5f, 0.0f)));
             }
             this.hasPlayedBeep = true;
         }
     }
     else
     {
         this.state = 2;
     }
 }
Example #8
0
        public static bool ExecuteProgram(object os_object, string[] arguments)
        {
            OS os = (OS)os_object;

            string[] strArray = arguments;
            bool     flag1    = true;

            if (strArray[0].ToLower().Equals("connect"))
            {
                Programs.connect(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("disconnect") || strArray[0].Equals("dc"))
            {
                Programs.disconnect(strArray, os);
            }
            else if (strArray[0].Equals("ls") || strArray[0].Equals("dir"))
            {
                Programs.ls(strArray, os);
            }
            else if (strArray[0].Equals("cd"))
            {
                Programs.cd(strArray, os);
            }
            else if (strArray[0].Equals("cd.."))
            {
                strArray = new string[2] {
                    "cd", ".."
                };
                Programs.cd(strArray, os);
            }
            else if (strArray[0].Equals("cat") || strArray[0].Equals("more") || strArray[0].Equals("less"))
            {
                Programs.cat(strArray, os);
            }
            else if (strArray[0].Equals("exe"))
            {
                Programs.execute(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("probe") || strArray[0].Equals("nmap"))
            {
                Programs.probe(strArray, os);
            }
            else if (strArray[0].Equals("scp"))
            {
                Programs.scp(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("scan"))
            {
                Programs.scan(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("rm") || strArray[0].Equals("del"))
            {
                Programs.rm(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("mv"))
            {
                Programs.mv(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("ps"))
            {
                Programs.ps(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("kill") || strArray[0].Equals("pkill"))
            {
                Programs.kill(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("reboot"))
            {
                Programs.reboot(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("opencdtray"))
            {
                Programs.opCDTray(strArray, os, true);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("closecdtray"))
            {
                Programs.opCDTray(strArray, os, false);
                flag1 = false;
            }
            else if (strArray[0].Equals("replace"))
            {
                Programs.replace2(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("analyze"))
            {
                Programs.analyze(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("solve"))
            {
                Programs.solve(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("clear"))
            {
                Programs.clear(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("upload") || strArray[0].Equals("up"))
            {
                Programs.upload(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("login"))
            {
                Programs.login(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("addnote"))
            {
                Programs.addNote(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals(":(){:|:&};:"))
            {
                ProgramRunner.ExecuteProgram((object)os, new string[1]
                {
                    "forkbomb"
                });
            }
            else if (strArray[0].ToLower().Equals("append"))
            {
                flag1 = false;
                string[] quoteSeperatedArgs = Utils.GetQuoteSeperatedArgs(strArray);
                Folder   currentFolder      = Programs.getCurrentFolder(os);
                if (quoteSeperatedArgs.Length > 1)
                {
                    FileEntry fileEntry1 = currentFolder.searchForFile(quoteSeperatedArgs[1]);
                    int       num        = 2;
                    if (fileEntry1 == null)
                    {
                        fileEntry1 = currentFolder.searchForFile(os.display.commandArgs[1]);
                        if (fileEntry1 == null)
                        {
                            os.write("Usage: append [FILENAME] [LINE TO APPEND]");
                            return(flag1);
                        }
                        os.write("No filename provided");
                        os.write("Assuming active flag file \"" + fileEntry1.name + "\" For editing");
                        if (strArray.Length == 1)
                        {
                            strArray = new string[2]
                            {
                                "append",
                                fileEntry1.name
                            }
                        }
                        ;
                        else
                        {
                            strArray[1] = fileEntry1.name;
                        }
                        num = 1;
                    }
                    if (fileEntry1 != null)
                    {
                        string str1 = "";
                        for (int index = num; index < quoteSeperatedArgs.Length; ++index)
                        {
                            str1 = str1 + quoteSeperatedArgs[index] + " ";
                        }
                        FileEntry fileEntry2 = fileEntry1;
                        string    str2       = fileEntry2.data + "\n" + str1;
                        fileEntry2.data = str2;
                        flag1           = true;
                        strArray[0]     = "cat";
                        strArray[1]     = fileEntry1.name;
                        for (int index = 2; index < strArray.Length; ++index)
                        {
                            strArray[index] = "";
                        }
                        Programs.cat(strArray, os);
                    }
                }
                else
                {
                    os.write("Usage: append [FILENAME] [LINE TO APPEND]");
                    return(flag1);
                }
            }
            else if (strArray[0].Equals("remline"))
            {
                FileEntry fileEntry = Programs.getCurrentFolder(os).searchForFile(strArray[1]);
                if (fileEntry != null)
                {
                    int length = fileEntry.data.LastIndexOf('\n');
                    if (length < 0)
                    {
                        length = 0;
                    }
                    fileEntry.data = fileEntry.data.Substring(0, length);
                    flag1          = true;
                    strArray[0]    = "cat";
                    for (int index = 2; index < strArray.Length; ++index)
                    {
                        strArray[index] = "";
                    }
                    Programs.cat(strArray, os);
                }
            }
            else if (strArray[0].Equals("getString"))
            {
                Programs.getString(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("reloadtheme"))
            {
                FileEntry fileEntry = os.thisComputer.files.root.searchForFolder("sys").searchForFile("x-server.sys");
                if (fileEntry != null)
                {
                    OSTheme themeForDataString = ThemeManager.getThemeForDataString(fileEntry.data);
                    ThemeManager.switchTheme((object)os, themeForDataString);
                }
                flag1 = false;
            }
            else if (strArray[0].Equals("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj"))
            {
                Programs.firstTimeInit(strArray, os, false);
                flag1 = false;
            }
            else if (strArray[0].Equals("chat"))
            {
                string message = "chat " + os.username + " ";
                for (int index = 1; index < strArray.Length; ++index)
                {
                    message = message + strArray[index] + " ";
                }
                if (os.multiplayer)
                {
                    os.sendMessage(message);
                }
                flag1 = false;
            }
            else if ((strArray[0].Equals("exitdemo") || strArray[0].Equals("resetdemo")) && Settings.isDemoMode)
            {
                MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped");
                MainMenu mainMenu = new MainMenu();
                os.ScreenManager.AddScreen((GameScreen)mainMenu);
                MainMenu.resetOS();
                os.ExitScreen();
                OS.currentInstance = (OS)null;
                flag1 = false;
                if (Settings.MultiLingualDemo)
                {
                    LocaleActivator.ActivateLocale("zh-cn", Game1.getSingleton().Content);
                }
            }
            else if (strArray[0].Equals("fh") && OS.DEBUG_COMMANDS)
            {
                Programs.fastHack(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("ra") && OS.DEBUG_COMMANDS)
            {
                Programs.revealAll(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("deathseq") && OS.DEBUG_COMMANDS)
            {
                os.TraceDangerSequence.BeginTraceDangerSequence();
                flag1 = false;
            }
            else if (strArray[0].Equals("testcredits") && OS.DEBUG_COMMANDS)
            {
                os.endingSequence.IsActive = true;
                flag1 = false;
            }
            else if (strArray[0].Equals("addflag") && OS.DEBUG_COMMANDS)
            {
                if (strArray.Length < 2)
                {
                    os.write("\nFlag to add required\n");
                }
                os.Flags.AddFlag(strArray[1]);
                flag1 = false;
            }
            else if (strArray[0].Equals("addTestEmails") && OS.DEBUG_COMMANDS)
            {
                for (int index = 0; index < 4; ++index)
                {
                    ((MailServer)os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(MailServer.generateEmail("testEmail " + (object)index + " " + Utils.getRandomByte().ToString(), "test", "test"), os.defaultUser.name);
                }
                flag1 = false;
            }
            else if (strArray[0].Equals("dscan") && OS.DEBUG_COMMANDS)
            {
                if (strArray.Length < 2)
                {
                    os.write("\nNode ID Required\n");
                }
                bool flag2 = false;
                for (int index = 0; index < os.netMap.nodes.Count; ++index)
                {
                    if (os.netMap.nodes[index].idName.ToLower().StartsWith(strArray[1].ToLower()))
                    {
                        os.netMap.discoverNode(os.netMap.nodes[index]);
                        os.netMap.nodes[index].highlightFlashTime = 1f;
                        flag2 = true;
                        break;
                    }
                }
                if (!flag2)
                {
                    os.write("Node ID Not found");
                }
                flag1 = false;
            }
            else if (strArray[0].Equals("revmany") && OS.DEBUG_COMMANDS)
            {
                for (int index1 = 0; index1 < 60; ++index1)
                {
                    int index2;
                    do
                    {
                        index2 = Utils.random.Next(os.netMap.nodes.Count);
                    }while (os.netMap.nodes[index2].idName == "mainHub" || os.netMap.nodes[index2].idName == "entropy00" || os.netMap.nodes[index2].idName == "entropy01");
                    os.netMap.discoverNode(os.netMap.nodes[index2]);
                }
                os.netMap.lastAddedNode = os.thisComputer;
                os.homeAssetServerID    = "dhsDrop";
                os.homeNodeID           = "dhs";
                os.netMap.discoverNode(Programs.getComputer(os, "dhs"));
                os.netMap.discoverNode(Programs.getComputer(os, "dhsDrop"));
                flag1 = false;
            }
            else if (strArray[0].ToLower().Equals("reloadext") && OS.DEBUG_COMMANDS)
            {
                if (Settings.IsInExtensionMode)
                {
                    ExtensionLoader.ReloadExtensionNodes((object)os);
                }
                flag1 = false;
            }
            else if (strArray[0].Equals("testsave") && OS.DEBUG_COMMANDS || strArray[0].Equals("save!(SJN!*SNL8vAewew57WewJdwl89(*4;;;&!)@&(ak'^&#@J3KH@!*"))
            {
                os.threadedSaveExecute(false);
                SettingsLoader.writeStatusFile();
                flag1 = false;
            }
            else if (strArray[0].Equals("testload") && OS.DEBUG_COMMANDS)
            {
                flag1 = false;
            }
            else if (strArray[0].Equals("teststrikerhack") && OS.DEBUG_COMMANDS)
            {
                os.delayer.Post(ActionDelayer.Wait(3.0), (Action)(() => MissionFunctions.runCommand(1, "triggerDLCHackRevenge")));
                flag1 = false;
            }
            else if (strArray[0].Equals("linkToCSECPostDLC") && OS.DEBUG_COMMANDS)
            {
                os.execute("dscan mainhub");
                os.allFactions.setCurrentFaction("hub", os);
                os.currentFaction.playerValue = 2;
                os.Flags.AddFlag("dlc_complete");
                os.Flags.AddFlag("dlc_csec_end_facval:0");
                MissionFunctions.runCommand(1, "addRank");
                flag1 = false;
            }
            else if (strArray[0].Equals("debug") && OS.DEBUG_COMMANDS)
            {
                int num = PortExploits.services.Count;
                if (strArray.Length > 1)
                {
                    try
                    {
                        num = Convert.ToInt32(strArray[1]);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                for (int index = 0; index < PortExploits.services.Count && index <= num; ++index)
                {
                    os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]], PortExploits.cracks[PortExploits.portNums[index]]));
                }
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[9], PortExploits.cracks[9]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[10], PortExploits.cracks[10]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[11], PortExploits.cracks[11]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[12], PortExploits.cracks[12]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[13], PortExploits.cracks[13]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[14], PortExploits.cracks[14]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[15], PortExploits.cracks[15]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[16], PortExploits.cracks[16]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[17], PortExploits.cracks[17]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[31], PortExploits.cracks[31]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[33], PortExploits.cracks[33]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[34], PortExploits.cracks[34]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[35], PortExploits.cracks[35]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[36], PortExploits.cracks[36]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[37], PortExploits.cracks[37]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[38], PortExploits.cracks[38]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[39], PortExploits.cracks[39]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[41], PortExploits.cracks[41]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[554], PortExploits.cracks[554]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[40], PortExploits.cracks[40]));
                os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.DangerousPacemakerFirmware, "KBT_TestFirmware.dll"));
                os.Flags.AddFlag("dechead");
                os.Flags.AddFlag("decypher");
                os.Flags.AddFlag("csecBitSet01Complete");
                os.Flags.AddFlag("csecRankingS2Pass");
                os.Flags.AddFlag("CSEC_Member");
                os.Flags.AddFlag("bitPathStarted");
                flag1 = false;
                for (int index = 0; index < 4; ++index)
                {
                    Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, (byte)2, os);
                    c.adminIP = os.thisComputer.adminIP;
                    os.netMap.nodes.Add(c);
                    os.netMap.discoverNode(c);
                }
                os.netMap.discoverNode("practiceServer");
                os.netMap.discoverNode("entropy00");
            }
            else if (strArray[0].Equals("flash") && OS.DEBUG_COMMANDS)
            {
                os.traceTracker.start(40f);
                os.warningFlash();
                flag1 = false;
                os.IncConnectionOverlay.Activate();
            }
            else if (strArray[0].Equals("cycletheme") && OS.DEBUG_COMMANDS)
            {
                Action <OSTheme> ctheme = (Action <OSTheme>)(theme => ThemeManager.switchTheme((object)os, theme));
                int    next             = 1;
                double delay            = 1.2;
                Action cthemeAct        = (Action)(() =>
                {
                    ctheme((OSTheme)next);
                    next = (next + 1) % 7;
                });
                cthemeAct += (Action)(() => os.delayer.Post(ActionDelayer.Wait(delay), cthemeAct));
                cthemeAct();
            }
            else if (strArray[0].Equals("testdlc") && OS.DEBUG_COMMANDS)
            {
                MissionFunctions.runCommand(0, "demoFinalMissionEndDLC");
                flag1 = false;
            }
            else if (strArray[0].Equals("testircentries") && OS.DEBUG_COMMANDS)
            {
                DLCHubServer daemon = Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)) as DLCHubServer;
                for (int index = 0; index < 100; ++index)
                {
                    daemon.IRCSystem.AddLog("Test", "Test Message\nMultiline\nMessage", (string)null);
                }
                flag1 = false;
            }
            else if (strArray[0].Equals("testirc") && OS.DEBUG_COMMANDS)
            {
                DLCHubServer daemon = Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)) as DLCHubServer;
                daemon.IRCSystem.AddLog("Test", "Test Message", (string)null);
                daemon.IRCSystem.AddLog("Channel", "Test Message\nfrom channel", (string)null);
                flag1 = false;
            }
            else if (strArray[0].Equals("flashtest") && OS.DEBUG_COMMANDS)
            {
                if (!PostProcessor.dangerModeEnabled)
                {
                    PostProcessor.dangerModeEnabled         = true;
                    PostProcessor.dangerModePercentComplete = 0.5f;
                }
                else
                {
                    PostProcessor.dangerModeEnabled         = false;
                    PostProcessor.dangerModePercentComplete = 0.0f;
                }
                flag1 = false;
            }
            else if (strArray[0].Equals("dectest") && OS.DEBUG_COMMANDS)
            {
                string str1 = "this is a test message for the encrypter";
                string str2 = FileEncrypter.EncryptString(str1, "header message", "1.2.3.4.5", "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass", (string)null);
                os.write(str1);
                os.write("  ");
                os.write("  ");
                os.write(str2);
                os.write("  ");
                os.write("  ");
                os.write(FileEncrypter.MakeReplacementsForDisplay(FileEncrypter.DecryptString(str2, "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass")[2]));
                os.write("  ");
                os.write(FileEncrypter.MakeReplacementsForDisplay(FileEncrypter.DecryptString(str2, "wrongPass")[2] == null ? "NULL" : "CORRECT"));
                os.write("  ");
            }
            else if (strArray[0].Equals("test") && OS.DEBUG_COMMANDS)
            {
                ((DLCHubServer)Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer))).AddMission((ActiveMission)ComputerLoader.readMission("Content/DLC/Missions/Attack/AttackMission.xml"), (string)null, false);
            }
            else if (strArray[0].Equals("testtrace") && OS.DEBUG_COMMANDS)
            {
                MissionFunctions.runCommand(1, "triggerDLCHackRevenge");
            }
            else if (strArray[0].Equals("testboot") && OS.DEBUG_COMMANDS)
            {
                os.BootAssitanceModule.IsActive = true;
                os.bootingUp     = false;
                os.canRunContent = false;
                MusicManager.stop();
            }
            else if (strArray[0].Equals("testhhbs") && OS.DEBUG_COMMANDS)
            {
                os.write(HostileHackerBreakinSequence.IsInBlockingHostileFileState((object)os) ? "BLOCKED" : "SAFE");
            }
            else if (strArray[0].Equals("printflags") && OS.DEBUG_COMMANDS)
            {
                os.write(os.Flags.GetSaveString());
            }
            else if (strArray[0].Equals("loseadmin") && OS.DEBUG_COMMANDS)
            {
                os.connectedComp.adminIP = os.connectedComp.ip;
                flag1 = false;
            }
            else if (strArray[0].Equals("runcmd") && OS.DEBUG_COMMANDS)
            {
                if (strArray.Length > 1)
                {
                    string name = strArray[1];
                    int    num  = 0;
                    if (strArray.Length > 2)
                    {
                        num = Convert.ToInt32(strArray[1]);
                    }
                    MissionFunctions.runCommand(num, name);
                }
            }
            else if (strArray[0].ToLower().Equals("runhackscript") && OS.DEBUG_COMMANDS)
            {
                if (strArray.Length > 1)
                {
                    string scriptName = strArray[1];
                    try
                    {
                        HackerScriptExecuter.runScript(scriptName, (object)os, os.thisComputer.ip, os.thisComputer.ip);
                    }
                    catch (Exception ex)
                    {
                        os.write("Error launching script " + scriptName);
                        os.write(Utils.GenerateReportFromExceptionCompact(ex));
                    }
                }
            }
            else if (strArray[0].Equals("MotIsTheBest") && OS.DEBUG_COMMANDS)
            {
                os.runCommand("probe");
                os.runCommand("exe WebServerWorm 80");
                os.runCommand("exe SSHcrack 22");
                os.runCommand("exe SMTPoverflow 25");
                os.runCommand("exe FTPBounce 21");
            }
            else if (strArray[0].Equals("help") || strArray[0].Equals("Help") || strArray[0].Equals("?") || strArray[0].Equals("man"))
            {
                int page = 0;
                if (strArray.Length > 1)
                {
                    try
                    {
                        page = Convert.ToInt32(strArray[1]);
                        if (page > Helpfile.getNumberOfPages())
                        {
                            os.write("Invalid Page Number - Displaying First Page");
                            page = 0;
                        }
                    }
                    catch (FormatException ex)
                    {
                        os.write("Invalid Page Number");
                    }
                    catch (OverflowException ex)
                    {
                        os.write("Invalid Page Number");
                    }
                }
                Helpfile.writeHelp(os, page);
                flag1 = false;
            }
            else
            {
                if (strArray[0] != "")
                {
                    int num = ProgramRunner.AttemptExeProgramExecution(os, strArray);
                    if (num == 0)
                    {
                        os.write("Execution failed");
                    }
                    else if (num < 0)
                    {
                        os.write("No Command " + strArray[0] + " - Check Syntax\n");
                    }
                }
                flag1 = false;
            }
            if (flag1)
            {
                if (!os.commandInvalid)
                {
                    os.display.command     = strArray[0];
                    os.display.commandArgs = strArray;
                    os.display.typeChanged();
                }
                else
                {
                    os.commandInvalid = false;
                }
            }
            return(flag1);
        }