diff options
| author | william341 <[email protected]> | 2017-07-27 19:36:46 -0700 |
|---|---|---|
| committer | william341 <[email protected]> | 2017-07-27 19:37:00 -0700 |
| commit | f4e39bb9117a692c543ecf17e79ed98c95ffc70e (patch) | |
| tree | ad5f80b83dcd66bfc0c057a9020ea3993159281f /ShiftOS.Frontend | |
| parent | b2e3a661ee6ab3308968efeb275e457776abebc3 (diff) | |
| download | shiftos_thereturn-f4e39bb9117a692c543ecf17e79ed98c95ffc70e.tar.gz shiftos_thereturn-f4e39bb9117a692c543ecf17e79ed98c95ffc70e.tar.bz2 shiftos_thereturn-f4e39bb9117a692c543ecf17e79ed98c95ffc70e.zip | |
hacking works like actually it does kindof
Diffstat (limited to 'ShiftOS.Frontend')
| -rw-r--r-- | ShiftOS.Frontend/Hacking/HackingCommands.cs | 99 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Hacking/PayloadFunc.cs | 24 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Resources/Exploits.txt | 5 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Resources/Hackables.txt | 2 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Resources/Payloads.txt | 6 | ||||
| -rw-r--r-- | ShiftOS.Frontend/ShiftOS.Frontend.csproj | 2 | ||||
| -rw-r--r-- | ShiftOS.Frontend/ShiftOS.cs | 4 |
7 files changed, 139 insertions, 3 deletions
diff --git a/ShiftOS.Frontend/Hacking/HackingCommands.cs b/ShiftOS.Frontend/Hacking/HackingCommands.cs new file mode 100644 index 0000000..fe9ccbc --- /dev/null +++ b/ShiftOS.Frontend/Hacking/HackingCommands.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.Frontend +{ + class HackingCommands + { + //TODO: Implement firewall cracking + [Command("connect")] + [RequiresArgument("id")] + public static void Connect(Dictionary<string, object> args) + { + string id = args["id"].ToString(); + var hackable = Hacking.AvailableToHack.FirstOrDefault(x => x.ID == id); + if (hackable == null) + { + Console.WriteLine("[sploitset] device not found on network."); + return; + } + Hacking.InitHack(hackable); + } + + [Command("exploit")] + [RequiresArgument("exploit")] + [RequiresArgument("port")] + public static void Exploit(Dictionary<string, object> args) + { + if (Hacking.CurrentHackable == null) + { + Console.WriteLine("[sploitset] not connected"); + } + string Port = args["port"].ToString(); + string ExploitName = args["exploit"].ToString(); + var Exploit = Hacking.AvailableExploits.FirstOrDefault(x => x.ID == ExploitName); + if (Exploit == null) + { + Console.WriteLine("[sploitset] invalid exploit."); + return; + } + var ExploitTarget = Hacking.CurrentHackable.PortsToUnlock.FirstOrDefault(x => x.AttachTo == Exploit.EffectiveAgainst); + if (ExploitTarget == null) + { + Console.WriteLine("[sploitset] the connected machine doesn't have that service running."); + return; + } + if (ExploitTarget.Value.ToString() != Port) + { + Console.WriteLine("[sploitset] port not open"); + return; + } + Hacking.CurrentHackable.VectorsUnlocked.Add(ExploitTarget.AttachTo); + Console.WriteLine("[sploitset] exploited service"); + } + + [Command("inject")] + [RequiresArgument("payload")] + public static void InjectPayload(Dictionary<string, object> args) + { + if (Hacking.CurrentHackable == null) + { + Console.WriteLine("[sploitset] not connected"); + } + string PayloadName = args["payload"].ToString(); + var Payload = Hacking.AvailablePayloads.FirstOrDefault(x => x.ID == PayloadName); + if (Payload == null) + { + Console.WriteLine("[sploitset] invalid payload."); + return; + } + if (!Hacking.CurrentHackable.VectorsUnlocked.Contains(Payload.EffectiveAgainst)) + { + Console.WriteLine("[sploitset] the connected machine doesn't have that service exploited."); + return; + } + PayloadFunc.DoHackFunction(Payload.Function); + Hacking.CurrentHackable.PayloadExecuted.Add(Payload); + Console.WriteLine("[sploitset] injected payload"); + } + + [Command("disconnect")] + public static void Disconnect(Dictionary<string, object> args) + { + if (Hacking.CurrentHackable == null) + { + Console.WriteLine("[sploitset] not connected"); + } + if (Hacking.CurrentHackable.PayloadExecuted.Count == 0) + { + Hacking.FailHack(); + return; + } + Hacking.FinishHack(); + } + } +} diff --git a/ShiftOS.Frontend/Hacking/PayloadFunc.cs b/ShiftOS.Frontend/Hacking/PayloadFunc.cs new file mode 100644 index 0000000..5252db4 --- /dev/null +++ b/ShiftOS.Frontend/Hacking/PayloadFunc.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.Frontend +{ + class PayloadFunc + { + public static void DoHackFunction(int function) + { + switch (function) + { + default: + break; + case 1: + Hacking.CurrentHackable.DoConnectionTimeout = false; + break; + } + } + } +} diff --git a/ShiftOS.Frontend/Resources/Exploits.txt b/ShiftOS.Frontend/Resources/Exploits.txt index 45b0250..4ad6caf 100644 --- a/ShiftOS.Frontend/Resources/Exploits.txt +++ b/ShiftOS.Frontend/Resources/Exploits.txt @@ -9,5 +9,10 @@ FriendlyName: "FTP Exploit", ExploitName: "ftpwn", EffectiveAgainstPort: "FileServer", + }, + { + FriendlyName: "SSH Exploit", + ExploitName: "sshardline", + EffectiveAgainstPort: "SSHServer", } ]
\ No newline at end of file diff --git a/ShiftOS.Frontend/Resources/Hackables.txt b/ShiftOS.Frontend/Resources/Hackables.txt index 1c82394..ca09057 100644 --- a/ShiftOS.Frontend/Resources/Hackables.txt +++ b/ShiftOS.Frontend/Resources/Hackables.txt @@ -11,7 +11,7 @@ Password: "h0ldy0urc0l0ur", PasswordHint: "Prepare to hold your colour...", WelcomeMessage: "Don't make fun of SpamSyndicate web design.", - FirewallStrength: 1, + FirewallStrength: 0, LootRarity: 1, LootAmount: 4, ConnectionTimeoutLevel: 4, diff --git a/ShiftOS.Frontend/Resources/Payloads.txt b/ShiftOS.Frontend/Resources/Payloads.txt index 1ce0f43..bb85d74 100644 --- a/ShiftOS.Frontend/Resources/Payloads.txt +++ b/ShiftOS.Frontend/Resources/Payloads.txt @@ -10,5 +10,11 @@ PayloadName: "ftpull", EffectiveAgainstFirewall: 1, EffectiveAgainst: "FileServer", + }, + { + FriendlyName: "Ping Spam", + PayloadName: "keepalive", + EffectiveAgainstFirewall: 1, + EffectiveAgainst: "SSHServer", } ]
\ No newline at end of file diff --git a/ShiftOS.Frontend/ShiftOS.Frontend.csproj b/ShiftOS.Frontend/ShiftOS.Frontend.csproj index eff61a2..8decbc6 100644 --- a/ShiftOS.Frontend/ShiftOS.Frontend.csproj +++ b/ShiftOS.Frontend/ShiftOS.Frontend.csproj @@ -64,8 +64,10 @@ <Compile Include="GUI\ProgressBar.cs" /> <Compile Include="GUI\TextControl.cs" /> <Compile Include="GUI\TextInput.cs" /> + <Compile Include="Hacking\HackingCommands.cs" /> <Compile Include="Hacking\HackableProvider.cs" /> <Compile Include="Hacking\HackerTestCommands.cs" /> + <Compile Include="Hacking\PayloadFunc.cs" /> <Compile Include="Infobox.cs" /> <Compile Include="MainMenu.cs" /> <Compile Include="MonoGameLanguageProvider.cs" /> diff --git a/ShiftOS.Frontend/ShiftOS.cs b/ShiftOS.Frontend/ShiftOS.cs index 88f009a..866f7f5 100644 --- a/ShiftOS.Frontend/ShiftOS.cs +++ b/ShiftOS.Frontend/ShiftOS.cs @@ -295,7 +295,7 @@ namespace ShiftOS.Frontend { if (Hacking.CurrentHackable.DoConnectionTimeout) { - string str = $"Connection TImeout in {(Hacking.CurrentHackable.MillisecondsCountdown / 1000).ToString("#.##")} seconds."; + string str = $"Timeout in {(Hacking.CurrentHackable.MillisecondsCountdown / 1000).ToString("#.##")} seconds."; var gfx = new GraphicsContext(GraphicsDevice, spriteBatch, 0, 0, UIManager.Viewport.Width, UIManager.Viewport.Height); var measure = gfx.MeasureString(str, SkinEngine.LoadedSkin.HeaderFont); gfx.DrawString(str, 5, (gfx.Height - ((int)measure.Y) - 5), Color.Red, SkinEngine.LoadedSkin.HeaderFont); @@ -310,7 +310,7 @@ namespace ShiftOS.Frontend if (fps <= 20) color = Color.Red; gfxContext.DrawString($@"ShiftOS 1.0 Beta 4 -Copyright (c) 2017 Michael VanOverbeek, Rylan Arbour, RogueAI +Copyright (c) 2017 Michael VanOverbeek, Rylan Arbour, RogueAI, william341 This is an unstable build. FPS: {(fps)} An FPS below 20 can cause glitches in keyboard and mouse handling. It is advised that if you are getting these |
