aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/HackerCommands.cs
blob: 52d8568fb42b3a846d12d885dbc9c1064651d751 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using ShiftOS.Engine;
using ShiftOS.Objects;
using ShiftOS.WinForms.Applications;
using static ShiftOS.Objects.ShiftFS.Utils;

namespace ShiftOS.WinForms
{
    [Namespace("puppy")]
    [RequiresUpgrade("hacker101_deadaccts")]
    [KernelMode]
    public static class KernelPuppyCommands
    {
        [Command("clear", true)]
        public static bool ClearLogs()
        {
            WriteAllText("0:/system/data/kernel.log", "");
            Console.WriteLine("<watchdog> logs cleared successfully.");
            return true;
        }
    }

    [Namespace("krnl")]
    public static class KernelCommands
    {
        [Command("control", true)]
        [RequiresArgument("pass")]
        public static bool Control(Dictionary<string, object> args)
        {
            if(args["pass"].ToString() == ServerManager.thisGuid.ToString())
            {
                KernelWatchdog.Log("warn", "User has breached the kernel.");
                KernelWatchdog.EnterKernelMode();
            }
            return true;
        }

        [Command("lock_session")]
        [KernelMode]
        public static bool LeaveControl()
        {
            KernelWatchdog.Log("inf", "User has left the kernel-mode session.");
            KernelWatchdog.LeaveKernelMode();
            KernelWatchdog.MudConnected = true;
            return true;
        }
    }

    [Namespace("hacker101")]
    [RequiresUpgrade("hacker101_deadaccts")]
    public static class HackerCommands
    {
        private static void writeSlow(string text)
        {
            Console.Write("[hacker101@undisclosed]: ");
            Thread.Sleep(200);
            Console.WriteLine(text);
            Thread.Sleep(1000);
        }

        [Story("hacker101_deadaccts")]
        public static void DeadAccountsStory()
        {
            if (!terminalIsOpen())
            {
                AppearanceManager.SetupWindow(new Terminal());
            }

            var t = new Thread(() =>
            {
                Console.WriteLine("[sys@mud]: Warning: User connecting to system...");
                Thread.Sleep(75);
                Console.WriteLine("[sys@mud]: UBROADCAST: Username: hacker101 - Sysname: undisclosed");
                Thread.Sleep(50);
                Console.Write("--locking mud connection resources...");
                Thread.Sleep(50);
                Console.WriteLine("...done.");
                Console.Write("--locking user input... ");
                Thread.Sleep(75);
                TerminalBackend.PrefixEnabled = false;
                TerminalBackend.InStory = true;
                Console.WriteLine("...done.");

                Thread.Sleep(2000);
                writeSlow($"Hello there, fellow multi-user domain user.");
                writeSlow("My name, as you can tell, is hacker101.");
                writeSlow("And yours must be... don't say it... it's " + SaveSystem.CurrentSave.Username + "@" + SaveSystem.CurrentSave.SystemName + ", right?");
                writeSlow("Of course it is.");
                writeSlow("And I bet you 10,000 Codepoints that you have... " + SaveSystem.CurrentSave.Codepoints.ToString() + " Codepoints.");
                writeSlow("Oh, and how much upgrades have you installed since you first started using ShiftOS?");
                writeSlow("That would be... uhh... " + SaveSystem.CurrentSave.CountUpgrades().ToString() + ".");
                writeSlow("I'm probably freaking you out right now. You are probably thinking that you're unsafe and need to lock yourself down.");
                writeSlow("But, don't worry, I mean no harm.");
                writeSlow("In fact, I am a multi-user domain safety activist and security professional.");
                writeSlow("I need your help with something.");
                writeSlow("Inside the multi-user domain, every now and then these 'dead' user accounts pop up.");
                writeSlow("They're infesting everything. They're in every legion, they infest chatrooms, and they take up precious hard drive space.");
                writeSlow("Eventually there's going to be tons of them just sitting there taking over the MUD. We can't have that.");
                writeSlow("It sounds like a conspiracy theory indeed, but it's true, in fact, these dead accounts hold some valuable treasures.");
                writeSlow("I'm talking Codepoints, skins, documents, the possibilities are endless.");
                writeSlow("I'm going to execute a quick sys-script that will show you how you can help get rid of these accounts, and also gain some valuable resources to help you on your digital frontier.");
                writeSlow("This script will also show you the fundamentals of security exploitation and theft of resources - which if you want to survive in the multi-user domain is paramount.");
                writeSlow("Good luck.");
                Thread.Sleep(1000);
                Console.WriteLine("--user disconnected");
                Thread.Sleep(75);
                Console.WriteLine("--commands unlocked - check sos.help.");
                Thread.Sleep(45);
                SaveSystem.SaveGame();
                Console.Write("--unlocking user input...");
                Thread.Sleep(75);
                Console.Write(" ..done");
                TerminalBackend.InStory = false;
                TerminalBackend.PrefixEnabled = true;
                Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
                StartHackerTutorial();
            });
            t.IsBackground = true;
            t.Start();
        }

