diff --git a/ShiftOS.Frontend/Hacking/HackingCommands.cs b/ShiftOS.Frontend/Hacking/HackingCommands.cs index d07b174..5d51006 100644 --- a/ShiftOS.Frontend/Hacking/HackingCommands.cs +++ b/ShiftOS.Frontend/Hacking/HackingCommands.cs @@ -9,8 +9,19 @@ namespace ShiftOS.Frontend { class HackingCommands { + [Command("sploitset")] + public static void SploitSetEnter(Dictionary args) + { + TerminalBackend.SetShellOverride("sploitset> "); + } + [Command("ftp")] + public static void FTPEnter(Dictionary args) + { + TerminalBackend.SetShellOverride("SimplFTP> "); + } //TODO: Implement firewall cracking [Command("connect")] + [MetaCommand] [RequiresArgument("id")] public static void Connect(Dictionary args) { @@ -25,6 +36,7 @@ namespace ShiftOS.Frontend } [Command("exploit")] + [ShellConstraint("sploitset> ")] [RequiresArgument("id")] [RequiresArgument("port")] public static void Exploit(Dictionary args) @@ -32,6 +44,7 @@ namespace ShiftOS.Frontend if (Hacking.CurrentHackable == null) { Console.WriteLine("[connectlib] not connected"); + return; } string Port = args["port"].ToString(); string ExploitName = args["id"].ToString(); @@ -58,12 +71,14 @@ namespace ShiftOS.Frontend } [Command("inject")] + [ShellConstraint("sploitset> ")] [RequiresArgument("id")] public static void InjectPayload(Dictionary args) { if (Hacking.CurrentHackable == null) { Console.WriteLine("[connectlib] not connected"); + return; } string PayloadName = args["id"].ToString(); var PayloadID = Hacking.AvailablePayloads.FirstOrDefault(x => x.ID == PayloadName); @@ -83,11 +98,13 @@ namespace ShiftOS.Frontend } [Command("listports")] + [ShellConstraint("sploitset> ")] public static void ListPorts(Dictionary args) { if (Hacking.CurrentHackable == null) { Console.WriteLine("[connectlib] not connected"); + return; } foreach (var port in Hacking.CurrentHackable.PortsToUnlock) { @@ -96,6 +113,7 @@ namespace ShiftOS.Frontend } [Command("devicescan")] + [ShellConstraint("sploitset> ")] public static void ScanDevices() { Console.WriteLine("[sploitset] found " + Hacking.AvailableToHack.Length + " devices on the network"); @@ -106,6 +124,7 @@ namespace ShiftOS.Frontend } [Command("exploits")] + [ShellConstraint("sploitset> ")] public static void ScanExploits() { Console.WriteLine("[sploitset] found " + Hacking.AvailableExploits.Length + " exploits installed"); @@ -116,6 +135,7 @@ namespace ShiftOS.Frontend } [Command("payloads")] + [ShellConstraint("sploitset> ")] public static void ListAllPayloads() { Console.WriteLine("[sploitset] found " + Hacking.AvailablePayloads.Length + " payloads"); @@ -126,11 +146,13 @@ namespace ShiftOS.Frontend } [Command("disconnect")] + [MetaCommand] public static void Disconnect(Dictionary args) { if (Hacking.CurrentHackable == null) { Console.WriteLine("[connectlib] not connected"); + return; } if (Hacking.CurrentHackable.PayloadExecuted.Count == 0) { @@ -140,12 +162,20 @@ namespace ShiftOS.Frontend Hacking.FinishHack(); } - [Command("ftp-list")] + [Command("list")] + [ShellConstraint("SimplFTP> ")] public static void ListAllFTP(Dictionary args) { if (Hacking.CurrentHackable == null) { Console.WriteLine("[connectlib] not connected"); + return; + } + var PayloadID = Hacking.CurrentHackable.PayloadExecuted.FirstOrDefault(x => x.EffectiveAgainst.HasFlag(Objects.SystemType.FileServer)); + if (PayloadID == null) + { + Console.WriteLine("[SimplFTP] Not authorised."); + return; } foreach (var loot in Hacking.CurrentHackable.ServerFTPLoot) { @@ -153,13 +183,21 @@ namespace ShiftOS.Frontend } } - [Command("ftp-download")] + [Command("download")] + [ShellConstraint("SimplFTP> ")] [RequiresArgument("file")] public static void DownloadFTP(Dictionary args) { if (Hacking.CurrentHackable == null) { Console.WriteLine("[connectlib] not connected"); + return; + } + var PayloadID = Hacking.CurrentHackable.PayloadExecuted.FirstOrDefault(x => x.EffectiveAgainst.HasFlag(Objects.SystemType.FileServer)); + if (PayloadID == null) + { + Console.WriteLine("[SimplFTP] Not authorised."); + return; } string FindName = args["file"].ToString(); var LootID = Hacking.AvailableLoot.FirstOrDefault(x => x.LootName == FindName);