public void Run() { FirstKey = Environment.TickCount; LastKey = Environment.TickCount; while (true) { Console.CursorVisible = true; if (Console.CursorLeft != 0) { Console.WriteLine(); } if (LastKey > FirstKey + 2000) { t.SetForeColor('c'); Console.WriteLine("\nEmergency mode triggered!"); Funcs.Emergency(t, this); } t.SetForeColor('f'); Console.Write("> "); string s = t.ReadLine(); killthread = false; if (s != null) { this.RunCommand(s); } else { t.WriteLine(); } } }
public Main(TerminalController te, int tid = 0) { this.Config(); this.tid = tid; VulnerFolder = new DirectoryInfo(Path.Combine(Environment.ExpandEnvironmentVariables("%appdata%"), Name.ToLower())); if (!VulnerFolder.Exists) { VulnerFolder.Create(); } if (Environment.GetCommandLineArgs().Contains("root")) { Process.Start(new ProcessStartInfo { FileName = Environment.GetCommandLineArgs()[0], Arguments = "runas", Verb = "runas", WindowStyle = ProcessWindowStyle.Normal, CreateNoWindow = false, }); Environment.Exit(0); return; } if (Environment.GetCommandLineArgs().Contains("update")) { int id = Process.GetCurrentProcess().Id; Process.GetProcesses().Where(t => t.ProcessName.ToLower().Contains(Name.ToLower()) && t.Id != id).Select(t => { t.Kill(); return(0); }); string self = Environment.GetCommandLineArgs().Skip(1).Where(t => t != "update").First(); #if (DEBUG) string vr = "Debug"; #else string vr = "Release"; #endif string dl = "https://github.com/Falofa/Vulner/blob/master/Vulner/bin/{0}/Vulner.exe?raw=true"; System.Net.WebClient wb = new System.Net.WebClient(); File.WriteAllBytes(self, wb.DownloadData(string.Format(dl, vr))); Process.Start(self, "updated"); Process.GetCurrentProcess().Kill(); return; } t = te; Groups = new Dictionary <string, CommandGroup>(); Cmds = new Commands().Get(this, t); Cmds[""] = new Command(); Environment.SetEnvironmentVariable(Name, Environment.GetCommandLineArgs()[0]); Environment.SetEnvironmentVariable("startup", Environment.GetFolderPath(Environment.SpecialFolder.Startup)); Environment.SetEnvironmentVariable("startmenu", Environment.GetFolderPath(Environment.SpecialFolder.StartMenu)); string asciiName = @" $f║$c ____ ____ __ $fDeveloped by Falofa $f║ $f║$c \ \ / __ __| | ____ ___________ $f║ $f║$c \ Y | | | | / \_/ __ \_ __ \ $f║ $f║$c \ /| | | |_| | \ ___/| | \/ $f║ $f║$c \___/ |____/|____|___|__/\____/|__| $f║".Substring(2); string capt = " ╔═══════════════════════════════════════════════╗"; string capb = " ╚═══════════════════════════════════════════════╝"; #if (DEBUG) string build = "Debug Build"; #else string build = "Release Build"; #endif string fbuild = string.Format("$a[[ {0} ]]", build); fbuild = string.Format(" ║{0} $f║", fbuild.PadLeft(capt.Length - 3)); t.WriteLine(); t.ColorWrite(capt); t.ColorWrite(asciiName); t.ColorWrite(fbuild); t.ColorWrite(capb); t.WriteLine(); t.ColorWrite("$2Type $eHELP$2 for a list of commands"); if (Environment.GetCommandLineArgs().Contains("updated")) { t.ColorWrite("$a{0} was updated!", Name); } foreach (string s in Environment.GetCommandLineArgs()) { if (s.ToLower().EndsWith(".fal")) { if (!File.Exists(s.ToLower())) { Environment.Exit(1); } Environment.CurrentDirectory = new FileInfo(s.ToLower()).DirectoryName; Funcs.RunFile(s, this); break; } } Funcs.ShowConsole(); Funcs.EnableRightClick(); ConsoleCancelEventHandler ce = (o, e) => { if ((Environment.TickCount - LastKey) > 500) { FirstKey = Environment.TickCount; } LastKey = Environment.TickCount; if ((e.SpecialKey & ConsoleSpecialKey.ControlC) == ConsoleSpecialKey.ControlC) { killthread = true; if (CurrentArgumenter != null) { CurrentArgumenter.Quit = true; } } e.Cancel = true; }; Console.CancelKeyPress += ce; if (Environment.GetCommandLineArgs().Contains("emergency")) { Funcs.Emergency(te, this, true); } }