Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public static void Emergency(TerminalController t, Main m, bool restart = false)
        {
            if (!restart)
            {
                Console.Beep(400, 500);
            }
            if (!IsAdmin())
            {
                try
                {
                    Process.Start(new ProcessStartInfo
                    {
                        FileName  = m.FileName,
                        Arguments = string.Format("emergency"),
                        Verb      = "runas",
                    });
                    Environment.Exit(0);
                    return;
                }
                catch (Exception) { }
                t.ColorWrite("$eTrying to run without administrator rights...");
            }
            t.ColorWrite("$cDropping connection...");
            Process.Start(new ProcessStartInfo {
                FileName = "ipconfig", Arguments = "/flushdns"
            }).WaitForExit();
            Process.Start(new ProcessStartInfo {
                FileName = "ipconfig", Arguments = "/release"
            }).WaitForExit();
            Process[] pr = Process.GetProcesses();
            t.ColorWrite("$cScanning memory...");
            HashSet <Process> tk      = new HashSet <Process>();
            string            AppData = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "..")).FullName;

            t.SetForeColor('f');
            Process self = Process.GetCurrentProcess();

            Regex[] rg = new Regex[]
            {
                new Regex(@"^.script$"),
                new Regex(@"^cmd$"),
                new Regex(@"^powershell$"),
                new Regex(@"^mshta$")
            };
            foreach (Process p in pr)
            {
                if (p == self)
                {
                    continue;
                }
                try
                {
                    FileVersionInfo fv = p.MainModule.FileVersionInfo;
                    FileInfo        f  = new FileInfo(fv.FileName);
                    DirectoryInfo   d  = f.Directory;
                    if (fv.FileName.StartsWith("c:\\windows\\", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (fv.CompanyName != "Microsoft Corporation")
                        {
                            tk.Add(p);
                            continue;
                        }
                    }
                    if (fv.FileName.StartsWith(AppData, StringComparison.CurrentCultureIgnoreCase))
                    {
                        tk.Add(p);
                        continue;
                    }
                    if ((f.Attributes & FileAttributes.Hidden) != 0 ||
                        (d.Attributes & FileAttributes.Hidden) != 0)
                    {
                        tk.Add(p);
                        continue;
                    }
                }
                catch (Exception) { }
                foreach (Regex r in rg)
                {
                    if (r.IsMatch(p.ProcessName))
                    {
                        tk.Add(p);
                        continue;
                    }
                }
            }
            t.ColorWrite("$cKilling processes...");
            foreach (Process p in tk)
            {
                try
                {
                    p.Kill();
                    t.ColorWrite("$e {0}", p.ProcessName);
                } catch (Exception)
                {
                    t.ColorWrite("$c {0}", p.ProcessName);
                }
            }
            t.ColorWrite("$cFixing common problems...");
            m.RunCommand("rule cmd=1 regedit=1 taskmgr=1 run=1", false, true);
            m.RunCommand("rule cmd=1 regedit=1 taskmgr=1 run=1 /s", false, true);
            m.RunCommand("start taskmgr", false, true);
            m.RunCommand("netfix", false, true);
        }
Ejemplo n.º 3
0
        public static void RegexRename(string In, string Out, TerminalController Console, bool Copy = false, bool Randomize = false)
        {
            string Reg = Regex.Escape(In).Replace(@"\*", "(.+)");

            int u = 0;
            Dictionary <string, string> Fr = new Dictionary <string, string>();

            foreach (string s in Directory.GetFiles(Environment.CurrentDirectory))
            {
                FileInfo f = new FileInfo(s);
                Match    r = Regex.Match(f.Name, Reg);
                if (r.Success)
                {
                    if (Copy)
                    {
                        Fr[f.FullName] = f.FullName;
                    }
                    else
                    {
                        Fr[f.FullName] = Path.Combine(f.Directory.FullName, u.ToString("X8") + RandomString(40, 50) + "." + RandomString(3));
                        File.Move(f.FullName, Fr[f.FullName]);
                    }
                    u++;
                }
            }
            int kv = 0;
            IEnumerable <KeyValuePair <string, string> > Rf = Fr.OrderBy(o => Funcs.Rnd());
            IEnumerable <KeyValuePair <string, string> > Of = Fr.AsEnumerable();

            foreach (KeyValuePair <string, string> s in (Randomize ? Rf : Of))
            {
                FileInfo f   = new FileInfo(s.Key);
                Match    r   = Regex.Match(f.Name, Reg);
                string   res = "";
                string[] v   = new string[r.Groups.Count];
                int      i   = 0;

                foreach (Group b in r.Groups)
                {
                    v[i++] = b.Value;
                }
                res = Out;
                try
                {
                    for (int k = 0; k < v.Length; k++)
                    {
                        res = res.Replace("$" + k, v[k]);
                    }
                    res = res.Replace("$i", kv.ToString());
                    if (Copy)
                    {
                        File.Copy(s.Value, new FileInfo(res).FullName);
                    }
                    else
                    {
                        File.Move(s.Value, new FileInfo(res).FullName);
                    }
                    Console.ColorWrite("$a{0} $c=> $f{1}", f.Name, res);
                }
                catch (Exception ex)
                {
                    Console.ColorWrite("$c{0} $c=> $f{1} $c- Error: {2}", f.Name, res, ex.Message);
                }
                kv++;
            }
        }
Ejemplo n.º 4
0
 public object Run(TerminalController Console, Argumenter Arg)
 {
     return(Main.Invoke(Arg));
 }