hacking p1

This commit is contained in:
william341 2017-07-27 16:34:27 -07:00
parent 86dde20529
commit 18079c6f43
16 changed files with 161 additions and 13 deletions

View file

@ -16,6 +16,16 @@ namespace ShiftOS.Frontend
return JsonConvert.DeserializeObject<Hackable[]>(Properties.Resources.Hackables);
}
public Exploit[] GetExploits()
{
return JsonConvert.DeserializeObject<Exploit[]>(Properties.Resources.Exploits);
}
public Payload[] GetPayloads()
{
return JsonConvert.DeserializeObject<Payload[]>(Properties.Resources.Payloads);
}
public byte[] GetLootFromResource(string resId)
{
return new byte[] { 0xDE, 0xAD, 0xBE, 0xEF }; //nyi

View file

@ -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.
/// </summary>
[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.
/// </summary>
[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 {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
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));
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
public static string Exploits {
get {
return ResourceManager.GetString("Exploits", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to /* ShiftOS hackables data file
/// *
@ -93,7 +102,7 @@ namespace ShiftOS.Frontend.Properties {
/// }
///].
/// </summary>
internal static string Hackables {
public static string Hackables {
get {
return ResourceManager.GetString("Hackables", resourceCulture);
}
@ -102,7 +111,7 @@ namespace ShiftOS.Frontend.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
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 {
///
///[].
/// </summary>
internal static string LootInfo {
public static string LootInfo {
get {
return ResourceManager.GetString("LootInfo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to /* ShiftOS Payloads data file
/// *
/// * This file contains information about all payloads in the game&apos;s campaign.
/// *
/// */
///
///[
/// {
/// FriendlyName: &quot;FTP Exploit&quot;,
/// PayloadName: &quot;ftpull&quot;
/// EffectiveAgainstFirewall: 1,
/// EffectiveAgainstPort: &quot;FileServer&quot;,
/// }
///].
/// </summary>
public static string Payloads {
get {
return ResourceManager.GetString("Payloads", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to [].
/// </summary>
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]&quot;;.
/// </summary>
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 {
/// &quot;{GEN_PASSWORD}&quot;: &quot;Password&quot;,
/// &quot;{GEN_LPROMPT [rest of string was truncated]&quot;;.
/// </summary>
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 {
/// &quot;{GEN_SYSTEMNAME}&quot;: &quot;Nom de système&quot;,
/// &quot;{GEN_PASSWORD}&quot;: &quot;Mot de [rest of string was truncated]&quot;;.
/// </summary>
internal static string strings_fr {
public static string strings_fr {
get {
return ResourceManager.GetString("strings_fr", resourceCulture);
}

View file

@ -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",
}
]

View file

@ -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",
}
]

View file

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShiftOS.Objects
{
public class Exploit
{
public string FriendlyName { get; set; }
public string ExploitName { get; set; }
public SystemType EffectiveAgainst { get; set; }
public string Dependencies { get; set; }
public string ID
{
get
{
return ExploitName.ToLower().Replace(" ", "_");
}
}
public override string ToString()
{
return $"{FriendlyName} ({ExploitName})";
}
}
}

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShiftOS.Objects
{
public class Payload
{
public string FriendlyName { get; set; }
public string PayloadName { get; set; }
public int EffectiveAgainstFirewall { get; set; }
public SystemType EffectiveAgainstPort { get; set; }
public string Dependencies { get; set; }
public string ID
{
get
{
return PayloadName.ToLower().Replace(" ", "_");
}
}
public override string ToString()
{
return $"{FriendlyName} ({PayloadName})";
}
}
}

View file

@ -10,6 +10,8 @@ namespace ShiftOS.Engine
{
private static List<HackableSystem> _activeConnections = new List<HackableSystem>();
private static List<Objects.Hackable> Hackables = new List<Objects.Hackable>();
private static List<Objects.Exploit> Exploits = new List<Objects.Exploit>();
private static List<Objects.Payload> Payloads = new List<Objects.Payload>();
private static List<Objects.Loot> Loot = new List<Objects.Loot>();
public static HackableSystem CurrentHackable { get; private set; }
@ -22,6 +24,21 @@ namespace ShiftOS.Engine
}
}
public static Objects.Exploit[] AvailableExploits
{
get
{
return Exploits.Where(x => Shiftorium.UpgradeInstalled(x.Dependencies) && !Shiftorium.UpgradeInstalled(x.ID)).ToArray();
}
}
public static Objects.Payload[] AvailablePayloads
{
get
{
return Payloads.Where(x => Shiftorium.UpgradeInstalled(x.Dependencies) && !Shiftorium.UpgradeInstalled(x.ID)).ToArray();
}
}
public static HackableSystem[] ActiveConnections
{
@ -178,10 +195,10 @@ namespace ShiftOS.Engine
public class NaughtyDeveloperException : Exception
{
/// <summary>
/// Create a new instance of the <see cref="NaughtyDeveloperException"/>, with the specified message, which will cause Visual Studio to call the person who caused the exception a scrotem.
/// Create a new instance of the <see cref="NaughtyDeveloperException"/>, with the specified message, which will cause Visual Studio to call the person who caused the exception a scrotum.
/// </summary>
/// <param name="message">The message you want to yell at the user.</param>
public NaughtyDeveloperException(string message) : base(message + " - FIX IT, YOU SCROTEM")
public NaughtyDeveloperException(string message) : base(message + " - FIX IT, YOU SCROTUM")
{
}
@ -198,6 +215,8 @@ namespace ShiftOS.Engine
public interface IHackableProvider
{
Objects.Hackable[] GetHackables();
Objects.Exploit[] GetExploits();
Objects.Payload[] GetPayloads();
Objects.LootInfo[] GetLootInfo();
byte[] GetLootFromResource(string resId);
}