The first loot!

This commit is contained in:
Michael 2017-08-02 10:23:13 -04:00
parent 10d2c0bbaa
commit 37cf129165
11 changed files with 206 additions and 12 deletions

View file

@ -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);
}
}
}

View file

@ -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
}
}

View file

@ -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();

View file

@ -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)
{

View file

@ -10,6 +10,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()

View file

@ -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;,
@ -253,6 +253,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;,

View file

@ -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>

View file

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

View file

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

View file

@ -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" />

View file

@ -17,7 +17,7 @@ namespace ShiftOS.Objects
{
get
{
return LootName.ToLower().Replace(" ", "_");
return PointTo;
}
}