        internal static void StartHackerTutorial()
        {
            Desktop.InvokeOnWorkerThread(() =>
            {
                var tut = new TutorialBox();
                AppearanceManager.SetupWindow(tut);

                new Thread(() =>
                {
                    

                    int tutPos = 0;
                    Action ondec = () =>
                    {
                        if (tutPos == 2)
                            tutPos++;
                    };
                    TerminalBackend.CommandProcessed += (o, a) =>
                    {
                        switch (tutPos)
                        {

                            case 0:
                            case 10:
                                if (o.ToLower().StartsWith("mud.disconnect"))
                                {
                                    tutPos++;
                                }
                                break;
                            case 11:
                                if (o.ToLower().StartsWith("krnl.lock_session"))
                                    tutPos++;
                                break;
                            case 1:
                                if (o.ToLower().StartsWith("hacker101.brute_decrypt"))
                                {
                                    if (a.Contains("0:/system/data/kernel.log"))
                                    {
                                        tutPos++;
                                    }
                                }
                                break;
                            case 3:
                                if (o.ToLower().StartsWith("krnl.control"))
                                {
                                    tutPos++;
                                }
                                break;
                            case 4:
                                if (o.ToLower().StartsWith("puppy.clear"))
                                    tutPos++;
                                break;
                            case 5:
                                if (o.ToLower().StartsWith("mud.reconnect"))
                                    tutPos++;
                                break;
                            case 6:
                                if (o.ToLower().StartsWith("mud.sendmsg"))
                                {
                                    var msg = JsonConvert.DeserializeObject<dynamic>(a);
                                    try
                                    {
                                        if (msg.header == "getusers" && msg.body == "dead")
                                            tutPos++;
                                    }
                                    catch
                                    {

                                    }
                                }
                                break;
                            case 7:
                                if (o.ToLower().StartsWith("hacker101.breach_user_password"))
                                    tutPos++;
                                break;
                            case 8:
                                if (o.ToLower().StartsWith("hacker101.print_user_info"))
                                    tutPos++;
                                break;
                            case 9:
                                if (o.ToLower().StartsWith("hacker101.steal_codepoints"))
                                    tutPos++;
                                break;
                        }
                    };
                    tut.SetObjective("Welcome to the dead account exploitation tutorial. In this tutorial you will learn the basics of hacking within the multi-user domain.");
                    Thread.Sleep(1000);
                    tut.SetObjective("We will start with a simple system exploit - gaining kernel-level access to ShiftOS. This can help you perform actions not ever possible in the user level.");
                    Thread.Sleep(1000);
                    tut.SetObjective("To gain root access, you will first need to breach the system watchdog to keep it from dialing home to DevX.");
                    Thread.Sleep(1000);
                    tut.SetObjective("The watchdog can only function when it has a successful connection to the multi-user domain. You will need to use the MUD Control Centre to disconnect yourself from the MUD. This will lock you out of most features. To disconnect from the multi-user domain, simply run the 'mud.disconnect' command.");
                    while(tutPos == 0)
                    {

                    }
                    tut.SetObjective("As you can see, the kernel watchdog has shut down temporarily, however before the disconnect it was able to tell DevX that it has gone offline.");
                    Thread.Sleep(1000);
                    tut.SetObjective("You'll also notice that commands like the shiftorium, MUD control centre and various applications that utilize these system components no longer function.");
                    Thread.Sleep(1000);
                    tut.SetObjective("The watchdog, however, is still watching. DevX was smart and programmed the kernel to log all events to a local file in 0:/system/data/kernel.log.");
                    Thread.Sleep(1000);
                    tut.SetObjective("You will need to empty out this file before you can connect to the multi-user domain, as the watchdog will send the contents of this file straight to DevX.");
                    Thread.Sleep(1000);
                    tut.SetObjective("Or, you can do what we're about to do and attempt to decrypt the log and sniff out the kernel-mode access password.");
                    Thread.Sleep(1000);
                    tut.SetObjective("This will allow us to gain kernel-level access to our system using the krnl.control{pass:} command.");
                    Thread.Sleep(1000);
                    tut.SetObjective("Let's start decrypting the log file using the hacker101.brute_decrypt{file:} script. The file: argument is a string and should point to a .log file. When the script succeeds, you will see a TextPad open with the decrypted contents.");
                    while(tutPos == 1)
                    {

                    }
                    onCompleteDecrypt += ondec;
                    tut.SetObjective("This script isn't the most agile script ever, but it'll get the job done.");
                    while(tutPos == 2)
                    {

                    }
                    onCompleteDecrypt -= ondec;
                    tut.SetObjective("Alright - it's done. Here's how it's laid out. In each log entry, you have the timestamp, then the event name, then the event description.");
                    Thread.Sleep(1000);
                    tut.SetObjective("Look for the most recent 'mudhandshake' event. This contains the kernel access code.");
                    Thread.Sleep(1000);
                    tut.SetObjective("Once you have it, run 'krnl.control{pass:\"the-kernel-code-here\"}. This will allow you to gain access to the kernel.");
                    while(tutPos == 3)
                    {

                    }
                    tut.SetObjective("You are now in kernel mode. Every command you enter will run on the kernel. Now, let's clear the watchdog's logfile and reconnect to the multi-user domain.");
                    Thread.Sleep(1000);
                    tut.SetObjective("To clear the log, simply run 'puppy.clear'.");
                    while(tutPos == 4)
                    {

                    }
                    tut.SetObjective("Who's a good dog... You are, ShiftOS. Now, we can connect back to the MUD using 'mud.reconnect'.");
                    Thread.Sleep(1000);
                    while(tutPos == 5)
                    {

                    }
                    tut.SetObjective("We have now snuck by the watchdog and DevX has no idea. With kernel-level access, everything you do is not logged, however if you perform too much in one shot, you'll get kicked off and locked out of the multi-user domain temporarily.");
                    Thread.Sleep(1000);
                    tut.SetObjective("So, let's focus on the job. You want to get into one of those fancy dead accounts, don't ya? Well, first, we need to talk with the MUD to get a list of these accounts.");
                    Thread.Sleep(1000);
                    tut.SetObjective("Simply run the `mud.sendmsg` command, specifying a 'header'  of \"getusers\", and a body of \"dead\".");
                    while(tutPos == 6)
                    {

                    }
                    tut.SetObjective("Great. We now have the usernames and sysnames of all dead accounts on the MUD. Now let's use the hacker101.breach_user_password{user:,sys:} command to breach one of these accounts' passwords.");
                    while(tutPos == 7)
                    {

                    }
                    tut.SetObjective("There - you now have access to that account. Use its password, username and sysname and run the hacker101.print_user_info{user:,pass:,sys:} command to print the entirety of this user's information.");
                    while(tutPos == 8)
                    {

                    }
                    tut.SetObjective("Now you can see a list of the user's Codepoints among other things. Now you can steal their codepoints by using the hacker101.steal_codepoints{user:,pass:,sys;,amount:} command. Be careful. This may alert DevX.");
                    while(tutPos == 9)
                    {

                    }
                    if(devx_alerted == true)
                    {
                        tut.SetObjective("Alright... enough fun and games. DevX just found out we were doing this.");
                        Thread.Sleep(500);
                        tut.SetObjective("Quick! Disconnect from the MUD!!");
                        while(tutPos == 10)
                        {

                        }
                        tut.SetObjective("Now, get out of kernel mode! To do that, run krnl.lock_session.");
                        while(tutPos == 11)
                        {

                        }
                        
                    }
                    else
                    {
                        tut.SetObjective("OK, that was risky, but we pulled it off. Treat yourself! But first, let's get you out of kernel mode.");
                        Thread.Sleep(500);
                        tut.SetObjective("First we need to get you off the MUD. Simply run mud.disconnect again.");
                        while (tutPos == 10)
                        {

                        }
                        tut.SetObjective("Now, let's run krnl.lock_session. This will lock you back into the user mode, and reconnect you to the MUD.");
                        while (tutPos == 11)
                        {

                        }
                        tut.SetObjective("If, for some reason, DevX DOES find out, you have to be QUICK to get off of kernel mode. You don't want to make him mad.");
                    }

                    Thread.Sleep(1000);
                    tut.SetObjective("So that's all for now. Whenever you're in kernel mode again, and you have access to a user account, try breaching their filesystem next time. You can use sos.help{ns:} to show commands from a specific namespace to help you find more commands easily.");
                    Thread.Sleep(1000);
                    tut.SetObjective("You can now close this window.");
                    tut.IsComplete = true;

                }).Start();
            });
        }

