From 18079c6f43981f1bf9fc093b3c5b68873fe90348 Mon Sep 17 00:00:00 2001 From: william341 Date: Thu, 27 Jul 2017 16:34:27 -0700 Subject: hacking p1 --- ShiftOS.Frontend/HackableProvider.cs | 29 ----------- ShiftOS.Frontend/HackerTestCommands.cs | 59 ----------------------- ShiftOS.Frontend/Hacking/HackableProvider.cs | 39 +++++++++++++++ ShiftOS.Frontend/Hacking/HackerTestCommands.cs | 59 +++++++++++++++++++++++ ShiftOS.Frontend/Properties/Resources.Designer.cs | 53 +++++++++++++++----- ShiftOS.Frontend/Resources/Exploits.txt | 13 +++++ ShiftOS.Frontend/Resources/Payloads.txt | 14 ++++++ 7 files changed, 167 insertions(+), 99 deletions(-) delete mode 100644 ShiftOS.Frontend/HackableProvider.cs delete mode 100644 ShiftOS.Frontend/HackerTestCommands.cs create mode 100644 ShiftOS.Frontend/Hacking/HackableProvider.cs create mode 100644 ShiftOS.Frontend/Hacking/HackerTestCommands.cs create mode 100644 ShiftOS.Frontend/Resources/Exploits.txt create mode 100644 ShiftOS.Frontend/Resources/Payloads.txt (limited to 'ShiftOS.Frontend') diff --git a/ShiftOS.Frontend/HackableProvider.cs b/ShiftOS.Frontend/HackableProvider.cs deleted file mode 100644 index 1c57f37..0000000 --- a/ShiftOS.Frontend/HackableProvider.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ShiftOS.Objects; -using ShiftOS.Engine; -using Newtonsoft.Json; - -namespace ShiftOS.Frontend -{ - public class HackableProvider : IHackableProvider - { - public Hackable[] GetHackables() - { - return JsonConvert.DeserializeObject(Properties.Resources.Hackables); - } - - public byte[] GetLootFromResource(string resId) - { - return new byte[] { 0xDE, 0xAD, 0xBE, 0xEF }; //nyi - } - - public LootInfo[] GetLootInfo() - { - return JsonConvert.DeserializeObject(Properties.Resources.LootInfo); - } - } -} diff --git a/ShiftOS.Frontend/HackerTestCommands.cs b/ShiftOS.Frontend/HackerTestCommands.cs deleted file mode 100644 index 675356a..0000000 --- a/ShiftOS.Frontend/HackerTestCommands.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ShiftOS.Engine; - -#if DEBUG -namespace ShiftOS.Frontend -{ - public static class HackerTestCommands - { - [Command("lshackables")] - public static void ListAllHackables() - { - foreach(var hackable in Hacking.AvailableToHack) - { - Console.WriteLine(hackable.ID + ": " + hackable.FriendlyName); - } - } - - [Command("describebackable")] - [RequiresArgument("id")] - public static void DescribeHackable(Dictionary args) - { - string id = args["id"].ToString(); - var hackable = Hacking.AvailableToHack.FirstOrDefault(x => x.ID == id); - if(hackable == null) - { - Console.WriteLine("Hackable not found."); - return; - } - Console.WriteLine(hackable.FriendlyName); - Console.WriteLine("------------------------"); - Console.WriteLine(); - Console.WriteLine("System name: " + hackable.SystemName); - Console.WriteLine("Loot rarity: " + hackable.LootRarity); - Console.WriteLine("Loot amount: " + hackable.LootAmount); - Console.WriteLine("Connection timeout level: " + hackable.ConnectionTimeoutLevel); - Console.WriteLine(); - Console.WriteLine(hackable.WelcomeMessage); - } - - [Command("inithack")] - [RequiresArgument("id")] - public static void InitHack(Dictionary args) - { - string id = args["id"].ToString(); - var hackable = Hacking.AvailableToHack.FirstOrDefault(x => x.ID == id); - if (hackable == null) - { - Console.WriteLine("Hackable not found."); - return; - } - Hacking.InitHack(hackable); - } - } -} -#endif \ No newline at end of file diff --git a/ShiftOS.Frontend/Hacking/HackableProvider.cs b/ShiftOS.Frontend/Hacking/HackableProvider.cs new file mode 100644 index 0000000..6198b0c --- /dev/null +++ b/ShiftOS.Frontend/Hacking/HackableProvider.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Objects; +using ShiftOS.Engine; +using Newtonsoft.Json; + +namespace ShiftOS.Frontend +{ + public class HackableProvider : IHackableProvider + { + public Hackable[] GetHackables() + { + return JsonConvert.DeserializeObject(Properties.Resources.Hackables); + } + + public Exploit[] GetExploits() + { + return JsonConvert.DeserializeObject(Properties.Resources.Exploits); + } + + public Payload[] GetPayloads() + { + return JsonConvert.DeserializeObject(Properties.Resources.Payloads); + } + + public byte[] GetLootFromResource(string resId) + { + return new byte[] { 0xDE, 0xAD, 0xBE, 0xEF }; //nyi + } + + public LootInfo[] GetLootInfo() + { + return JsonConvert.DeserializeObject(Properties.Resources.LootInfo); + } + } +} diff --git a/ShiftOS.Frontend/Hacking/HackerTestCommands.cs b/ShiftOS.Frontend/Hacking/HackerTestCommands.cs new file mode 100644 index 0000000..675356a --- /dev/null +++ b/ShiftOS.Frontend/Hacking/HackerTestCommands.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +#if DEBUG +namespace ShiftOS.Frontend +{ + public static class HackerTestCommands + { + [Command("lshackables")] + public static void ListAllHackables() + { + foreach(var hackable in Hacking.AvailableToHack) + { + Console.WriteLine(hackable.ID + ": " + hackable.FriendlyName); + } + } + + [Command("describebackable")] + [RequiresArgument("id")] + public static void DescribeHackable(Dictionary args) + { + string id = args["id"].ToString(); + var hackable = Hacking.AvailableToHack.FirstOrDefault(x => x.ID == id); + if(hackable == null) + { + Console.WriteLine("Hackable not found."); + return; + } + Console.WriteLine(hackable.FriendlyName); + Console.WriteLine("------------------------"); + Console.WriteLine(); + Console.WriteLine("System name: " + hackable.SystemName); + Console.WriteLine("Loot rarity: " + hackable.LootRarity); + Console.WriteLine("Loot amount: " + hackable.LootAmount); + Console.WriteLine("Connection timeout level: " + hackable.ConnectionTimeoutLevel); + Console.WriteLine(); + Console.WriteLine(hackable.WelcomeMessage); + } + + [Command("inithack")] + [RequiresArgument("id")] + public static void InitHack(Dictionary args) + { + string id = args["id"].ToString(); + var hackable = Hacking.AvailableToHack.FirstOrDefault(x => x.ID == id); + if (hackable == null) + { + Console.WriteLine("Hackable not found."); + return; + } + Hacking.InitHack(hackable); + } + } +} +#endif \ No newline at end of file diff --git a/ShiftOS.Frontend/Properties/Resources.Designer.cs b/ShiftOS.Frontend/Properties/Resources.Designer.cs index 3d40c29..e21b46e 100644 --- a/ShiftOS.Frontend/Properties/Resources.Designer.cs +++ b/ShiftOS.Frontend/Properties/Resources.Designer.cs @@ -22,7 +22,7 @@ namespace ShiftOS.Frontend.Properties { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { + public class Resources { private static global::System.Resources.ResourceManager resourceMan; @@ -36,7 +36,7 @@ namespace ShiftOS.Frontend.Properties { /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShiftOS.Frontend.Properties.Resources", typeof(Resources).Assembly); @@ -51,7 +51,7 @@ namespace ShiftOS.Frontend.Properties { /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -63,13 +63,22 @@ namespace ShiftOS.Frontend.Properties { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap cursor_9x_pointer { + public static System.Drawing.Bitmap cursor_9x_pointer { get { object obj = ResourceManager.GetObject("cursor_9x_pointer", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } + /// + /// Looks up a localized string similar to . + /// + public static string Exploits { + get { + return ResourceManager.GetString("Exploits", resourceCulture); + } + } + /// /// Looks up a localized string similar to /* ShiftOS hackables data file /// * @@ -93,7 +102,7 @@ namespace ShiftOS.Frontend.Properties { /// } ///]. /// - internal static string Hackables { + public static string Hackables { get { return ResourceManager.GetString("Hackables", resourceCulture); } @@ -102,7 +111,7 @@ namespace ShiftOS.Frontend.Properties { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap justthes { + public static System.Drawing.Bitmap justthes { get { object obj = ResourceManager.GetObject("justthes", resourceCulture); return ((System.Drawing.Bitmap)(obj)); @@ -114,16 +123,38 @@ namespace ShiftOS.Frontend.Properties { /// ///[]. /// - internal static string LootInfo { + public static string LootInfo { get { return ResourceManager.GetString("LootInfo", resourceCulture); } } + /// + /// Looks up a localized string similar to /* ShiftOS Payloads data file + /// * + /// * This file contains information about all payloads in the game's campaign. + /// * + /// */ + /// + ///[ + /// { + /// FriendlyName: "FTP Exploit", + /// PayloadName: "ftpull" + /// EffectiveAgainstFirewall: 1, + /// EffectiveAgainstPort: "FileServer", + /// } + ///]. + /// + public static string Payloads { + get { + return ResourceManager.GetString("Payloads", resourceCulture); + } + } + /// /// Looks up a localized string similar to []. /// - internal static string Shiftorium { + public static string Shiftorium { get { return ResourceManager.GetString("Shiftorium", resourceCulture); } @@ -140,7 +171,7 @@ namespace ShiftOS.Frontend.Properties { /// ///Commands können mit argumenten versehen werden, indem du ein key-value Paar in einem {} Block hinter dem command angibst. Zum Be [rest of string was truncated]";. /// - internal static string strings_de { + public static string strings_de { get { return ResourceManager.GetString("strings_de", resourceCulture); } @@ -165,7 +196,7 @@ namespace ShiftOS.Frontend.Properties { /// "{GEN_PASSWORD}": "Password", /// "{GEN_LPROMPT [rest of string was truncated]";. /// - internal static string strings_en { + public static string strings_en { get { return ResourceManager.GetString("strings_en", resourceCulture); } @@ -189,7 +220,7 @@ namespace ShiftOS.Frontend.Properties { /// "{GEN_SYSTEMNAME}": "Nom de système", /// "{GEN_PASSWORD}": "Mot de [rest of string was truncated]";. /// - internal static string strings_fr { + public static string strings_fr { get { return ResourceManager.GetString("strings_fr", resourceCulture); } diff --git a/ShiftOS.Frontend/Resources/Exploits.txt b/ShiftOS.Frontend/Resources/Exploits.txt new file mode 100644 index 0000000..0e0dd64 --- /dev/null +++ b/ShiftOS.Frontend/Resources/Exploits.txt @@ -0,0 +1,13 @@ +/* ShiftOS Exploits data file + * + * This file contains information about all exploits in the game's campaign. + * + */ + +[ + { + FriendlyName: "FTP Exploit", + ExploitName: "ftpwn" + EffectiveAgainstPort: "FileServer", + } +] \ No newline at end of file diff --git a/ShiftOS.Frontend/Resources/Payloads.txt b/ShiftOS.Frontend/Resources/Payloads.txt new file mode 100644 index 0000000..926a23f --- /dev/null +++ b/ShiftOS.Frontend/Resources/Payloads.txt @@ -0,0 +1,14 @@ +/* ShiftOS Payloads data file + * + * This file contains information about all payloads in the game's campaign. + * + */ + +[ + { + FriendlyName: "FTP Exploit", + PayloadName: "ftpull" + EffectiveAgainstFirewall: 1, + EffectiveAgainstPort: "FileServer", + } +] \ No newline at end of file -- cgit v1.2.3