From 2d5b566da493c8669d05df2e8004f7ba6a2d29d5 Mon Sep 17 00:00:00 2001 From: william341 Date: Thu, 27 Jul 2017 17:27:31 -0700 Subject: hacking p2 --- ShiftOS.Frontend/Apps/Network.cs | 12 +++--- ShiftOS.Frontend/Hacking/HackableProvider.cs | 5 +++ ShiftOS.Frontend/Hacking/HackerTestCommands.cs | 45 +++++++++++++++++++++++ ShiftOS.Frontend/Properties/Resources.Designer.cs | 39 +++++++++++++++++++- ShiftOS.Frontend/Properties/Resources.resx | 3 ++ ShiftOS.Frontend/Resources/Exploits.txt | 2 +- ShiftOS.Frontend/Resources/Payloads.txt | 4 +- ShiftOS.Frontend/Resources/Ports.txt | 32 ++++++++++++++++ ShiftOS.Frontend/ShiftOS.Frontend.csproj | 1 + 9 files changed, 133 insertions(+), 10 deletions(-) create mode 100644 ShiftOS.Frontend/Resources/Ports.txt (limited to 'ShiftOS.Frontend') diff --git a/ShiftOS.Frontend/Apps/Network.cs b/ShiftOS.Frontend/Apps/Network.cs index 5cbc385..cd67e6a 100644 --- a/ShiftOS.Frontend/Apps/Network.cs +++ b/ShiftOS.Frontend/Apps/Network.cs @@ -128,7 +128,7 @@ namespace ShiftOS.Frontend.Apps protected override void OnLayout(GameTime gameTime) { - _title.X = 15; + /*_title.X = 15; _title.Y = 15; _subtitle.X = 15; @@ -174,7 +174,7 @@ Loot rarity: {_current.Data.LootRarity} } } - base.OnLayout(gameTime); + base.OnLayout(gameTime);*/ } public class PortView : Control @@ -198,21 +198,21 @@ Loot rarity: {_current.Data.LootRarity} protected override void OnLayout(GameTime gameTime) { - _start.Y = (Height - _start.Height) / 2; + /*_start.Y = (Height - _start.Height) / 2; _start.X = (Width - _start.Width) - 15; unlocked = _port.Locks.Count > 0; - base.OnLayout(gameTime); + base.OnLayout(gameTime);*/ } protected override void OnPaint(GraphicsContext gfx) { - gfx.Clear(LoadedSkin.ControlTextColor.ToMonoColor()); + /*gfx.Clear(LoadedSkin.ControlTextColor.ToMonoColor()); gfx.DrawRectangle(1, 1, Width - 2, Height - 2, LoadedSkin.ControlColor.ToMonoColor()); gfx.DrawString(_port.Name + " (" + _port.Value + ")", 15, 15, LoadedSkin.ControlTextColor.ToMonoColor(), LoadedSkin.Header3Font); string _status = "Tier: " + _port.Tier.ToString(); string lockstatus = (unlocked == true) ? "Unlocked" : $"{_port.Locks.Count} locks"; _status += " - " + lockstatus; - gfx.DrawString(_status, 15, 15 + LoadedSkin.Header3Font.Height + 5, LoadedSkin.ControlTextColor.ToMonoColor(), LoadedSkin.MainFont); + gfx.DrawString(_status, 15, 15 + LoadedSkin.Header3Font.Height + 5, LoadedSkin.ControlTextColor.ToMonoColor(), LoadedSkin.MainFont);*/ } public event Action ConnectionStarted; diff --git a/ShiftOS.Frontend/Hacking/HackableProvider.cs b/ShiftOS.Frontend/Hacking/HackableProvider.cs index 6198b0c..5419030 100644 --- a/ShiftOS.Frontend/Hacking/HackableProvider.cs +++ b/ShiftOS.Frontend/Hacking/HackableProvider.cs @@ -26,6 +26,11 @@ namespace ShiftOS.Frontend return JsonConvert.DeserializeObject(Properties.Resources.Payloads); } + public Port[] GetPorts() + { + return JsonConvert.DeserializeObject(Properties.Resources.Ports); + } + public byte[] GetLootFromResource(string resId) { return new byte[] { 0xDE, 0xAD, 0xBE, 0xEF }; //nyi diff --git a/ShiftOS.Frontend/Hacking/HackerTestCommands.cs b/ShiftOS.Frontend/Hacking/HackerTestCommands.cs index 675356a..a72f267 100644 --- a/ShiftOS.Frontend/Hacking/HackerTestCommands.cs +++ b/ShiftOS.Frontend/Hacking/HackerTestCommands.cs @@ -19,6 +19,33 @@ namespace ShiftOS.Frontend } } + [Command("lsexploits")] + public static void ListAllExploits() + { + foreach (var exploit in Hacking.AvailableExploits) + { + Console.WriteLine(exploit.ID + ": " + exploit.FriendlyName); + } + } + + [Command("lspayloads")] + public static void ListAllPayloads() + { + foreach (var exploit in Hacking.AvailablePayloads) + { + Console.WriteLine(exploit.ID + ": " + exploit.FriendlyName); + } + } + + [Command("lsports")] + public static void ListAllPorts() + { + foreach (var exploit in Hacking.AvailablePorts) + { + Console.WriteLine(exploit.ID + ": " + exploit.FriendlyName); + } + } + [Command("describebackable")] [RequiresArgument("id")] public static void DescribeHackable(Dictionary args) @@ -41,6 +68,24 @@ namespace ShiftOS.Frontend Console.WriteLine(hackable.WelcomeMessage); } + [Command("describeport")] + [RequiresArgument("id")] + public static void DescribePort(Dictionary args) + { + string id = args["id"].ToString(); + var port = Hacking.AvailablePorts.FirstOrDefault(x => x.ID == id); + if (port == null) + { + Console.WriteLine("Port not found."); + return; + } + Console.WriteLine(port.FriendlyName); + Console.WriteLine("------------------------"); + Console.WriteLine(); + Console.WriteLine("Port: " + port.Value.ToString()); + Console.WriteLine("Name: " + port.Name); + } + [Command("inithack")] [RequiresArgument("id")] public static void InitHack(Dictionary args) diff --git a/ShiftOS.Frontend/Properties/Resources.Designer.cs b/ShiftOS.Frontend/Properties/Resources.Designer.cs index 1d451a1..dfc728e 100644 --- a/ShiftOS.Frontend/Properties/Resources.Designer.cs +++ b/ShiftOS.Frontend/Properties/Resources.Designer.cs @@ -153,7 +153,7 @@ namespace ShiftOS.Frontend.Properties { /// FriendlyName: "FTP Payload", /// PayloadName: "ftpull" /// EffectiveAgainstFirewall: 1, - /// EffectiveAgainstPort: "FileServer", + /// EffectiveAgainst: "FileServer", /// } ///]. /// @@ -163,6 +163,43 @@ namespace ShiftOS.Frontend.Properties { } } + /// + /// Looks up a localized string similar to /* ShiftOS Ports data file + /// * + /// * This file contains information about all ports in the game's campaign. + /// * + /// */ + /// + ///[ + /// { + /// FriendlyName: "SMTP mailserver (unencrypted)", + /// AttachTo: "EmailServer" + /// Value: 25, + /// Name: "smtp", + /// }, + /// { + /// FriendlyName: "File Transfer Protocol", + /// AttachTo: "FileServer" + /// Value: 21, + /// Name: "ftp", + /// }, + /// { + /// FriendlyName: "ShiftSSH server", + /// AttachTo: "SSHServer" + /// Value: 22, + /// Name: "ssh", + /// }, + /// { + /// FriendlyName: "MySQL server", + /// AttachTo: "Database" + /// Val [rest of string was truncated]";. + /// + public static string Ports { + get { + return ResourceManager.GetString("Ports", resourceCulture); + } + } + /// /// Looks up a localized string similar to []. /// diff --git a/ShiftOS.Frontend/Properties/Resources.resx b/ShiftOS.Frontend/Properties/Resources.resx index 80ed513..0b514f7 100644 --- a/ShiftOS.Frontend/Properties/Resources.resx +++ b/ShiftOS.Frontend/Properties/Resources.resx @@ -148,4 +148,7 @@ ..\resources\payloads.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + ..\resources\ports.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + \ No newline at end of file diff --git a/ShiftOS.Frontend/Resources/Exploits.txt b/ShiftOS.Frontend/Resources/Exploits.txt index 0e0dd64..45b0250 100644 --- a/ShiftOS.Frontend/Resources/Exploits.txt +++ b/ShiftOS.Frontend/Resources/Exploits.txt @@ -7,7 +7,7 @@ [ { FriendlyName: "FTP Exploit", - ExploitName: "ftpwn" + ExploitName: "ftpwn", EffectiveAgainstPort: "FileServer", } ] \ No newline at end of file diff --git a/ShiftOS.Frontend/Resources/Payloads.txt b/ShiftOS.Frontend/Resources/Payloads.txt index 1c7ff2d..1ce0f43 100644 --- a/ShiftOS.Frontend/Resources/Payloads.txt +++ b/ShiftOS.Frontend/Resources/Payloads.txt @@ -7,8 +7,8 @@ [ { FriendlyName: "FTP Payload", - PayloadName: "ftpull" + PayloadName: "ftpull", EffectiveAgainstFirewall: 1, - EffectiveAgainstPort: "FileServer", + EffectiveAgainst: "FileServer", } ] \ No newline at end of file diff --git a/ShiftOS.Frontend/Resources/Ports.txt b/ShiftOS.Frontend/Resources/Ports.txt new file mode 100644 index 0000000..4813496 --- /dev/null +++ b/ShiftOS.Frontend/Resources/Ports.txt @@ -0,0 +1,32 @@ +/* ShiftOS Ports data file + * + * This file contains information about all ports in the game's campaign. + * + */ + +[ + { + FriendlyName: "SMTP mailserver (unencrypted)", + AttachTo: "EmailServer", + Value: 25, + Name: "smtp", + }, + { + FriendlyName: "File Transfer Protocol", + AttachTo: "FileServer", + Value: 21, + Name: "ftp", + }, + { + FriendlyName: "ShiftSSH server", + AttachTo: "SSHServer", + Value: 22, + Name: "ssh", + }, + { + FriendlyName: "MySQL server", + AttachTo: "Database", + Value: 3306, + Name: "sql", + } +] \ No newline at end of file diff --git a/ShiftOS.Frontend/ShiftOS.Frontend.csproj b/ShiftOS.Frontend/ShiftOS.Frontend.csproj index 5f3d18a..eff61a2 100644 --- a/ShiftOS.Frontend/ShiftOS.Frontend.csproj +++ b/ShiftOS.Frontend/ShiftOS.Frontend.csproj @@ -190,6 +190,7 @@ + -- cgit v1.2.3