        private static bool devx_alerted = false;

        private static event Action onCompleteDecrypt;

        private static bool terminalIsOpen()
        {
            foreach(var win in AppearanceManager.OpenForms)
            {
                if (win.ParentWindow is Terminal)
                    return true;
            }
            return false;
        }

        const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_";

        [Command("breach_user_password")]
        [KernelMode]
        [RequiresArgument("user")]
        [RequiresArgument("sys")]
        [RequiresUpgrade("hacker101_deadaccts")]
        public static bool BreachUserPassword(Dictionary<string, object> args)
        {
            string usr = args["user"].ToString();
            string sys = args["sys"].ToString();
            bool received = false;
            ServerMessageReceived msgReceived = null;

            Console.WriteLine("--hooking system thread...");

            msgReceived = (msg) =>
            {
                if(msg.Name == "user_data")
                {
                    var sve = JsonConvert.DeserializeObject<Save>(msg.Contents);
                    var rnd = new Random();
                    var sw = new Stopwatch();
                    sw.Start();
                    Thread.Sleep(2000);
                    if(rnd.Next(0, 100) >= 75)
                    {
                        Console.WriteLine("--operation took too long - failed.");
                        ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve));
                        return;
                    }
                    sw.Stop();
                    Console.WriteLine(sve.Password);
                    Console.WriteLine();
                    Console.WriteLine("--password breached. Operation took " + sw.ElapsedMilliseconds + " milliseconds.");
                    received = true;
                    ServerManager.MessageReceived -= msgReceived;
                    TerminalBackend.PrintPrompt();
                }
                else if(msg.Name == "user_data_not_found")
                {
                    Console.WriteLine("--access denied.");
                    received = true;
                    ServerManager.MessageReceived -= msgReceived;
                    TerminalBackend.PrintPrompt();
                }
            };

