diff options
| author | FloppyDiskDrive <[email protected]> | 2017-11-22 11:35:48 -0600 |
|---|---|---|
| committer | FloppyDiskDrive <[email protected]> | 2017-11-22 11:35:48 -0600 |
| commit | 2cb81352d731a8326bb0acb33ca82a55933b48d5 (patch) | |
| tree | 0a1dca58d6e3e88e1ccff54a42b573795db79595 /ShiftOS.Main/Terminal/Commands | |
| parent | 277d5c79e703a287ff11b990822b66e180cd1253 (diff) | |
| download | shiftos-rewind-2cb81352d731a8326bb0acb33ca82a55933b48d5.tar.gz shiftos-rewind-2cb81352d731a8326bb0acb33ca82a55933b48d5.tar.bz2 shiftos-rewind-2cb81352d731a8326bb0acb33ca82a55933b48d5.zip | |
yay new command
Diffstat (limited to 'ShiftOS.Main/Terminal/Commands')
| -rw-r--r-- | ShiftOS.Main/Terminal/Commands/tcpip.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ShiftOS.Main/Terminal/Commands/tcpip.cs b/ShiftOS.Main/Terminal/Commands/tcpip.cs new file mode 100644 index 0000000..5e0e232 --- /dev/null +++ b/ShiftOS.Main/Terminal/Commands/tcpip.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Main; + +namespace ShiftOS.Main.Terminal.Commands +{ + public class tcpip : TerminalCommand + { + public override string Name { get; } = "tcpip"; + public override string Summary { get; } = "Shows a list of incoming or outgoing commands."; + public override string Usage { get; } = "tcpip <incoming/outcoming>"; + public override bool Unlocked { get; set; } = false; + + public override void Run(params string[] args) + { + var r = new Random(); + string gen = Generate(13); + if (args.Length == 0) + { + WriteLine("tcpip: syntax error"); + return; + } + switch (args[0].ToLower()) + { + default: + WriteLine("tcpip: syntax error"); + break; + case "incoming": + WriteLine($"Incoming connections from localhost:"); + WriteLine($"IP ADDRESS v4 COMPUTER NAME"); + WriteLine($"{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(0, 255)}.{r.Next(255)} {gen}"); + break; + } + } + public string Generate(int amountToGenerate) + { + var r = new Random(); + + string symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz0123456789!@#$%^&*()"; + char[] array = new char[amountToGenerate]; + for (int i = 0; i < amountToGenerate; i++) + { + array[i] = symbols[r.Next(0, symbols.Length)]; + } + return new string(array); + } + } +} |
