public void Proxy_StandardFunctionality_WS_1062() { if (!DataParser.ReturnExecution("WS_1062")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1062.xml"; username = ProxyData.GetProxyUserName(_file); MainHomePage home = InitialPage.Go().EnterId(client).Logon().ClickLogin(); ProxyHomePage proxyPage = home.NavigateToAdminHomePage().LoginProxyAsuser(); proxyPage.EnterUserName(username); home = proxyPage.ProxyToMainHomePage(); Assert.AreEqual("You are proxied in under: " + username, home.GetProxyLoginMsg(), "The message of proxy login is not correct"); Assert.AreEqual("Exit Proxy", home.GetExitMsg(), "The exit proxy link is not present"); } }
public void Angular_ApprovalPage_WS_1354() { if (!DataParser.ReturnExecution("WS_1354")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1354.xml"; string proxy_name = ProxyData.GetProxyUserName(_file), url = GeneralData.GetUrl(_file); MainHomePage home = InitialPage.GoSpecial(_file).Logon().ClickLogin().NavigateToAdminHomePageSpan().ClickOptionProxy("Proxy") .EnterUserNameProxySprint2(proxy_name).ClickProxyBtn().ClosePopUp(); Assert.AreEqual("http://qaastar-sungardas.workstride.net/ng#/approval", home.GetPendingApprovalsUrl(), "url is not http://qaastar-sungardas.workstride.net/ng#/approval"); Assert.AreEqual("You are proxied in under: " + proxy_name, home.GetProxyLoginMsg(), "The message of proxy login is not correct"); PendingApprovals admin = home.NavigateToAdminHomePageSpan().ClickOptionPendingApprovals(); Assert.AreEqual("http://qaastar-sungardas.workstride.net/ng#/approval", admin.GetPendingApprovalsUrl(), "url is not http://qaastar-sungardas.workstride.net/ng#/approval"); } }
public void Mall_MilestoneRecipient_WS_1293() { if (!DataParser.ReturnExecution("WS_1293")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1293.xml"; string username = ProxyData.GetProxyUserName(_file); MainHomePage home = InitialPage.Go().Logon().ClickLogin(); ProxyHomePage proxyPage = home.NavigateToAdminHomePage().LoginProxyAsuser(); proxyPage.EnterUserName(username); home = proxyPage.ProxyToMainHomePage(); Assert.AreEqual("You are proxied in under: " + username, home.GetProxyLoginMsg(), "The message of proxy login is not correct"); Assert.AreEqual("Exit Proxy", home.GetExitMsg(), "The exit proxy link is not present"); Assert.AreEqual("SPEND SERVICE AWARD", home.GetServiceMsg(), "Service spend award msg is not correct"); } }
public void SendData(long Id, byte[] data) { if (ConnUserList.ContainsKey(Id)) { var session = ConnUserList[Id]; if (session.IsConnect && session.Client != null) { session.Client.SendData(data); } else { ProxyData tmp = new ProxyData(); tmp.Source = this.Id; tmp.Data = data; tmp.Ids = new List <long>(); tmp.Ids.Add(Id); MainClient.BeginSendData(BufferFormat.FormatFCA(tmp)); } } }
public void VisaCard_ReloadWithoutBalance_WS_1273() { if (!DataParser.ReturnExecution("WS_1273")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1273.xml"; string proxy_name = ProxyData.GetProxyUserName(_file); MainHomePage home = InitialPage.Go().Logon().ClickLogin().NavigateToAdminHomePageLi().ClickOptionProxy("Proxy") .EnterUserNameProxySprint2(proxy_name).ClickProxyBtn(); Thread.Sleep(1500); Assert.AreEqual("0.00", home.GetRewardsBalance(), "The rewards balance is not 0"); VisaCenterHomePage visaPage = home.NavigateToVisaCenter(); Assert.IsTrue(visaPage.IsSubmitAClaimPresent(), "Option is not present"); Assert.IsFalse(visaPage.IsReloadYourCardPresent(), "Reload your card option is present"); Assert.IsFalse(visaPage.IsCheckVisaCardBalance(), "Check Visa Card Balance option is present"); } }
public void Awards_RemoveFromOtherAppQueue_WS_1111() { if (!DataParser.ReturnExecution("WS_1111")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1111.xml"; string user = AwardData.GetAwardUserName(_file), award = AwardData.GetAwardName(_file), customerImpact = AwardData.GetAwardCustomerImpact(_file), bussinesImpact = AwardData.GetAwardBussinesImpact(_file), printype = AwardData.GetAwardDeliverType(_file), msg = AwardData.GetAwardMessage(_file), reason = AwardData.GetAwardReason(_file), proxy_name = ProxyData.GetProxyUserName(_file), approval_name = AwardData.GetApprovalUserName(_file); Step2 step2 = InitialPage.Go().Logon().ClickLogin().NavigateToNominationSpan() .SearchEmployeeFound(user) .SelectAward(award); Assert.AreEqual("This award is worth $250.00", step2.GetValueAward(), "the message is not right"); NominationHomePage recognitionPage = step2.SelectSameValues(customerImpact, 1) .FillMsg(msg) .FillReason(reason) .ClickNext(); step2.SelectSameValues(bussinesImpact, 0).ClickNext(); recognitionPage.DeliverType(printype); Assert.AreEqual(2, recognitionPage.GetCountEditLnk(), "Edit links are not two"); recognitionPage.ClickSendRecognition(); Assert.AreEqual("Success!", recognitionPage.GetSuccesMsg(), "Message its not success"); MainHomePage home = recognitionPage.NavigateToAdminHomePageSpan().EnterUserName(proxy_name).ProxyToMainHomePage(); Assert.IsTrue(home.IsPopUpRecognitionShow(), "Pop up recognition is not showing up"); PendingApprovals change = home.ClickHereAwardPopUp(); Assert.AreEqual("Pending Approvals", change.GetTitleMenu(), "Title is not pending approval"); change.ApproveAward().ClickApprove(); Assert.AreEqual("Pending Approvals", change.GetTitleMenu(), "Title is not pending approval"); home = change.ExitProxyToMainPage().NavigateToAdminHomePageSpan().NavigateToAdminHomePageSpan().EnterUserName(approval_name).ProxyToMainHomePage(); Assert.IsFalse(home.IsPopUpRecognitionShow(), "Pop up recognition is showing up"); } }
public void Recognition_UploadAttachments_WS_1166_Sample3() { if (!DataParser.ReturnExecution("WS_1166")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1166.xml"; AwardData.GetAwardImpact(_file); string user = AwardData.GetAwardUserName(_file), award = AwardData.GetAwardName(_file), value = AwardData.GetAwardValue(_file), secondvalue = AwardData.GetAwardSecondValue(_file), file_name = GeneralData.GetFileName(_file), reason = AwardData.GetAwardMessage(_file), path_file = GeneralData.GetPathFile(_file).Trim(), proxy_name = ProxyData.GetProxyUserName(_file); //Scenario 2 NominationHomePage recognitionPage = InitialPage.Go().Logon().ClickLogin().NavigateToAdminHomePage().LoginProxyAsuser() .EnterUserName(proxy_name).ProxyToMainHomePage().ClosePopUp().NavigateToNomination(); recognitionPage .SearchEmployeeFound(user) .SelectAward(award) .SelectValues(value) .SelectValues(secondvalue) .FillReason(reason); recognitionPage.ClickUploadFile(); for (var i = 0; i < 5; i++) { foreach (char a in path_file) { SendKeys.SendWait(a.ToString()); Thread.Sleep(30); } SendKeys.SendWait("{ENTER}"); } Assert.AreEqual("You can not upload any more files", recognitionPage.GetErrorMsgupload5Files(), "The file was upload correctly or the msg is not right"); } }
public void OverwritePnkBstrBPort() { try { System.Threading.Thread.Sleep(200); var hEvenBalanceKey = Registry.LocalMachine.CreateSubKey(proxy.pnkBstrBSubKey); var hServiceKey = hEvenBalanceKey.CreateSubKey(proxy.pnkBstrBserviceKey); var hWowEvenBalanceKey = Registry.LocalMachine.CreateSubKey(proxy.pnkBstrBWow64SubKey); var hWowServiceKey = hWowEvenBalanceKey.CreateSubKey(proxy.pnkBstrBserviceKey); proxy.destination_port = (int)hWowServiceKey.GetValue("Port"); Console.WriteLine("PnkBstrB wrote port: {0} to the registry, overwriting with {1}...", proxy.destination_port, proxy.source_port); hWowServiceKey.SetValue("Port", proxy.source_port); hServiceKey.SetValue("Port", proxy.source_port); Console.WriteLine("Wrote Port: {0} to registry.", proxy.source_port); } catch (Exception e) { Console.WriteLine("Error writing port to registry for proxy hijack: {0}", e.Message); proxy = null; } }
public static void UseProxy() { DCT.Execute(q => { var limitTryProxyLoading = 3; var countProxyLoading = 0; var hasValidProxy = false; if (currentProxy != null) { hasValidProxy = CheckProxy(currentProxy); } if (currentProxy == null || !hasValidProxy) { while (!hasValidProxy && countProxyLoading < limitTryProxyLoading) { if (proxies.Count > 0) { var nextProxy = proxies.Dequeue(); hasValidProxy = CheckProxy(nextProxy); if (hasValidProxy) { currentProxy = nextProxy; } } else { UpdateProxyList(); countProxyLoading++; } } } if (hasValidProxy) { UiHelper.UpdateActionState($"Валидный прокси найден - {currentProxy.Address}"); WinInetInterop.SetConnectionProxy("http://" + currentProxy.Address); } }); }
/// <summary> /// This method creates a mock proxy client that emulates the behaviour of Azure Function Proxies for /// TestScripts\Proxies\proxies.json /// </summary> /// <returns>Mock IProxyClient object</returns> private static ProxyClientExecutor GetMockProxyClient() { var proxyClient = new Mock <IProxyClient>(); ProxyData proxyData = new ProxyData(); proxyData.Routes.Add(new Routes() { Methods = new[] { HttpMethod.Get, HttpMethod.Post }, Name = "test", UrlTemplate = "/myproxy" }); proxyData.Routes.Add(new Routes() { Methods = new[] { HttpMethod.Get }, Name = "localFunction", UrlTemplate = "/mymockhttp" }); proxyClient.Setup(p => p.GetProxyData()).Returns(proxyData); proxyClient.Setup(p => p.CallAsync(It.IsAny <object[]>(), It.IsAny <IFuncExecutor>(), It.IsAny <ILogger>())).Returns( (object[] arguments, IFuncExecutor funcExecutor, ILogger logger) => { object requestObj = arguments != null && arguments.Length > 0 ? arguments[0] : null; var request = requestObj as HttpRequestMessage; if (request.Method == HttpMethod.Get && request.RequestUri.OriginalString == "http://localhost/mymockhttp") { var response = new HttpResponseMessage(HttpStatusCode.OK); response.Headers.Add("myversion", "123"); request.Properties[ScriptConstants.AzureFunctionsHttpResponseKey] = response; } return(Task.CompletedTask); }); return(new ProxyClientExecutor(proxyClient.Object)); }
private void Search_Click(object sender, EventArgs e) { try { if (DownloadProxy.Text == Config.LocalLanguage.ProxyPage.DownloadProxy && !StopTest.Enabled) { if (tstxtArea.Text.Trim() != "" || tstxtPort.Text.Trim() != "" || tstxtAnonymity.Text.Trim() != "") { var model = new ProxyServer(); if (tstxtArea.Text.Trim() != "") { model.country = tstxtArea.Text.Trim(); } if (tstxtPort.Text.Trim() != "") { model.port = int.Parse(tstxtPort.Text.Trim()); } if (tstxtAnonymity.Text.Trim() != "") { model.anonymity = tstxtAnonymity.Text.Trim(); } IList <ProxyServer> list = ProxyData.Search(model); BindDgv(list); } else { BindDgv(ProxyData.ProxyList); } Config.MainForm.SetStatusText(Config.LocalLanguage.Messages.Total + @":" + dgvProxyList.RowCount); } } catch (Exception ex) { MsgBox.ShowExceptionMessage(ex); } }
private void ConFigureProxyConfig(ProxyConfig proxyConfig) { proxyConfig.IsUsedProxyUser = this.IsUsedProxyUser; proxyConfig.IsUsedProxyInProgram = this.IsUsedProxyUser || this.IsUsedCustomProxyForBookmakers; if (this.IsUsedProxyUser) { proxyConfig.CurrentProxy = new ProxyData() { ProxyAddress = this.UserProxyAddress, ProxyPort = this.UserProxyPort, IsProxyAuth = this.UserIsProxyAuth, ProxyLogin = this.UserProxyLogin, ProxyPassword = this.UserProxyPassword, ProxyType = this.UserProxyType }; proxyConfig.UserProxy = proxyConfig.CurrentProxy; } else { proxyConfig.CurrentProxy = ProxyData.GetDefaultValue(); proxyConfig.CurrentProxy.ProxyType = EProxyType.Direct; } }
public void Service_AnniversarySubmission_WS_1325() { if (!DataParser.ReturnExecution("WS_1325")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1325.xml"; string msg = AwardData.GetAwardMessage(_file), award = AwardData.GetAwardName(_file), send_type = AwardData.GetAwardDeliverType(_file), proxy_name = ProxyData.GetProxyUserName(_file); MainHomePage proxyPage = InitialPage.Go().Logon().ClickLogin().NavigateToAdminHomePageSpan().ClickOptionProxy("Proxy") .EnterUserNameProxySprint2(proxy_name).ProxyToMainHomePageSprint().ClosePopUp(); Assert.AreEqual("You are proxied in as:" + proxy_name, proxyPage.GetProxyLoginMsgSprint(), "The message of proxy login is not correct"); Assert.AreEqual("Exit Proxy", proxyPage.GetExitMsg(), "The exit proxy link is not present"); Step2 step2 = proxyPage.NavigateToEventCalendar().clickSendAniversaryCard(); var recognitionPage = step2.SelectAward(award).FillMsg(msg).DeliverType(send_type); recognitionPage.ClickSendRecognition(); Assert.AreEqual("Success!", recognitionPage.GetSuccesMsg(), "Message its not success"); } }
public void Awards_MultipleRecipients_WS_1438() { if (!DataParser.ReturnExecution("WS_1438")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1438.xml"; string proxy_name = ProxyData.GetProxyUserName(_file); MainHomePage home = InitialPage.Go().Logon().ClickLogin(); ProxyHomePage proxyPage = home.NavigateToAdminHomePage().LoginProxyAsuser(); proxyPage.EnterUserName(proxy_name); home = proxyPage.ProxyToMainHomePage(); Assert.AreEqual("You are proxied in under: " + proxy_name, home.GetProxyLoginMsg(), "The message of proxy login is not correct"); Assert.AreEqual("Exit Proxy", home.GetExitMsg(), "The exit proxy link is not present"); NominationHomePage nominationHome = home.NavigateToNomination().ClickMultipleRecipients(); nominationHome.SearchEmployeeFoundMultiple("Brian Walters") .SearchEmployeeFoundMultiple("Aaron Ashing") .ClickNextGeneric(); Assert.AreEqual("Rave", nominationHome.GetFirstAwardName(), "the only Award name is not Rave"); } }
/// <summary> /// 验证代理 /// </summary> private void TestSingleProxy() { DelegateVoid delegateVoid = EnableThis; Invoke(delegateVoid); Config.MainForm.SetStatusText(Config.LocalLanguage.Messages.Testing); var sw = new Stopwatch(); sw.Start(); HttpProxy httpProxy = GetProxySetting(); var model = new ProxyServer { port = httpProxy.Port, proxy = httpProxy.Ip }; try { model.description = Config.LocalLanguage.Messages.Testing; model.status = -1; var testOption = new TestOption(); #region 读取验证配置 if (Config.LocalSetting != null && Config.LocalSetting.DefaultTestOption != null) { testOption = Config.LocalSetting.DefaultTestOption; } #endregion if (Config.LocalSetting != null && new TestProxyHelper(testOption, Config.LocalSetting.TestTimeOut, Config.LocalSetting.UserAgent).TestProxy(httpProxy).IsAlive) { sw.Stop(); Config.MainForm.SetStatusText( string.Format( Config.LocalLanguage.Messages.ProxyIsAlive + "!" + Config.LocalLanguage.Messages.TimeConsuming, sw.ElapsedMilliseconds.ToString("F0"))); model.description = sw.ElapsedMilliseconds + "ms"; model.response = int.Parse(sw.ElapsedMilliseconds + ""); model.status = 1; ProxyData.Set(model); } else { Config.MainForm.SetStatusText(Config.LocalLanguage.Messages.ProxyIsDead); model.description = Config.LocalLanguage.Messages.ProxyIsDead; model.response = 99999; model.status = 0; ProxyData.Set(model); } } catch (Exception ex) { try { model.status = 0; model.response = 99999; model.description = ex.Message; Config.MainForm.SetStatusText(ex.Message); } catch { } } finally { Invoke(delegateVoid); } }
public void Recognition_TextronStandardMonetary_WS_927() { if (!DataParser.ReturnExecution("WS_927")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_927.xml"; string user = AwardData.GetAwardUserName(_file), award = AwardData.GetAwardName(_file), secondAward = AwardData.GetSecondAwardName(_file), populationImpact = AwardData.GetAwardPopulationImpact(_file), financialImpact = AwardData.GetAwardFinancialImpact(_file), bussinesImpact = AwardData.GetAwardBussinesImpact(_file), amount = AwardData.GetAwardAmountValue(_file), objetives = AwardData.GetAwardObjetives(_file), printype = AwardData.GetAwardDeliverType(_file), msg = AwardData.GetAwardMessage(_file), projectTask = AwardData.GetAwardProjectTask(_file), reason = AwardData.GetAwardReason(_file), proxy_name = ProxyData.GetProxyUserName(_file), approval_name = AwardData.GetApprovalUserName(_file); ProxyHomePage proxyPage = InitialPage.Go().EnterId(client).Logon().ClickLogin().NavigateToAdminHomePage() .LoginProxyAsuser().EnterUserName(user); MainHomePage home = proxyPage.ProxyToMainHomePage(); Assert.AreEqual("You are proxied in under: " + user, home.GetProxyLoginMsg(), "The message of proxy login is not correct"); Step2 step2 = home.NavigateToNominationSpan() .SearchEmployeeFound(proxy_name) .SelectAward(award) .SelectValues(populationImpact) .SelectValues(financialImpact) .SelectValues(bussinesImpact) .ClickNextSameStep(); Assert.AreEqual("Appreciation Award", step2.GetAwardName("Appreciation Award"), "Award is not the same as expected"); Assert.AreEqual("Honors Award", step2.GetAwardName("Honors Award"), "Award is not the same as expected"); Assert.AreEqual("Excellence Award", step2.GetAwardName("Excellence Award"), "Award is not the same as expected"); Assert.AreEqual("Distinction Award", step2.GetAwardName("Distinction Award"), "Award is not the same as expected"); NominationHomePage recognitionPage = step2.SelectSecondAward(secondAward).SelectValueOfAward(amount) .SelectProjectTask(projectTask) .CheckProjectApproval() .SelectValues(objetives) .FillMsg(msg) .FillReason(reason) .ClickNext(); recognitionPage.DeliverType(printype); Assert.AreEqual(2, recognitionPage.GetCountEditLnk(), "Edit links are not two"); recognitionPage.ClickSendRecognition(); Assert.AreEqual("Success!", recognitionPage.GetSuccesMsg(), "Message its not success"); AdminHomePage proxy = recognitionPage.ExitProxy(); home = proxy.LoginProxyAsuser().EnterUserName(approval_name).ProxyToMainHomePage(); Assert.IsTrue(home.IsPopUpRecognitionShow(), "Pop up recognition is not showing up"); PendingApprovals pending = home.ClickHereAwardPopUp(); Assert.AreEqual("Pending Approvals", pending.GetTitleMenu(), "Title is not pending approval"); pending.ApproveAward().ClickApprove(); proxy = pending.ExitProxy(); home = proxy.LoginProxyAsuser().EnterUserName(proxy_name).ProxyToMainHomePage(); MyAwards awards = home.ClosePopUp().NavigateToMyAwards(); Assert.AreEqual(secondAward, awards.GetAwardName(1, 6), "The last award that someone gave you is not present"); awards.OpenDetailsAward(1, 7); } }
public void ConfigureProxy() { // 45301 (default pnkbstrb port proxy = new ProxyData(); }
/// <summary> /// 自动切换代理 /// </summary> public void SwitchingProxy() { if (Config.MainForm.AutoSwitchingStatus.Text == Config.LocalLanguage.Messages.AutomaticSwitchingOff) { return; } try { if (Config.AutoProxyQueue.Count > 0) { Config.MainForm.tsslCountdown.Text = Config.LocalLanguage.Messages.Swithing; #region 如果有代理队列 HttpProxy httpProxy = Config.AutoProxyQueue.Dequeue(); var result = _testProxyHelper.TestProxy(httpProxy); var canUse = result.IsAlive; var speed = result.Response; if (canUse) { #region 更换代理 if (speed < Config.LocalSetting.AutoProxySpeed * 1000) { if (Config.ProxyApplicatioin == "IE") { var ph = new ProxyHelper(); ph.SetIEProxy(httpProxy.IpAndPort, 1); Config.MainForm.SetProxyStatusLabel(); } else { SetBrowserProxy(httpProxy.IpAndPort); } Config.TsCountDown = new TimeSpan(0, 0, Config.LocalSetting.AutoChangeProxyInterval); Config.MainForm.TimerAutoSwitchingProxy.Start(); } else { Config.MainForm.tsslCountdown.Text = Config.LocalLanguage.Messages.SpeedDoestConformToTheRequirement + "," + Config.LocalLanguage.Messages.Swithing + "..."; Config.MainForm.SetToolTipText(httpProxy.IpAndPort + Config.LocalLanguage.Messages .SpeedDoestConformToTheRequirement + "," + Config.LocalLanguage.Messages.Swithing + "..."); Thread.Sleep(1000); SwitchingProxy(); } #endregion } else { #region 经验证代理已失效 Config.MainForm.tsslCountdown.Text = Config.LocalLanguage.Messages.ProxyIsDead + "," + Config.LocalLanguage.Messages.Swithing + "..."; ProxyData.Remove(httpProxy.Ip, httpProxy.Port); Config.MainForm.SetToolTipText( string.Format(Config.LocalLanguage.Messages.ProxyIsDeadAutoSwithing, httpProxy.IpAndPort)); Thread.Sleep(1000); SwitchingProxy(); #endregion } #endregion } else { if (_counts < 20) //如果队列为空,自动设置队列20次停止 { SetQueue(); _counts++; } else { //Config.ProxyViewForm.StopAutoChange(); Config.MainForm.tsslCountdown.Text = string.Empty; Config.ConsoleEx.Debug(Config.LocalLanguage.Messages.AutoSwitchingProxyListIsEmpty); Config.MainForm.SetToolTipText(Config.LocalLanguage.Messages.AutoSwitchingProxyListIsEmpty); } } } catch (Exception ex) { LogHelper.WriteException(ex); Thread.Sleep(3000); SwitchingProxy(); } }
public static extern int IoTHubClient_LL_SetOption_Proxy( UIntPtr iotHubClientHandle, [MarshalAs(UnmanagedType.LPStr)] string optionName, ref ProxyData proxyData);
/// <summary> /// 从文本中读取 /// </summary> /// <param name="text"></param> /// <returns></returns> public static string[] ReadProxyTxt(string text) { string[] result = { "0", "" }; try { string[] lines = text.Split('\n'); int beginCount = ProxyData.ProxyList.Count; foreach (string line in lines) { string proxy = line.Trim(); var regex = new Regex( @"(?<Proxy>(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))\:(?<Port>\d{1,5})\@(?<Type>(HTTP|SOCKS4|SOCK5))\#(?<Response>\d{1,5})\s(?<Country>\w+)"); MatchCollection matchs = regex.Matches(proxy); if (matchs.Count == 1) { string ip = matchs[0].Groups["Proxy"].Value; string port = matchs[0].Groups["Port"].Value; string type = matchs[0].Groups["Type"].Value; int delay = 0; int.TryParse(matchs[0].Groups["Response"].Value, out delay); string country = matchs[0].Groups["Country"].Value; // IpHelper ih = new IpHelper(strs[0]); var model = new ProxyServer(); model.proxy = ip; model.port = int.Parse(port); model.type = type; model.response = delay; model.country = country; model.status = -1; ProxyData.Set(model); } else { //regex = new Regex(@"(?<Proxy>(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))\:(?<Port>\d{1,5})"); //regex = new Regex(@"(?<Proxy>(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))(\s|\:|\:|<(.*?)>)(?<Port>\d{1,5})"); regex = new Regex( @"(?<Proxy>([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))(\s+|\:|\:|<(.*?)>)(?<Port>\d{1,5})"); matchs = regex.Matches(proxy); if (matchs.Count == 1) { string ip = matchs[0].Groups["Proxy"].Value; string port = matchs[0].Groups["Port"].Value; var model = new ProxyServer(); model.proxy = ip; model.port = int.Parse(port); model.type = "HTTP"; model.status = -1; ProxyData.Set(model); } //else //{ // result[0] = "1"; // result[1] = line + "数据格式错误!"; // break; //} } } int endCount = ProxyData.ProxyList.Count; int insertCount = endCount - beginCount; //新增的记录条数 result[1] = insertCount + " proxies added!"; } catch (Exception ex) { result[0] = "1"; result[1] = ex.Message; } return(result); }
/// <summary> /// 读取所有代理列表TXT /// </summary> /// <param name="fileName"></param> /// <param name="encode"></param> /// <returns></returns> public static string[] ReadProxyTxt(string fileName, Encoding encode) { string[] result = { "0", "" }; try { using (var objReader = new StreamReader(fileName, encode, false)) { string line; while ((line = objReader.ReadLine()) != null) { line = line.Trim(); var regex = new Regex( @"(?<Proxy>(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))\:(?<Port>\d{1,5})\@(?<Type>(HTTP|SOCKS4|SOCK5))\#(?<Response>\d{1,5})\s(?<Country>\w+)"); MatchCollection matchs = regex.Matches(line); if (matchs.Count == 1) { string ip = matchs[0].Groups["Proxy"].Value; string port = matchs[0].Groups["Port"].Value; string type = matchs[0].Groups["Type"].Value; int delay = 0; int.TryParse(matchs[0].Groups["Response"].Value, out delay); string country = matchs[0].Groups["Country"].Value; // IpHelper ih = new IpHelper(strs[0]); var model = new ProxyServer(); model.proxy = ip; model.port = int.Parse(port); model.type = type; model.response = delay; model.country = country; model.status = -1; ProxyData.Set(model); } else { //regex = new Regex(@"(?<Proxy>(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))\:(?<Port>\d{1,5})"); //regex = new Regex(@"(?<Proxy>(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))(\s|\:|\:|<(.*?)>)(?<Port>\d{1,5})"); regex = new Regex( @"(?<Proxy>([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))(\s+|\:|\:|<(.*?)>)(?<Port>\d{1,5})"); matchs = regex.Matches(line); if (matchs.Count == 1) { string ip = matchs[0].Groups["Proxy"].Value; string port = matchs[0].Groups["Port"].Value; var model = new ProxyServer(); model.proxy = ip; model.port = int.Parse(port); model.type = "HTTP"; model.status = -1; ProxyData.Set(model); } } } } } catch (Exception ex) { result[0] = "1"; result[1] = ex.Message; } return(result); }
public ProxyDialog(ProxyData?data = null) { Data = data ?? new ProxyData(); this.InitializeComponent(); }
// reads in the port value that PnkBstrB set, then overwrites it // with our proxy port. public bool StartProxy() { try { LaunchProxyApp(); System.Threading.Thread.Sleep(500); return true; } catch (Exception e) { Console.WriteLine("Error starting proxy service: {0}", e.Message); proxy = null; } return false; }
public void Awards_PointsDepositSuccessfull_WS_1096() { if (!DataParser.ReturnExecution("WS_1096")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1096.xml"; string user = AwardData.GetAwardUserName(_file), award = AwardData.GetAwardName(_file), printype = AwardData.GetAwardDeliverType(_file), msg = AwardData.GetAwardMessage(_file), reason = AwardData.GetAwardReason(_file), proxy_name = ProxyData.GetProxyUserName(_file), approval_name = AwardData.GetApprovalUserName(_file); ProxyHomePage proxyPage = InitialPage.Go().Logon().ClickLogin().NavigateToAdminHomePagePinnacola() .EnterUserName(user); MainHomePage home = proxyPage.ProxyToMainHomePage(); Assert.AreEqual("You are proxied in as:" + user, home.GetProxyLoginMsgPinnacol(), "The message of proxy login is not correct"); NominationHomePage recognitionPage = home.NavigateToNominationSpan() .SearchEmployeeFound(proxy_name) .SelectAward(award) .FillReason(reason) .FillMsg(msg) .ClickNext(); recognitionPage.DeliverType(printype); Assert.AreEqual(2, recognitionPage.GetCountEditLnk(), "Edit links are not two"); recognitionPage.ClickSendRecognition(); Assert.AreEqual("Success!", recognitionPage.GetSuccesMsg(), "Message its not success"); home = recognitionPage.ExitProxy().ClosePopUp().NavigateToAdminHomePagePinnacola() .EnterUserName(proxy_name).ProxyToMainHomePage(); Assert.AreEqual("You are proxied in as:" + proxy_name, home.GetProxyLoginMsgPinnacol(), "The message of proxy login is not correct"); int point = home.ClosePopUp().GetAwardPoint(); home.ExitProxy(); home.Refresh(); home = home.NavigateToAdminHomePagePinnacola().EnterUserName(approval_name).ProxyToMainHomePage(); Assert.IsTrue(home.IsPopUpRecognitionShow(), "Pop up recognition is not showing up"); Assert.AreEqual("You are proxied in as:" + approval_name, home.GetProxyLoginMsgPinnacol(), "The message of proxy login is not correct"); PendingApprovals pending = home.ClickHereAwardPopUp(); Assert.AreEqual("Pending Approvals", pending.GetTitleMenu(), "Title is not pending approval"); pending.ApproveAward().ClickApprove(); home.ExitProxy(); home.Refresh(); home = home.NavigateToAdminHomePagePinnacola().EnterUserName(proxy_name).ProxyToMainHomePage(); Assert.AreEqual("You are proxied in as:" + proxy_name, home.GetProxyLoginMsgPinnacol(), "The message of proxy login is not correct"); Assert.IsTrue(home.IsPopUpRecognitionShow(), "Pop up recognition is not showing up"); int totalpoints = home.GetAwardPoint(); home.ClickHereAwardPopUp(); if (point + 100 != totalpoints) { Assert.Fail(totalpoints + "is not equal to " + point); } else { Assert.True(1 == 1, totalpoints + "is equal to " + point); } } }