From e51f51b7d1b379f7d632ee010ad704562aacb797 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 8 Mar 2017 16:26:35 -0500 Subject: password breaching works now. --- ShiftOS.WinForms/HackerCommands.cs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'ShiftOS.WinForms/HackerCommands.cs') diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 7861981..f3f132e 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -360,7 +360,7 @@ namespace ShiftOS.WinForms { string usr = args["user"].ToString(); string sys = args["sys"].ToString(); - + bool received = false; ServerMessageReceived msgReceived = null; Console.WriteLine("--hooking system thread..."); @@ -373,30 +373,28 @@ namespace ShiftOS.WinForms var rnd = new Random(); var sw = new Stopwatch(); sw.Start(); - string pass = ""; - for(int i = 0; i < sve.Password.Length; i++) + Thread.Sleep(2000); + if(rnd.Next(0, 100) >= 75) { - char c = '\0'; - while (c != sve.Password[i]) - c = chars[rnd.Next(0, chars.Length)]; - pass += c; - Thread.Sleep(rnd.Next(25,75)); + Console.WriteLine("--operation took too long - failed."); + return; } sw.Stop(); - Console.WriteLine(pass); + Console.WriteLine(sve.Password); Console.WriteLine(); Console.WriteLine("--password breached. Operation took " + sw.ElapsedMilliseconds + " milliseconds."); + received = true; ServerManager.MessageReceived -= msgReceived; } else if(msg.Name == "user_data_not_found") { Console.WriteLine("--access denied."); + received = true; ServerManager.MessageReceived -= msgReceived; } }; Console.WriteLine("--beginning brute-force attack on " + usr + "@" + sys + "..."); - Thread.Sleep(500); ServerManager.MessageReceived += msgReceived; ServerManager.SendMessage("get_user_data", JsonConvert.SerializeObject(new @@ -404,6 +402,7 @@ namespace ShiftOS.WinForms user = usr, sysname = sys })); + Thread.Sleep(500); return true; } @@ -418,7 +417,7 @@ namespace ShiftOS.WinForms string usr = args["user"].ToString(); string sys = args["sys"].ToString(); string pass = args["pass"].ToString(); - + bool received = false; ServerMessageReceived msgReceived = null; Console.WriteLine("--hooking multi-user domain response call..."); @@ -441,18 +440,19 @@ namespace ShiftOS.WinForms { Console.WriteLine("--access denied."); } + received = true; ServerManager.MessageReceived -= msgReceived; } else if (msg.Name == "user_data_not_found") { Console.WriteLine("--access denied."); + received = true; ServerManager.MessageReceived -= msgReceived; } }; Console.WriteLine("--contacting multi-user domain..."); - Thread.Sleep(500); ServerManager.MessageReceived += msgReceived; ServerManager.SendMessage("get_user_data", JsonConvert.SerializeObject(new @@ -460,6 +460,7 @@ namespace ShiftOS.WinForms user = usr, sysname = sys })); + Thread.Sleep(500); return true; } @@ -476,7 +477,7 @@ namespace ShiftOS.WinForms string sys = args["sys"].ToString(); string pass = args["pass"].ToString(); long amount = (long)args["amount"]; - + bool received = false; if(amount < 0) { Console.WriteLine("--invalid codepoint amount - halting..."); @@ -509,12 +510,13 @@ namespace ShiftOS.WinForms { Console.WriteLine("--access denied."); } - + received = true; ServerManager.MessageReceived -= msgReceived; } else if (msg.Name == "user_data_not_found") { Console.WriteLine("--access denied."); + received = true; ServerManager.MessageReceived -= msgReceived; } }; @@ -528,6 +530,8 @@ namespace ShiftOS.WinForms user = usr, sysname = sys })); + Thread.Sleep(500); + return true; } -- cgit v1.2.3 From d9b4e79bcffea6139fadefcd95a020029941eda7 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 9 Mar 2017 13:40:33 -0500 Subject: fix some minor hacking issues You can now purge dead saves. --- ShiftOS.WinForms/HackerCommands.cs | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'ShiftOS.WinForms/HackerCommands.cs') diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index f3f132e..b2170cd 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -377,6 +377,7 @@ namespace ShiftOS.WinForms if(rnd.Next(0, 100) >= 75) { Console.WriteLine("--operation took too long - failed."); + ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve)); return; } sw.Stop(); @@ -498,6 +499,7 @@ namespace ShiftOS.WinForms if(amount > sve.Codepoints) { Console.WriteLine("--can't steal this many codepoints from user."); + ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve)); return; } @@ -535,6 +537,57 @@ namespace ShiftOS.WinForms return true; } + [Command("purge_user")] + [KernelMode] + [RequiresArgument("pass")] + [RequiresArgument("user")] + [RequiresArgument("sys")] + [RequiresUpgrade("hacker101_deadaccts")] + public static bool PurgeUser(Dictionary args) + { + string usr = args["user"].ToString(); + string sys = args["sys"].ToString(); + string pass = args["pass"].ToString(); + ServerMessageReceived msgReceived = null; + + Console.WriteLine("--hooking multi-user domain response call..."); + + msgReceived = (msg) => + { + if (msg.Name == "user_data") + { + var sve = JsonConvert.DeserializeObject(msg.Contents); + if (sve.Password == pass) + { + ServerManager.SendMessage("delete_dead_save", JsonConvert.SerializeObject(sve)); + Console.WriteLine(" User purged successfully."); + } + else + { + Console.WriteLine("--access denied."); + } + ServerManager.MessageReceived -= msgReceived; + } + else if (msg.Name == "user_data_not_found") + { + Console.WriteLine("--access denied."); + ServerManager.MessageReceived -= msgReceived; + } + }; + + Console.WriteLine("--contacting multi-user domain..."); + Thread.Sleep(500); + ServerManager.MessageReceived += msgReceived; + + ServerManager.SendMessage("get_user_data", JsonConvert.SerializeObject(new + { + user = usr, + sysname = sys + })); + Thread.Sleep(500); + + return true; + } [Command("brute_decrypt", true)] -- cgit v1.2.3 From b4a5c854c8b597340cb349ba9d2fe59c2f4a652a Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 9 Mar 2017 16:51:00 -0500 Subject: hacker commands print the prompt when done --- ShiftOS.WinForms/HackerCommands.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ShiftOS.WinForms/HackerCommands.cs') diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index b2170cd..52d8568 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -386,12 +386,14 @@ namespace ShiftOS.WinForms Console.WriteLine("--password breached. Operation took " + sw.ElapsedMilliseconds + " milliseconds."); received = true; ServerManager.MessageReceived -= msgReceived; + TerminalBackend.PrintPrompt(); } else if(msg.Name == "user_data_not_found") { Console.WriteLine("--access denied."); received = true; ServerManager.MessageReceived -= msgReceived; + TerminalBackend.PrintPrompt(); } }; @@ -443,6 +445,7 @@ namespace ShiftOS.WinForms } received = true; ServerManager.MessageReceived -= msgReceived; + TerminalBackend.PrintPrompt(); } else if (msg.Name == "user_data_not_found") @@ -450,6 +453,7 @@ namespace ShiftOS.WinForms Console.WriteLine("--access denied."); received = true; ServerManager.MessageReceived -= msgReceived; + TerminalBackend.PrintPrompt(); } }; @@ -514,12 +518,14 @@ namespace ShiftOS.WinForms } received = true; ServerManager.MessageReceived -= msgReceived; + TerminalBackend.PrintPrompt(); } else if (msg.Name == "user_data_not_found") { Console.WriteLine("--access denied."); received = true; ServerManager.MessageReceived -= msgReceived; + TerminalBackend.PrintPrompt(); } }; @@ -573,6 +579,7 @@ namespace ShiftOS.WinForms Console.WriteLine("--access denied."); ServerManager.MessageReceived -= msgReceived; } + TerminalBackend.PrintPrompt(); }; Console.WriteLine("--contacting multi-user domain..."); -- cgit v1.2.3 From a9754b7df28795b6bb2c5cfe04c1b38b19fb0d05 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 10 Mar 2017 12:29:28 -0500 Subject: Lock certain apps away when system offline. --- ShiftOS.WinForms/Applications/Artpad.cs | 1 + ShiftOS.WinForms/Applications/Chat.cs | 1 + ShiftOS.WinForms/Applications/Downloader.cs | 1 + ShiftOS.WinForms/Applications/FormatEditor.cs | 1 + ShiftOS.WinForms/Applications/GraphicPicker.cs | 1 + ShiftOS.WinForms/Applications/MUDControlCentre.cs | 1 + ShiftOS.WinForms/Applications/NameChanger.cs | 1 + ShiftOS.WinForms/Applications/Pong.cs | 1 + ShiftOS.WinForms/Applications/ShiftLetters.cs | 1 + ShiftOS.WinForms/Applications/ShiftLotto.cs | 1 + ShiftOS.WinForms/Applications/ShiftSweeper.cs | 1 + ShiftOS.WinForms/Applications/Shifter.cs | 1 + ShiftOS.WinForms/Applications/Shiftnet.cs | 1 + .../Applications/ShiftoriumFrontend.cs | 1 + ShiftOS.WinForms/HackerCommands.cs | 10 ++++++ ShiftOS.WinForms/WinformsWindowManager.cs | 18 ++++++++++ ShiftOS_TheReturn/AppLauncherDaemon.cs | 20 +++++++++--- ShiftOS_TheReturn/KernelWatchdog.cs | 38 +++++++++++++++++++++- ShiftOS_TheReturn/Scripting.cs | 7 ++-- 19 files changed, 100 insertions(+), 7 deletions(-) (limited to 'ShiftOS.WinForms/HackerCommands.cs') diff --git a/ShiftOS.WinForms/Applications/Artpad.cs b/ShiftOS.WinForms/Applications/Artpad.cs index 6c1bc1c..71f7afb 100644 --- a/ShiftOS.WinForms/Applications/Artpad.cs +++ b/ShiftOS.WinForms/Applications/Artpad.cs @@ -41,6 +41,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Artpad", true, "al_artpad", "Graphics")] [RequiresUpgrade("artpad")] [WinOpen("artpad")] diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index 06a7873..caf8cd2 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -36,6 +36,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] public partial class Chat : UserControl, IShiftOSWindow { public Chat(string chatId) diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs index da90c6d..1f240bf 100644 --- a/ShiftOS.WinForms/Applications/Downloader.cs +++ b/ShiftOS.WinForms/Applications/Downloader.cs @@ -41,6 +41,7 @@ using System.IO.Compression; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Downloader", false, null, "Networking")] [DefaultIcon("iconDownloader")] public partial class Downloader : UserControl, IShiftOSWindow diff --git a/ShiftOS.WinForms/Applications/FormatEditor.cs b/ShiftOS.WinForms/Applications/FormatEditor.cs index ef44b47..56b0253 100644 --- a/ShiftOS.WinForms/Applications/FormatEditor.cs +++ b/ShiftOS.WinForms/Applications/FormatEditor.cs @@ -34,6 +34,7 @@ using System.Windows.Forms; using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("FormatEditor", true, "al_format_editor", "Games")] [RequiresUpgrade("format_editor")] [WinOpen("formateditor")] diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.cs b/ShiftOS.WinForms/Applications/GraphicPicker.cs index 2dfe7ec..b3dd8bf 100644 --- a/ShiftOS.WinForms/Applications/GraphicPicker.cs +++ b/ShiftOS.WinForms/Applications/GraphicPicker.cs @@ -37,6 +37,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [DefaultTitle("Choose graphic")] [DefaultIcon("icongraphicpicker")] public partial class GraphicPicker : UserControl, IShiftOSWindow { diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index 02fe868..e2668bd 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [RequiresUpgrade("mud_fundamentals")] [Launcher("MUD Control Centre", true, "al_mud_control_centre", "Networking")] [WinOpen("mud_control_centre")] diff --git a/ShiftOS.WinForms/Applications/NameChanger.cs b/ShiftOS.WinForms/Applications/NameChanger.cs index ca76e57..d7c99f7 100644 --- a/ShiftOS.WinForms/Applications/NameChanger.cs +++ b/ShiftOS.WinForms/Applications/NameChanger.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Name Changer", true, "al_name_changer", "Customization")] [RequiresUpgrade("name_changer")] [WinOpen("name_changer")] diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index af1e156..157ce8c 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -37,6 +37,7 @@ using ShiftOS.Objects; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Pong", true, "al_pong", "Games")] [WinOpen("pong")] [DefaultIcon("iconPong")] diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs index 700df7e..b5e9aa4 100644 --- a/ShiftOS.WinForms/Applications/ShiftLetters.cs +++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs @@ -36,6 +36,7 @@ using System.Windows.Forms; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("ShiftLetters", false, null, "Games")] [RequiresUpgrade("shiftletters")] [WinOpen("shiftletters")] diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index 7acba3e..33f357f 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -35,6 +35,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [Launcher("ShiftLotto", true, "al_shiftlotto", "Games")] + [MultiplayerOnly] [DefaultIcon("iconShiftLotto")] [RequiresUpgrade("shiftlotto")] [WinOpen("shiftlotto")] diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index b13880f..cf6d331 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -36,6 +36,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [Launcher("ShiftSweeper", true, "al_shiftsweeper", "Games")] [RequiresUpgrade("shiftsweeper")] + [MultiplayerOnly] [WinOpen("shiftsweeper")] [DefaultIcon("iconShiftSweeper")] public partial class ShiftSweeper : UserControl, IShiftOSWindow { diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 1adc75a..fe2bf20 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -40,6 +40,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Shifter", true, "al_shifter", "Customization")] [RequiresUpgrade("shifter")] [WinOpen("shifter")] diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 45f37d4..c1c81d5 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { [Launcher("Shiftnet", false, null, "Networking")] + [MultiplayerOnly] [DefaultIcon("iconShiftnet")] public partial class Shiftnet : UserControl, IShiftOSWindow { public Shiftnet() { diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index b3724ae..0580b47 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -39,6 +39,7 @@ namespace ShiftOS.WinForms.Applications { [Launcher("Shiftorium", true, "al_shiftorium", "Utilities")] [RequiresUpgrade("shiftorium_gui")] + [MultiplayerOnly] [WinOpen("shiftorium")] [DefaultTitle("Shiftorium")] [DefaultIcon("iconShiftorium")] diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 52d8568..d9504d3 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -668,5 +668,15 @@ namespace ShiftOS.WinForms return true; } + + [Command("experience", description = "Marks a story plot as experienced without triggering the plot.", usage ="{id:}")] + [RequiresArgument("id")] + [RemoteLock] + public static bool Experience(Dictionary args) + { + SaveSystem.CurrentSave.StoriesExperienced.Add(args["id"].ToString()); + SaveSystem.SaveGame(); + return true; + } } } diff --git a/ShiftOS.WinForms/WinformsWindowManager.cs b/ShiftOS.WinForms/WinformsWindowManager.cs index b8f0cae..eeaa6c9 100644 --- a/ShiftOS.WinForms/WinformsWindowManager.cs +++ b/ShiftOS.WinForms/WinformsWindowManager.cs @@ -106,6 +106,24 @@ namespace ShiftOS.WinForms return; } + foreach(var attr in form.GetType().GetCustomAttributes(true)) + { + if(attr is MultiplayerOnlyAttribute) + { + if(KernelWatchdog.MudConnected == false) + { + Infobox.PromptYesNo("Disconnected from MUD", "This application requires a connection to the MUD. Would you like to reconnect?", new Action((answer) => + { + if(answer == true) + { + KernelWatchdog.MudConnected = true; + SetupWindow(form); + } + })); + return; + } + } + } if (!Shiftorium.UpgradeAttributesUnlocked(form.GetType())) { diff --git a/ShiftOS_TheReturn/AppLauncherDaemon.cs b/ShiftOS_TheReturn/AppLauncherDaemon.cs index 7ef34c1..5e3bd72 100644 --- a/ShiftOS_TheReturn/AppLauncherDaemon.cs +++ b/ShiftOS_TheReturn/AppLauncherDaemon.cs @@ -66,12 +66,24 @@ namespace ShiftOS.Engine { foreach (var attr in type.GetCustomAttributes(false)) { - if (attr is LauncherAttribute) + bool isAllowed = true; + if(attr is MultiplayerOnlyAttribute) { - var launch = attr as LauncherAttribute; - if (launch.UpgradeInstalled) + if(KernelWatchdog.MudConnected == false) { - win.Add(new LauncherItem { DisplayData = launch, LaunchType = type }); + isAllowed = false; + + } + } + if (isAllowed == true) + { + if (attr is LauncherAttribute) + { + var launch = attr as LauncherAttribute; + if (launch.UpgradeInstalled) + { + win.Add(new LauncherItem { DisplayData = launch, LaunchType = type }); + } } } } diff --git a/ShiftOS_TheReturn/KernelWatchdog.cs b/ShiftOS_TheReturn/KernelWatchdog.cs index 1b59b25..e69c9ba 100644 --- a/ShiftOS_TheReturn/KernelWatchdog.cs +++ b/ShiftOS_TheReturn/KernelWatchdog.cs @@ -25,8 +25,44 @@ namespace ShiftOS.Engine } } + private static bool _mudConnected = true; + public static bool InKernelMode { get; private set; } - public static bool MudConnected { get; set; } + public static bool MudConnected + { + get + { + return _mudConnected; + } + set + { + if(value == false) + { + foreach(var win in AppearanceManager.OpenForms) + { + foreach(var attr in win.ParentWindow.GetType().GetCustomAttributes(true)) + { + if(attr is MultiplayerOnlyAttribute) + { + ConsoleEx.Bold = true; + ConsoleEx.Underline = false; + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.Red; + Console.Write("Error:"); + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine("Cannot disconnect from multi-user domain because an app that depends on it is open."); + TerminalBackend.PrintPrompt(); + return; + } + } + } + } + + _mudConnected = value; + Desktop.PopulateAppLauncher(); + } + } public static bool IsSafe(Type type) { diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index bb65dc7..6768efb 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -67,11 +67,14 @@ namespace ShiftOS.Engine.Scripting { ServerManager.MessageReceived += (msg) => { - if(msg.Name == "run") + if (msg.Name == "run") { var cntnts = JsonConvert.DeserializeObject(msg.Contents); var interp = new LuaInterpreter(); - interp.Execute(cntnts.script.ToString()); + Desktop.InvokeOnWorkerThread(() => + { + interp.Execute(cntnts.script.ToString()); + }); } }; } -- cgit v1.2.3 From b9c3a0e30f6a939b1e1e3142cb507dfe7993b683 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 11 Mar 2017 08:32:13 -0500 Subject: Fix deadlocks in hacker commands. --- ShiftOS.WinForms/HackerCommands.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'ShiftOS.WinForms/HackerCommands.cs') diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index d9504d3..59d0f4e 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -378,6 +378,8 @@ namespace ShiftOS.WinForms { Console.WriteLine("--operation took too long - failed."); ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve)); + ServerManager.MessageReceived -= msgReceived; + TerminalBackend.PrefixEnabled = true; return; } sw.Stop(); @@ -395,6 +397,7 @@ namespace ShiftOS.WinForms ServerManager.MessageReceived -= msgReceived; TerminalBackend.PrintPrompt(); } + TerminalBackend.PrefixEnabled = true; }; Console.WriteLine("--beginning brute-force attack on " + usr + "@" + sys + "..."); @@ -405,6 +408,7 @@ namespace ShiftOS.WinForms user = usr, sysname = sys })); + TerminalBackend.PrefixEnabled = false; Thread.Sleep(500); return true; } @@ -446,7 +450,7 @@ namespace ShiftOS.WinForms received = true; ServerManager.MessageReceived -= msgReceived; TerminalBackend.PrintPrompt(); - + } else if (msg.Name == "user_data_not_found") { @@ -455,6 +459,7 @@ namespace ShiftOS.WinForms ServerManager.MessageReceived -= msgReceived; TerminalBackend.PrintPrompt(); } + TerminalBackend.PrefixEnabled = true; }; Console.WriteLine("--contacting multi-user domain..."); @@ -466,6 +471,7 @@ namespace ShiftOS.WinForms sysname = sys })); Thread.Sleep(500); + TerminalBackend.PrefixEnabled = false; return true; } @@ -504,6 +510,7 @@ namespace ShiftOS.WinForms { Console.WriteLine("--can't steal this many codepoints from user."); ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve)); + TerminalBackend.PrefixEnabled = true; return; } @@ -527,6 +534,7 @@ namespace ShiftOS.WinForms ServerManager.MessageReceived -= msgReceived; TerminalBackend.PrintPrompt(); } + TerminalBackend.PrefixEnabled = true; }; Console.WriteLine("--contacting multi-user domain..."); @@ -539,7 +547,7 @@ namespace ShiftOS.WinForms sysname = sys })); Thread.Sleep(500); - + TerminalBackend.PrefixEnabled = false; return true; } @@ -580,6 +588,7 @@ namespace ShiftOS.WinForms ServerManager.MessageReceived -= msgReceived; } TerminalBackend.PrintPrompt(); + TerminalBackend.PrefixEnabled = true; }; Console.WriteLine("--contacting multi-user domain..."); @@ -592,7 +601,7 @@ namespace ShiftOS.WinForms sysname = sys })); Thread.Sleep(500); - + TerminalBackend.PrefixEnabled = false; return true; } -- cgit v1.2.3 From 49812bf46cb153af6bab8e2a095024da84fcc149 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 11 Mar 2017 09:04:45 -0500 Subject: Lock down various commands while offline. --- ShiftOS.WinForms/HackerCommands.cs | 6 + ShiftOS_TheReturn/Commands.cs | 50 ++------- ShiftOS_TheReturn/KernelWatchdog.cs | 26 +++++ ShiftOS_TheReturn/TerminalBackend.cs | 205 ++++++++++++++++++++++------------- 4 files changed, 168 insertions(+), 119 deletions(-) (limited to 'ShiftOS.WinForms/HackerCommands.cs') diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 59d0f4e..f9d3bcc 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -351,6 +351,7 @@ namespace ShiftOS.WinForms const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_"; + [MultiplayerOnly] [Command("breach_user_password")] [KernelMode] [RequiresArgument("user")] @@ -413,6 +414,8 @@ namespace ShiftOS.WinForms return true; } + + [MultiplayerOnly] [Command("print_user_info")] [KernelMode] [RequiresArgument("pass")] @@ -475,6 +478,7 @@ namespace ShiftOS.WinForms return true; } + [MultiplayerOnly] [Command("steal_codepoints")] [KernelMode] [RequiresArgument("amount")] @@ -551,6 +555,7 @@ namespace ShiftOS.WinForms return true; } + [MultiplayerOnly] [Command("purge_user")] [KernelMode] [RequiresArgument("pass")] @@ -646,6 +651,7 @@ namespace ShiftOS.WinForms } } + [MultiplayerOnly] [Namespace("storydev")] public static class StoryDevCommands { diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 0ea00e5..12c371f 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -133,6 +133,7 @@ namespace ShiftOS.Engine [Namespace("mud")] public static class MUDCommands { + [MultiplayerOnly] [Command("status")] public static bool Status() { @@ -174,6 +175,7 @@ namespace ShiftOS.Engine return true; } + [MultiplayerOnly] [Command("disconnect")] [RequiresUpgrade("hacker101_deadaccts")] public static bool Disconnect() @@ -183,6 +185,7 @@ namespace ShiftOS.Engine return true; } + [MultiplayerOnly] [Command("sendmsg")] [KernelMode] [RequiresUpgrade("hacker101_deadaccts")] @@ -195,48 +198,6 @@ namespace ShiftOS.Engine } } - [RequiresUpgrade("mud_fundamentals")] - [Namespace("chat")] - public static class ChatCommands - { - [RequiresArgument("id")] - [RequiresArgument("name")] - [RequiresArgument("topic")] - [Command("create")] - public static bool CreateChat(Dictionary args) - { - string id = ""; - string topic = ""; - string name = ""; - int max_users = 0; - - id = args["id"] as string; - name = args["topic"] as string; - topic = args["name"] as string; - - bool valid = true; - - if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(topic)) - valid = false; - - if (valid) - { - ServerManager.SendMessage("chat_create", $@"{{ - id: ""{id}"", - name: ""{name}"", - topic: ""{topic}"", - max_users: {max_users} -}}"); - } - else - { - Console.WriteLine("{CHAT_PLEASE_PROVIDE_VALID_CHANNEL_DATA}"); - } - return true; - } - - } - [TutorialLock] [Namespace("trm")] public static class TerminalCommands @@ -266,6 +227,7 @@ namespace ShiftOS.Engine } } + [MultiplayerOnly] [Namespace("dev")] public static class ShiftOSDevCommands { @@ -474,6 +436,7 @@ namespace ShiftOS.Engine return true; } + [MultiplayerOnly] [Command("save")] public static bool Save() { @@ -481,6 +444,7 @@ namespace ShiftOS.Engine return true; } + [MultiplayerOnly] [Command("status")] public static bool Status() { @@ -493,7 +457,7 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, } } - + [MultiplayerOnly] [Namespace("shiftorium")] public static class ShiftoriumCommands { diff --git a/ShiftOS_TheReturn/KernelWatchdog.cs b/ShiftOS_TheReturn/KernelWatchdog.cs index e69c9ba..cc03f5a 100644 --- a/ShiftOS_TheReturn/KernelWatchdog.cs +++ b/ShiftOS_TheReturn/KernelWatchdog.cs @@ -102,5 +102,31 @@ namespace ShiftOS.Engine InKernelMode = false; Console.WriteLine(" Kernel mode disabled."); } + + internal static bool CanRunOffline(Type method) + { + if (MudConnected) + return true; + + foreach (var attr in method.GetCustomAttributes(false)) + { + if (attr is MultiplayerOnlyAttribute) + return false; + } + return true; + } + + internal static bool CanRunOffline(MethodInfo method) + { + if (MudConnected) + return true; + + foreach(var attr in method.GetCustomAttributes(false)) + { + if (attr is MultiplayerOnlyAttribute) + return false; + } + return true; + } } } diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 5022cd1..c7852f1 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -148,128 +148,181 @@ namespace ShiftOS.Engine { if (KernelWatchdog.IsSafe(type)) { - foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) + if (KernelWatchdog.CanRunOffline(type)) { - if (Shiftorium.UpgradeAttributesUnlocked(method)) + foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { - if (CanRunRemotely(method, isRemote)) + if (Shiftorium.UpgradeAttributesUnlocked(method)) { - foreach (var ma in method.GetCustomAttributes(false)) + if (CanRunRemotely(method, isRemote)) { - if (ma is Command) + foreach (var ma in method.GetCustomAttributes(false)) { - var cmd = ma as Command; - if (text.Split('.')[1] == cmd.name) + if (ma is Command) { - if (KernelWatchdog.IsSafe(method)) + var cmd = ma as Command; + if (text.Split('.')[1] == cmd.name) { - - var attr = method.GetCustomAttribute(); - - if (attr != null) + if (KernelWatchdog.IsSafe(method)) { - string newcommand = attr.newcommand; - if (attr.warn) + if (KernelWatchdog.CanRunOffline(method)) { - Console.WriteLine(Localization.Parse((newcommand == "" ? "{ERROR}" : "{WARN}") + attr.reason, new Dictionary() { + var attr = method.GetCustomAttribute(); + + if (attr != null) + { + string newcommand = attr.newcommand; + if (attr.warn) + { + Console.WriteLine(Localization.Parse((newcommand == "" ? "{ERROR}" : "{WARN}") + attr.reason, new Dictionary() { {"%newcommand", newcommand} })); - } - if (newcommand != "") - { - // redo the entire process running newcommand + } + if (newcommand != "") + { + // redo the entire process running newcommand - return RunClient(newcommand, args); - } - } - - var requiresArgs = method.GetCustomAttributes(); + return RunClient(newcommand, args); + } + } - bool error = false; - bool providedusage = false; + var requiresArgs = method.GetCustomAttributes(); - foreach (RequiresArgument argument in requiresArgs) - { - if (!args.ContainsKey(argument.argument)) - { + bool error = false; + bool providedusage = false; - if (!providedusage) + foreach (RequiresArgument argument in requiresArgs) { - string usageparse = "{COMMAND_" + ns.name.ToUpper() + "_" + cmd.name.ToUpper() + "_USAGE}"; - if (usageparse == Localization.Parse(usageparse)) - usageparse = ""; - else - usageparse = Shiftorium.UpgradeInstalled("help_usage") ? Localization.Parse("{ERROR}{USAGE}" + usageparse, new Dictionary() { + if (!args.ContainsKey(argument.argument)) + { + + if (!providedusage) + { + string usageparse = "{COMMAND_" + ns.name.ToUpper() + "_" + cmd.name.ToUpper() + "_USAGE}"; + if (usageparse == Localization.Parse(usageparse)) + usageparse = ""; + else + usageparse = Shiftorium.UpgradeInstalled("help_usage") ? Localization.Parse("{ERROR}{USAGE}" + usageparse, new Dictionary() { {"%ns", ns.name}, {"%cmd", cmd.name} }) : ""; - Console.WriteLine(usageparse); + Console.WriteLine(usageparse); - providedusage = true; - } + providedusage = true; + } - if (Shiftorium.UpgradeInstalled("help_usage")) - { - Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED}", new Dictionary() { + if (Shiftorium.UpgradeInstalled("help_usage")) + { + Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED}", new Dictionary() { {"%argument", argument.argument} })); + } + else + { + Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED_NO_USAGE}")); + } + + error = true; + } } - else + + if (error) { - Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED_NO_USAGE}")); + throw new Exception("{ERROR_COMMAND_WRONG}"); } - error = true; + try + { + return (bool)method.Invoke(null, new[] { args }); + } + catch (TargetInvocationException e) + { + Console.WriteLine(Localization.Parse("{ERROR_EXCEPTION_THROWN_IN_METHOD}")); + Console.WriteLine(e.InnerException.Message); + Console.WriteLine(e.InnerException.StackTrace); + return true; + } + catch + { + return (bool)method.Invoke(null, new object[] { }); + } } - } - - if (error) - { - throw new Exception("{ERROR_COMMAND_WRONG}"); - } + else + { + Console.Write("<"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; + Console.Write("session_mgr"); + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + ConsoleEx.Bold = false; + Console.Write(">"); + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); + return true; - try - { - return (bool)method.Invoke(null, new[] { args }); + } } - catch (TargetInvocationException e) + else { - Console.WriteLine(Localization.Parse("{ERROR_EXCEPTION_THROWN_IN_METHOD}")); - Console.WriteLine(e.InnerException.Message); - Console.WriteLine(e.InnerException.StackTrace); + Console.Write("<"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; + Console.Write("watchdog"); + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + ConsoleEx.Bold = false; + Console.Write(">"); + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(" You cannot run this command."); + KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); return true; } - catch - { - return (bool)method.Invoke(null, new object[] { }); - } } - else - { - Console.WriteLine(" You cannot run this command."); - KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); - return true; - } - } + } } } + else + { + Console.WriteLine(text + " cannot be ran in a remote session"); + return true; + } } - else - { - Console.WriteLine(text + " cannot be ran in a remote session"); - return true; - } - } + } } + else + { + Console.Write("<"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; + Console.Write("session_mgr"); + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + ConsoleEx.Bold = false; + Console.Write(">"); + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); + return true; + } } else { - Console.WriteLine(" You cannot run this command."); + + Console.Write("<"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; + Console.Write("watchdog"); + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + ConsoleEx.Bold = false; + Console.Write(">"); + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(" You cannot run this command."); KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); return true; } -- cgit v1.2.3 From dad61e325cfcd1ce12ae6f29d3778d1c919c6ab3 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 11 Mar 2017 09:54:44 -0500 Subject: fix the hacker101 story some more --- ShiftOS.WinForms/Applications/TutorialBox.cs | 3 +++ ShiftOS.WinForms/HackerCommands.cs | 24 +++++++++++++++++++++--- ShiftOS_TheReturn/Scripting.cs | 4 ++++ 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'ShiftOS.WinForms/HackerCommands.cs') diff --git a/ShiftOS.WinForms/Applications/TutorialBox.cs b/ShiftOS.WinForms/Applications/TutorialBox.cs index 25921e1..3c74443 100644 --- a/ShiftOS.WinForms/Applications/TutorialBox.cs +++ b/ShiftOS.WinForms/Applications/TutorialBox.cs @@ -21,6 +21,8 @@ namespace ShiftOS.WinForms.Applications InitializeComponent(); IsComplete = false; lbltuttext.Text = ""; + lbltuttext.Padding = new Padding(15); + lbltuttext.Margin = lbltuttext.Padding; } bool stillTyping = false; @@ -47,6 +49,7 @@ namespace ShiftOS.WinForms.Applications })); Thread.Sleep(75); } + Thread.Sleep(5000); stillTyping = false; }).Start(); } diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index f9d3bcc..e2c4d12 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -59,10 +59,25 @@ namespace ShiftOS.WinForms { private static void writeSlow(string text) { - Console.Write("[hacker101@undisclosed]: "); - Thread.Sleep(200); + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + ConsoleEx.Bold = false; + ConsoleEx.Italic = false; + Console.Write("["); + ConsoleEx.ForegroundColor = ConsoleColor.Magenta; + ConsoleEx.Bold = true; + Console.Write("hacker101"); + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + ConsoleEx.Italic = true; + Console.Write("@"); + ConsoleEx.ForegroundColor = ConsoleColor.White; + Console.Write("undisclosed"); + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + ConsoleEx.Bold = false; + ConsoleEx.Italic = false; + Console.Write("]: "); + Thread.Sleep(850); Console.WriteLine(text); - Thread.Sleep(1000); + Thread.Sleep(4000); } [Story("hacker101_deadaccts")] @@ -121,9 +136,12 @@ namespace ShiftOS.WinForms TerminalBackend.PrefixEnabled = true; Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); StartHackerTutorial(); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); }); t.IsBackground = true; t.Start(); + TerminalBackend.PrefixEnabled = false; } internal static void StartHackerTutorial() diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 6768efb..d96bc98 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -69,12 +69,16 @@ namespace ShiftOS.Engine.Scripting { if (msg.Name == "run") { + TerminalBackend.PrefixEnabled = false; var cntnts = JsonConvert.DeserializeObject(msg.Contents); var interp = new LuaInterpreter(); Desktop.InvokeOnWorkerThread(() => { interp.Execute(cntnts.script.ToString()); + }); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); } }; } -- cgit v1.2.3 From 01420ff329ab1819f1be1ea444c46785328b44cb Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 11 Mar 2017 10:28:16 -0500 Subject: fix mud.connect deadlock --- ShiftOS.WinForms/HackerCommands.cs | 3 +- ShiftOS_TheReturn/Commands.cs | 2 ++ ShiftOS_TheReturn/ServerManager.cs | 2 ++ ShiftOS_TheReturn/TerminalBackend.cs | 61 +++++++++++++++++++----------------- 4 files changed, 37 insertions(+), 31 deletions(-) (limited to 'ShiftOS.WinForms/HackerCommands.cs') diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index e2c4d12..107343b 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -158,8 +158,7 @@ namespace ShiftOS.WinForms int tutPos = 0; Action ondec = () => { - if (tutPos == 2) - tutPos++; + tutPos++; }; TerminalBackend.CommandProcessed += (o, a) => { diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 12c371f..7e517c1 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -156,6 +156,8 @@ namespace ShiftOS.Engine { Console.WriteLine("{ERROR}: " + ex.Message); } + + TerminalBackend.PrefixEnabled = false; return true; } catch (Exception ex) diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 4d599cd..31b3129 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -125,6 +125,8 @@ namespace ShiftOS.Engine { thisGuid = new Guid(msg.Contents); GUIDReceived?.Invoke(msg.Contents); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); } else if(msg.Name == "allusers") { diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index c7852f1..e4bad33 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -339,35 +339,38 @@ namespace ShiftOS.Engine public static void PrintPrompt() { - ConsoleEx.BackgroundColor = SkinEngine.LoadedSkin.TerminalBackColorCC; - ConsoleEx.Italic = false; - ConsoleEx.Underline = false; - - ConsoleEx.ForegroundColor = ConsoleColor.Magenta; - ConsoleEx.Bold = true; - - Console.Write(SaveSystem.CurrentSave.Username); - ConsoleEx.Bold = false; - ConsoleEx.ForegroundColor = ConsoleColor.Gray; - Console.Write("@"); - ConsoleEx.Italic = true; - ConsoleEx.Bold = true; - ConsoleEx.ForegroundColor = ConsoleColor.Yellow; - Console.Write(SaveSystem.CurrentSave.SystemName); - ConsoleEx.Italic = false; - ConsoleEx.Bold = false; - ConsoleEx.ForegroundColor = ConsoleColor.Gray; - Console.Write(":~"); - Console.ForegroundColor = ConsoleColor.White; - ConsoleEx.Italic = true; - if (KernelWatchdog.InKernelMode == true) - Console.Write("#"); - else - Console.Write("$"); - ConsoleEx.Italic = false; - ConsoleEx.Bold = false; - ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; - Console.Write(" "); + if (SaveSystem.CurrentSave != null) + { + ConsoleEx.BackgroundColor = SkinEngine.LoadedSkin.TerminalBackColorCC; + ConsoleEx.Italic = false; + ConsoleEx.Underline = false; + + ConsoleEx.ForegroundColor = ConsoleColor.Magenta; + ConsoleEx.Bold = true; + + Console.Write(SaveSystem.CurrentSave.Username); + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = ConsoleColor.Gray; + Console.Write("@"); + ConsoleEx.Italic = true; + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.Yellow; + Console.Write(SaveSystem.CurrentSave.SystemName); + ConsoleEx.Italic = false; + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = ConsoleColor.Gray; + Console.Write(":~"); + Console.ForegroundColor = ConsoleColor.White; + ConsoleEx.Italic = true; + if (KernelWatchdog.InKernelMode == true) + Console.Write("#"); + else + Console.Write("$"); + ConsoleEx.Italic = false; + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + Console.Write(" "); + } } -- cgit v1.2.3