aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/Hacking/HackerTestCommands.cs
blob: 77bb37835d6223bf98f397429753aa2bf22fedcc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShiftOS.Engine;

#if DEBUG
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()
        {
            foreach (var exploit in Hacking.AvailablePorts)
            {
                Console.WriteLine(exploit.ID + ": " + exploit.FriendlyName);
            }
        }

        [ShellConstraint("shiftos_debug> ")]
        [Command("describehackable")]
        [RequiresArgument("id")]
        public static void DescribeHackable(Dictionary<string, object> args)
        {
            string id = args["id"].ToString();
            var hackable = Hacking.AvailableToHack.FirstOrDefault(x => x.ID == id);
            if(hackable == null)
            {
                Console.WriteLine("Hackable not found.");
                return;
            }
            Console.WriteLine(hackable.FriendlyName);
            Console.WriteLine("------------------------");
            Console.WriteLine();
            Console.WriteLine("System name: " + hackable.SystemName);
            Console.WriteLine("Loot rarity: " + hackable.LootRarity);
            Console.WriteLine("Loot amount: " + hackable.LootAmount);
            Console.WriteLine("Connection timeout level: " + hackable.ConnectionTimeoutLevel);
            Console.WriteLine();
            Console.WriteLine(hackable.WelcomeMessage);
        }

        [ShellConstraint("shiftos_debug> ")]
        [Command("describeport")]
        [RequiresArgument("id")]
        public static void DescribePort(Dictionary<string, object> args)
        {
            string id = args["id"].ToString();
            var port = Hacking.AvailablePorts.FirstOrDefault(x => x.ID == id);
            if (port == null)
            {
                Console.WriteLine("Port not found.");
                return;
            }
            Console.WriteLine(port.FriendlyName);
            Console.WriteLine("------------------------");
            Console.WriteLine();
            Console.WriteLine("Port: " + port.Value.ToString());
            Console.WriteLine("Name: " + port.Name);
        }
    }
}
#endif