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); } }
public static bool Run(string content, Main m) { bool header = true; bool stop = false; bool close = true; bool hidden = false; string dump = ""; Dictionary <string, Func <string, int> > properties = new Dictionary <string, Func <string, int> >() { { "window", (s) => { if (s.ToLower().Trim() == "hidden") { hidden = true; } else { hidden = false; } return(1); } }, { "dump", (s) => { dump = s.ToLower(); return(1); } }, { "close", (s) => { close = bool.Parse(s); return(1); } }, }; try { foreach (string s in content.Split('\n')) { if (stop) { break; } string str = s.Trim(); if (Regex.Match(str, @"^[\s]*$").Success) { continue; } if (str.StartsWith("@") && header) { string att = str.Split(' ')[0].Substring(1).ToLower(); string val = str.Substring(att.Length + 1); if (properties.ContainsKey(att)) { properties[att].Invoke(val); if (stop) { break; } } continue; } else if (header) { header = false; if (hidden) { Funcs.HideConsole(); } else { Funcs.ShowConsole(); } } m.RunCommand(str); } } catch (Exception) { } if (dump != "") { try { File.WriteAllText(dump, m.t.EndBuffer()); } catch (Exception) { } } if (close) { Process.GetCurrentProcess().Kill(); } return(true); }