            Console.WriteLine("--beginning brute-force attack on " + usr + "@" + sys + "...");
            ServerManager.MessageReceived += msgReceived;

            ServerManager.SendMessage("get_user_data", JsonConvert.SerializeObject(new
            {
                user = usr,
                sysname = sys
            }));
            Thread.Sleep(500);
            return true;
        }

        [Command("print_user_info")]
        [KernelMode]
        [RequiresArgument("pass")]
        [RequiresArgument("user")]
        [RequiresArgument("sys")]
        [RequiresUpgrade("hacker101_deadaccts")]
        public static bool PrintUserInfo(Dictionary<string, object> args)
        {
            string usr = args["user"].ToString();
            string sys = args["sys"].ToString();
            string pass = args["pass"].ToString();
            bool received = false;
            ServerMessageReceived msgReceived = null;

            Console.WriteLine("--hooking multi-user domain response call...");

            msgReceived = (msg) =>
            {
                if (msg.Name == "user_data")
                {
                    var sve = JsonConvert.DeserializeObject<Save>(msg.Contents);
                    if(sve.Password == pass)
                    {
                        Console.WriteLine("Username: " + sve.Username);
                        Console.WriteLine("Password: " + sve.Password);
                        Console.WriteLine("System name: " + sve.SystemName);
                        Console.WriteLine();
                        Console.WriteLine("Codepoints: " + sve.Codepoints.ToString());
                        
                    }
                    else
                    {
                        Console.WriteLine("--access denied.");
                    }
                    received = true;
                    ServerManager.MessageReceived -= msgReceived;
                    TerminalBackend.PrintPrompt();

                }
                else if (msg.Name == "user_data_not_found")
                {
                    Console.WriteLine("--access denied.");
                    received = true;
                    ServerManager.MessageReceived -= msgReceived;
                    TerminalBackend.PrintPrompt();
                }
            };

            Console.WriteLine("--contacting multi-user domain...");
            ServerManager.MessageReceived += msgReceived;

            ServerManager.SendMessage("get_user_data", JsonConvert.SerializeObject(new
            {
                user = usr,
                sysname = sys
            }));
            Thread.Sleep(500);
            return true;
        }

        [Command("steal_codepoints")]
        [KernelMode]
        [RequiresArgument("amount")]
        [RequiresArgument("pass")]
        [RequiresArgument("user")]
        [RequiresArgument("sys")]
        [RequiresUpgrade("hacker101_deadaccts")]
        public static bool StealCodepoints(Dictionary<string, object> args)
        {
            string usr = args["user"].ToString();
            string sys = args["sys"].ToString();
            string pass = args["pass"].ToString();
            long amount = (long)args["amount"];
            bool received = false;
            if(amount < 0)
            {
                Console.WriteLine("--invalid codepoint amount - halting...");
                return true;
            }

            ServerMessageReceived msgReceived = null;

            Console.WriteLine("--hooking multi-user domain response call...");

            msgReceived = (msg) =>
            {
                if (msg.Name == "user_data")
                {
                    var sve = JsonConvert.DeserializeObject<Save>(msg.Contents);
                    if (sve.Password == pass)
                    {
                        if(amount > sve.Codepoints)
                        {
                            Console.WriteLine("--can't steal this many codepoints from user.");
                            ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve));
                            return;
                        }

                        sve.Codepoints -= amount;
                        SaveSystem.TransferCodepointsFrom(sve.Username, amount);
                        ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve));
                        SaveSystem.SaveGame();
                    }
                    else
                    {
                        Console.WriteLine("--access denied.");
                    }
                    received = true;
                    ServerManager.MessageReceived -= msgReceived;
                    TerminalBackend.PrintPrompt();
                }
                else if (msg.Name == "user_data_not_found")
                {
                    Console.WriteLine("--access denied.");
                    received = true;
                    ServerManager.MessageReceived -= msgReceived;
                    TerminalBackend.PrintPrompt();
                }
            };

            Console.WriteLine("--contacting multi-user domain...");
            Thread.Sleep(500);
            ServerManager.MessageReceived += msgReceived;

            ServerManager.SendMessage("get_user_data", JsonConvert.SerializeObject(new
            {
                user = usr,
                sysname = sys
            }));
            Thread.Sleep(500);
            
            return true;
        }

        [Command("purge_user")]
        [KernelMode]
        [RequiresArgument("pass")]
        [RequiresArgument("user")]
        [RequiresArgument("sys")]
        [RequiresUpgrade("hacker101_deadaccts")]
        public static bool PurgeUser(Dictionary<string, object> args)
        {
            string usr = args["user"].ToString();
            string sys = args["sys"].ToString();
            string pass = args["pass"].ToString();
            ServerMessageReceived msgReceived = null;

            Console.WriteLine("--hooking multi-user domain response call...");

            msgReceived = (msg) =>
            {
                if (msg.Name == "user_data")
                {
                    var sve = JsonConvert.DeserializeObject<Save>(msg.Contents);
                    if (sve.Password == pass)
                    {
                        ServerManager.SendMessage("delete_dead_save", JsonConvert.SerializeObject(sve));
                        Console.WriteLine("<mud> User purged successfully.");
                    }
                    else
                    {
                        Console.WriteLine("--access denied.");
                    }
                    ServerManager.MessageReceived -= msgReceived;
                }
                else if (msg.Name == "user_data_not_found")
                {
                    Console.WriteLine("--access denied.");
                    ServerManager.MessageReceived -= msgReceived;
                }
                TerminalBackend.PrintPrompt();
            };

            Console.WriteLine("--contacting multi-user domain...");
            Thread.Sleep(500);
            ServerManager.MessageReceived += msgReceived;

            ServerManager.SendMessage("get_user_data", JsonConvert.SerializeObject(new
            {
                user = usr,
                sysname = sys
            }));
            Thread.Sleep(500);

            return true;
        }


        [Command("brute_decrypt", true)]
        [RequiresArgument("file")]
        public static bool BruteDecrypt(Dictionary<string, object> args)
        {
            if (FileExists(args["file"].ToString()))
            {
                string pass = new Random().Next(1000, 10000).ToString();
                string fake = "";
                Console.WriteLine("Beginning brute-force attack on password.");
                var s = new Stopwatch();
                s.Start();
                for(int i = 0; i < pass.Length; i++)
                {
                    for(int num = 0; num < 10; num++)
                    {
                        if(pass[i].ToString() == num.ToString())
                        {
                            fake += num.ToString();
                            Console.Write(num);
                        }
                    }
                }
                s.Stop();

                Console.WriteLine("...password cracked - operation took " + s.ElapsedMilliseconds + " milliseconds.");
                var tp = new TextPad();
                AppearanceManager.SetupWindow(tp);
                WriteAllText("0:/temp.txt", ReadAllText(args["file"].ToString()));
                tp.LoadFile("0:/temp.txt");
                Delete("0:/temp.txt");
                onCompleteDecrypt?.Invoke();
            }
            else
            {
                Console.WriteLine("brute_decrypt: file not found");
            }
            return true;
        }
    }

    [Namespace("storydev")]
    public static class StoryDevCommands
    {
        [Command("start", description = "Starts a story plot.", usage ="id:string")]
        [RequiresArgument("id")]
        [RemoteLock]
        public static bool StartStory(Dictionary<string, object> args)
        {
            Story.Start(args["id"].ToString());
            return true;
        }

        [Command("unexperience", description = "Marks a story plot as not-experienced yet.", usage ="id:string")]
        [RemoteLock]
        [RequiresArgument("id")]
        public static bool Unexperience(Dictionary<string, object> args)
        {
            string id = args["id"].ToString();
            if (SaveSystem.CurrentSave.StoriesExperienced.Contains(id))
            {
                Console.WriteLine("Unexperiencing " + id + ".");
                SaveSystem.CurrentSave.StoriesExperienced.Remove(id);
                SaveSystem.SaveGame();
            }
            else
            {
                Console.WriteLine("Story ID not found.");
            }

            return true;
        }
    }
}