aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-08-02 10:23:13 -0400
committerMichael <[email protected]>2017-08-02 10:23:13 -0400
commit37cf129165916101ba665891d157c85ea9c37383 (patch)
treebc184d6be19bdf1258faba51a1323bfeec676502 /ShiftOS.Frontend
parent10d2c0bbaa2b5c933a37056c784d3de84fa82eaf (diff)
downloadshiftos_thereturn-37cf129165916101ba665891d157c85ea9c37383.tar.gz
shiftos_thereturn-37cf129165916101ba665891d157c85ea9c37383.tar.bz2
shiftos_thereturn-37cf129165916101ba665891d157c85ea9c37383.zip
The first loot!
Diffstat (limited to 'ShiftOS.Frontend')
-rw-r--r--ShiftOS.Frontend/Apps/FileSkimmer.cs6
-rw-r--r--ShiftOS.Frontend/Apps/Installer.cs131
-rw-r--r--ShiftOS.Frontend/Desktop/WindowManager.cs7
-rw-r--r--ShiftOS.Frontend/Hacking/HackableProvider.cs2
-rw-r--r--ShiftOS.Frontend/Hacking/HackerTestCommands.cs16
-rw-r--r--ShiftOS.Frontend/Properties/Resources.Designer.cs31
-rw-r--r--ShiftOS.Frontend/Properties/Resources.resx3
-rw-r--r--ShiftOS.Frontend/Resources/LootInfo.txt6
-rw-r--r--ShiftOS.Frontend/Resources/sploitset_keepalive.txt12
-rw-r--r--ShiftOS.Frontend/ShiftOS.Frontend.csproj2
10 files changed, 205 insertions, 11 deletions
diff --git a/ShiftOS.Frontend/Apps/FileSkimmer.cs b/ShiftOS.Frontend/Apps/FileSkimmer.cs
index 58a9908..672446c 100644
--- a/ShiftOS.Frontend/Apps/FileSkimmer.cs
+++ b/ShiftOS.Frontend/Apps/FileSkimmer.cs
@@ -21,11 +21,12 @@ namespace ShiftOS.Frontend.Apps
public void OnLoad()
{
- if(Hacking.CurrentHackable != null)
+
+ if (Hacking.CurrentHackable != null)
{
if (Hacking.CurrentHackable.VectorsUnlocked.Contains(Objects.SystemType.FileServer))
{
- if(Mounts.Count > 2)
+ if (Mounts.Count > 2)
{
Mounts.RemoveAt(2);
}
@@ -37,6 +38,7 @@ namespace ShiftOS.Frontend.Apps
if(!FileExists("2:/" + loot.LootName))
{
var bytes = Hacking.GetLootBytes(loot.PointTo);
+ WriteAllBytes($"2:/{loot.LootName}", bytes);
}
}
}
diff --git a/ShiftOS.Frontend/Apps/Installer.cs b/ShiftOS.Frontend/Apps/Installer.cs
new file mode 100644
index 0000000..86045e1
--- /dev/null
+++ b/ShiftOS.Frontend/Apps/Installer.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ShiftOS.Engine;
+using ShiftOS.Frontend.GUI;
+using Newtonsoft.Json;
+using static ShiftOS.Objects.ShiftFS.Utils;
+using Microsoft.Xna.Framework;
+
+namespace ShiftOS.Frontend.Apps
+{
+ [DefaultTitle("Installer")]
+ [FileHandler("Setup file", ".stp", "")]
+ public class Installer : Control, IShiftOSWindow, IFileHandler
+ {
+ private SetupFile _setup = null;
+ private TextControl _header = null;
+ private TextControl _body = null;
+ private Button _cancel = null;
+ private Button _install = null;
+
+ public Installer()
+ {
+ Width = 600;
+ Height = 400;
+ _header = new GUI.TextControl();
+ _body = new GUI.TextControl();
+ _cancel = new Button();
+ _install = new Button();
+
+ _install.Text = "Install";
+ _cancel.Text = "Close";
+
+ _install.AutoSize = true;
+ _cancel.AutoSize = true;
+
+ AddControl(_header);
+ AddControl(_body);
+ AddControl(_install);
+ AddControl(_cancel);
+
+ _install.Click += () =>
+ {
+ Install();
+
+ };
+ _cancel.Click += () =>
+ {
+ AppearanceManager.Close(this);
+ };
+
+ }
+
+ public void Install()
+ {
+ switch (_setup.SourceType)
+ {
+ case SetupSource.ShiftoriumUpgrade:
+ if (Shiftorium.UpgradeInstalled(_setup.Source))
+ {
+ Engine.Infobox.Show("Upgrade installed.", "This upgrade has already been installed either through the Shiftorium or through another setup file.");
+ return;
+ }
+ Shiftorium.Buy(_setup.Source, 0);
+ Engine.Infobox.Show("Upgrade installed.", "The upgrade \"" + _setup.Source + "\" has been installed and is now ready to be used!");
+
+ break;
+ }
+ }
+
+
+ protected override void OnLayout(GameTime gameTime)
+ {
+ _header.X = 10;
+ _header.Y = 10;
+ _header.Font = SkinEngine.LoadedSkin.Header3Font;
+ _header.AutoSize = true;
+
+ _body.X = 10;
+ _body.Y = _header.Y + _header.Height + 5;
+ _body.Width = Width - 20;
+
+ _cancel.X = Width - _cancel.Width - 10;
+ _cancel.Y = Height - _cancel.Height - 10;
+ _body.Height = (_cancel.Y - _body.Y);
+ _install.Y = _cancel.Y;
+ _install.X = _cancel.X - _install.Width - 5;
+ }
+
+
+ public void OpenFile(string file)
+ {
+ _setup = JsonConvert.DeserializeObject<SetupFile>(ReadAllText(file));
+ AppearanceManager.SetupDialog(this);
+ }
+
+ public void OnLoad()
+ {
+ _header.Text = _setup.Name;
+ _body.Text = _setup.Description;
+ }
+
+ public void OnSkinLoad()
+ {
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+ }
+
+ public class SetupFile
+ {
+ public string Name { get; set; }
+ public string Description { get; set; }
+ public SetupSource SourceType { get; set; }
+ public string Source { get; set; }
+ }
+
+ public enum SetupSource
+ {
+ ShiftoriumUpgrade
+ }
+}
diff --git a/ShiftOS.Frontend/Desktop/WindowManager.cs b/ShiftOS.Frontend/Desktop/WindowManager.cs
index fbd42f4..23769bf 100644
--- a/ShiftOS.Frontend/Desktop/WindowManager.cs
+++ b/ShiftOS.Frontend/Desktop/WindowManager.cs
@@ -78,12 +78,19 @@ namespace ShiftOS.Frontend.Desktop
public override void SetupDialog(IShiftOSWindow win)
{
var wb = new WindowBorder();
+ var ctl = win as GUI.Control;
+ if (ctl.Width < 30)
+ ctl.Width = 30;
+ if (ctl.Height < 30)
+ ctl.Height = 30;
wb.Width = (win as GUI.Control).Width + LoadedSkin.LeftBorderWidth + LoadedSkin.RightBorderWidth;
wb.Height = (win as GUI.Control).Height + LoadedSkin.TitlebarHeight + LoadedSkin.BottomBorderWidth;
wb.ParentWindow = win;
wb.IsDialog = true;
UIManager.AddTopLevel(wb);
RunningBorders.Add(wb);
+ wb.X = (UIManager.Viewport.Width - wb.Width) / 2;
+ wb.Y = (UIManager.Viewport.Height - wb.Height) / 2;
win.OnLoad();
win.OnUpgrade();
win.OnSkinLoad();
diff --git a/ShiftOS.Frontend/Hacking/HackableProvider.cs b/ShiftOS.Frontend/Hacking/HackableProvider.cs
index 83409c5..d661147 100644
--- a/ShiftOS.Frontend/Hacking/HackableProvider.cs
+++ b/ShiftOS.Frontend/Hacking/HackableProvider.cs
@@ -13,7 +13,7 @@ namespace ShiftOS.Frontend
{
public byte[] FindLootBytes(string id)
{
- foreach(var res in typeof(Properties.Resources).GetProperties(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static))
+ foreach(var res in typeof(Properties.Resources).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
{
if(res.Name == id)
{
diff --git a/ShiftOS.Frontend/Hacking/HackerTestCommands.cs b/ShiftOS.Frontend/Hacking/HackerTestCommands.cs
index 72c648e..77bb378 100644
--- a/ShiftOS.Frontend/Hacking/HackerTestCommands.cs
+++ b/ShiftOS.Frontend/Hacking/HackerTestCommands.cs
@@ -11,6 +11,22 @@ namespace ShiftOS.Frontend
public static class HackerTestCommands
{
[ShellConstraint("shiftos_debug> ")]
+ [Command("loot")]
+ [RequiresArgument("id")]
+ public static void ViewLoot(Dictionary<string, object> args)
+ {
+ string id = args["id"].ToString();
+ var loot = Hacking.AvailableLoot.FirstOrDefault(x => x.ID == id);
+ if(loot == null)
+ {
+ Console.WriteLine("Loot ID not found.");
+ return;
+ }
+ Objects.ShiftFS.Utils.WriteAllBytes("0:/" + loot.LootName, Hacking.GetLootBytes(loot.ID));
+ FileSkimmerBackend.OpenFile("0:/" + loot.LootName);
+ }
+
+ [ShellConstraint("shiftos_debug> ")]
[Command("lsports")]
public static void ListAllPorts()
{
diff --git a/ShiftOS.Frontend/Properties/Resources.Designer.cs b/ShiftOS.Frontend/Properties/Resources.Designer.cs
index 05b50c6..a9086e6 100644
--- a/ShiftOS.Frontend/Properties/Resources.Designer.cs
+++ b/ShiftOS.Frontend/Properties/Resources.Designer.cs
@@ -81,13 +81,13 @@ namespace ShiftOS.Frontend.Properties {
/// {
/// FriendlyName: &quot;FTP Exploit&quot;,
/// ExploitName: &quot;ftpwn&quot;,
- /// EffectiveAgainstPort: &quot;FileServer&quot;
+ /// EffectiveAgainstPort: &quot;FileServer&quot;,
/// },
/// {
/// FriendlyName: &quot;SSH Exploit&quot;,
/// ExploitName: &quot;sshardline&quot;,
/// EffectiveAgainstPort: &quot;SSHServer&quot;,
- /// Dependencies: &quot;sploitset_sshardline&quot;
+ /// Dependencies: &quot;sploitset_sshardline&quot;,
/// }
///].
/// </summary>
@@ -176,7 +176,7 @@ namespace ShiftOS.Frontend.Properties {
/// FriendlyName: &quot;FTP Payload&quot;,
/// PayloadName: &quot;ftpull&quot;,
/// EffectiveAgainstFirewall: 1,
- /// EffectiveAgainst: &quot;FileServer&quot;
+ /// EffectiveAgainst: &quot;FileServer&quot;,
/// },
/// {
/// FriendlyName: &quot;Force Heartbeat&quot;,
@@ -184,7 +184,7 @@ namespace ShiftOS.Frontend.Properties {
/// EffectiveAgainstFirewall: 1,
/// EffectiveAgainst: &quot;SSHServer&quot;,
/// Function: 1,
- /// Dependencies: &quot;sploitset_keepalive&quot;
+ /// Dependencies: &quot;sploitset_keepalive&quot;,
/// }
///].
/// </summary>
@@ -233,13 +233,13 @@ namespace ShiftOS.Frontend.Properties {
/// <summary>
/// Looks up a localized string similar to [
- /// }
+ /// {
/// Name: &quot;sploitset_keepalive&quot;,
/// Cost: 1000000000,
/// Description: &quot;lolyouarentsupposedtobeabletobuythis&quot;,
/// Dependencies: &quot;thisupgradeshouldneverexistever;sploitset_sshardline&quot;,
/// },
- /// }
+ /// {
/// Name: &quot;sploitset_sshardline&quot;,
/// Cost: 1000000000,
/// Description: &quot;lolyouarentsupposedtobeabletobuythis&quot;,
@@ -254,6 +254,25 @@ namespace ShiftOS.Frontend.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to /* ShiftOS setup data file
+ /// *
+ /// * This file holds information used by a ShiftOS &quot;Installer&quot; for setting up a system component.
+ /// *
+ /// */
+ ///
+ /// {
+ /// Name: &quot;Sploitset Force Heartbeat exploit&quot;,
+ /// Description: &quot;This is an exploit for the sploitset system exploitation utility which causes the remote system to force the connection to stay alive by sending heartbeat requests even after the firewall has timed out the connection. Useful against those pesky connection timers...&quot;,
+ /// SourceType: &quot;ShiftoriumUpgrade&quot;,
+ /// So [rest of string was truncated]&quot;;.
+ /// </summary>
+ public static string sploitset_keepalive {
+ get {
+ return ResourceManager.GetString("sploitset_keepalive", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to {
/// &quot;{SUBMIT}&quot;:&quot;Bestätigen&quot;,
///
diff --git a/ShiftOS.Frontend/Properties/Resources.resx b/ShiftOS.Frontend/Properties/Resources.resx
index 5a92cc4..5b11c39 100644
--- a/ShiftOS.Frontend/Properties/Resources.resx
+++ b/ShiftOS.Frontend/Properties/Resources.resx
@@ -151,4 +151,7 @@
<data name="Exploits" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Exploits.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
+ <data name="sploitset_keepalive" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\sploitset_keepalive.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
+ </data>
</root> \ No newline at end of file
diff --git a/ShiftOS.Frontend/Resources/LootInfo.txt b/ShiftOS.Frontend/Resources/LootInfo.txt
index ff2784d..9fee421 100644
--- a/ShiftOS.Frontend/Resources/LootInfo.txt
+++ b/ShiftOS.Frontend/Resources/LootInfo.txt
@@ -7,14 +7,16 @@
[
{
FriendlyName: "Force Heartbeat",
- LootName: "sploitset_keepalive",
+ LootName: "sploitset_keepalive.stp",
Rarity: 1,
PointTo: "sploitset_keepalive",
+ ID: "sploitset_keepalive"
},
{
FriendlyName: "SSHardline",
- LootName: "sploitset_sshardline",
+ LootName: "sploitset_sshardline.stp",
Rarity: 1,
PointTo: "sploitset_sshardline",
+ ID: "sploitset_keepalive"
}
] \ No newline at end of file
diff --git a/ShiftOS.Frontend/Resources/sploitset_keepalive.txt b/ShiftOS.Frontend/Resources/sploitset_keepalive.txt
new file mode 100644
index 0000000..92ea279
--- /dev/null
+++ b/ShiftOS.Frontend/Resources/sploitset_keepalive.txt
@@ -0,0 +1,12 @@
+/* ShiftOS setup data file
+ *
+ * This file holds information used by a ShiftOS "Installer" for setting up a system component.
+ *
+ */
+
+ {
+ Name: "Sploitset Force Heartbeat exploit",
+ Description: "This is an exploit for the sploitset system exploitation utility which causes the remote system to force the connection to stay alive by sending heartbeat requests even after the firewall has timed out the connection. Useful against those pesky connection timers...",
+ SourceType: "ShiftoriumUpgrade",
+ Source: "sploitset_keepalive"
+ } \ No newline at end of file
diff --git a/ShiftOS.Frontend/ShiftOS.Frontend.csproj b/ShiftOS.Frontend/ShiftOS.Frontend.csproj
index cb06b3d..570eadf 100644
--- a/ShiftOS.Frontend/ShiftOS.Frontend.csproj
+++ b/ShiftOS.Frontend/ShiftOS.Frontend.csproj
@@ -44,6 +44,7 @@
<ItemGroup>
<Compile Include="Apps\CodeShop.cs" />
<Compile Include="Apps\FileSkimmer.cs" />
+ <Compile Include="Apps\Installer.cs" />
<Compile Include="Apps\Network.cs" />
<Compile Include="Apps\Pong.cs" />
<Compile Include="Apps\SkinLoader.cs" />
@@ -196,6 +197,7 @@
<Content Include="Resources\Ports.txt" />
<Content Include="Resources\Payloads.txt" />
<Content Include="Resources\Exploits.txt" />
+ <None Include="Resources\sploitset_keepalive.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />