public PlatformApiCollection Codecademy([FromBody] EmailRequestModel emailRequest) { string value = emailRequest.Email; bool exists = false, timedOut = false, driverOld = false; var webDriverWaitUntilTimeout = new TimeSpan(0, 0, 5); DateTime TestedAt = DateTime.Now; if (value == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, String.Format("Request Body Error! Empty key/value pair or wrong content type, please use x-www-form-urlencoded."))); } var driver = new PhantomJSDriver(GetPhantomJSDriverService(driverOld)); driver.Navigate().GoToUrl("https://www.codecademy.com/"); WebDriverWait wait = new WebDriverWait(driver, webDriverWaitUntilTimeout); try { var username = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Name("user[username]"))); username.SendKeys(RandomString(15)); var user_email = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Name("user[email]"))); user_email.SendKeys(value); var user_password = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Name("user[password]"))); user_password.SendKeys(RandomString(15)); var error = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("ul[class^='fieldErrors']"))); if (error.Text.Contains("Email is already taken")) { driver.Quit(); exists = true; } } catch (Exception ex) { if (ex is WebDriverException) { timedOut = true; } driver.Quit(); exists = false; } PlatformApiCollection PAC = new PlatformApiCollection { Platforms = GetPlatformModel("Codecademy", value, exists, TestedAt, GetPoints(exists, 4), timedOut) }; CalculateTotalPoints(exists, value, "Codecademy", GetPoints(exists, 4)); return(PAC); }
public PlatformApiCollection StackOverflowChecker([FromBody] EmailRequestModel emailRequest) { string value = emailRequest.Email; bool exists = false, timedOut = false, driverOld = true; var webDriverWaitUntilTimeout = new TimeSpan(0, 0, 15); DateTime TestedAt = DateTime.Now; if (value == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, String.Format("Request Body Error! Empty key/value pair or wrong content type, please use x-www-form-urlencoded."))); } var driver = new PhantomJSDriver(GetPhantomJSDriverService(driverOld)); driver.Navigate().GoToUrl("https://stackoverflow.com/users/signup"); WebDriverWait wait = new WebDriverWait(driver, webDriverWaitUntilTimeout); try { var user_email = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#email"))); user_email.SendKeys(value); var user_password = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#password"))); user_password.SendKeys("FakePassw0rD1@"); var submit_button = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#submit-button"))); submit_button.Click(); var error = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#mainbar-full > div:nth-child(2) > div > div"))); if ((error.Text.Contains("The email address you have used is already registered."))) { driver.Quit(); exists = true; } } catch (Exception ex) { if (ex is WebDriverException) { timedOut = false; driver.Quit(); exists = false; } } PlatformApiCollection PAC = new PlatformApiCollection { Platforms = GetPlatformModel("StackOverflow", value, exists, TestedAt, GetPoints(exists, 2), timedOut) }; CalculateTotalPoints(exists, value, "Stack Overflow", GetPoints(exists, 2)); return(PAC); }
public PlatformApiCollection XDAChecker([FromBody] EmailRequestModel emailRequest) { string value = emailRequest.Email; bool exists = false, timedOut = false, driverOld = true; var webDriverWaitUntilTimeout = new TimeSpan(0, 0, 10); DateTime TestedAt = DateTime.Now; if (value == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, String.Format("Request Body Error! Empty key/value pair or wrong content type, please use x-www-form-urlencoded."))); } var driver = new PhantomJSDriver(GetPhantomJSDriverService(driverOld)); driver.Navigate().GoToUrl("https://forum.xda-developers.com/register.php"); WebDriverWait wait = new WebDriverWait(driver, webDriverWaitUntilTimeout); try { var username = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#regusername"))); username.SendKeys(value); var user_password = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#regpassword"))); user_password.Click(); var error = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#reg_verif_div"))); if (error.Text.Contains("That username is already in use")) { driver.Quit(); exists = true; } } catch (Exception ex) { if (ex is WebDriverException) { timedOut = true; } driver.Quit(); exists = false; } PlatformApiCollection PAC = new PlatformApiCollection { Platforms = GetPlatformModel("XDA Developer", value, exists, TestedAt, GetPoints(exists, 3), timedOut) }; CalculateTotalPoints(exists, value, "XDA Developer", GetPoints(exists, 3)); return(PAC); }
public PlatformApiCollection MicrosoftChecker([FromBody] EmailRequestModel emailRequest) { string value = emailRequest.Email; bool exists = false, timedOut = false, driverOld = true; var webDriverWaitUntilTimeout = new TimeSpan(0, 0, 10); DateTime TestedAt = DateTime.Now; if (value == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, String.Format("Request Body Error! Empty key/value pair or wrong content type, please use x-www-form-urlencoded."))); } var driver = new PhantomJSDriver(GetPhantomJSDriverService(driverOld)); driver.Navigate().GoToUrl("https://signup.live.com/signup?wa=wsignin1.0&wtrealm=urn%3afederation%3aMicrosoftOnline&wctx=estsredirect%3d2%26estsrequest%3drQIIAbPSyigpKSi20tdPTE7OL80r0SvPzEvJLy9OrCotStVLzs_Vyy9Kz0wBsaLYgYJJmTk5SYyGRUJcAi8NHT40Gba57pHO3dXv_8dsFiNHTmYZWNMqRj1C5uoHlyYVJxdlFpRk5ucVX2BkfMHI2MXEYmhgbLyJiSXYMcDzBFPzSblbTIL-RemeKeHFbqkpqUWJINWPmHhDi1OL_PNyKkPys1PzJjHz5eSnZ-bFFxelxafl5JcDBYA2FCQml8SXZCZnp5bsYlYxMUpJNLdMMdI1SzQ21DUxNbLUTTQzN9Q1NE82MzQwMzI3T7Y8wLKB8wKLwC0W1tTE4kyjHyyMi1iBHk1Q_1ki7PPJo6VN--j0NV_fnWLVz9COCMwrNc_N1i71jnAKMi2pzMit9M_Rdklxc_JM9Un3Dw_RLijy9_Uo8bQ1tTLcxUlieAAA0&id=&cbcxt=azubill&lw=1&fl=easi2&bk=1468239878&uaid=f04031e931824586bc1b6dba8f4ffc36&cru=https%3a%2f%2flogin.live.com%2flogin.srf%3fwa%3dwsignin1.0%26wtrealm%3durn%253afederation%253aMicrosoftOnline%26wctx%3destsredirect%253d2%2526estsrequest%253drQIIAbPSyigpKSi20tdPTE7OL80r0SvPzEvJLy9OrCotStVLzs_Vyy9Kz0wBsaLYgYJJmTk5SYyGRUJcAi8NHT40Gba57pHO3dXv_8dsFiNHTmYZWNMqRj1C5uoHlyYVJxdlFpRk5ucVX2BkfMHI2MXEYmhgbLyJiSXYMcDzBFPzSblbTIL-RemeKeHFbqkpqUWJINWPmHhDi1OL_PNyKkPys1PzJjHz5eSnZ-bFFxelxafl5JcDBYA2FCQml8SXZCZnp5bsYlYxMUpJNLdMMdI1SzQ21DUxNbLUTTQzN9Q1NE82MzQwMzI3T7Y8wLKB8wKLwC0W1tTE4kyjHyyMi1iBHk1Q_1ki7PPJo6VN--j0NV_fnWLVz9COCMwrNc_N1i71jnAKMi2pzMit9M_Rdklxc_JM9Un3Dw_RLijy9_Uo8bQ1tTLcxUlieAAA0%26id%3d%26cbcxt%3dazubill%26lw%3d1%26fl%3deasi2%26uaid%3df04031e931824586bc1b6dba8f4ffc36%26lc%3d1033&mkt=EN-US&lc=1033&sl=1&lic=1"); WebDriverWait wait = new WebDriverWait(driver, webDriverWaitUntilTimeout); try { var user_email = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("MemberName"))); user_email.SendKeys(value); var submit_button = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#iSignupAction"))); submit_button.Click(); var error = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#MemberNameError"))); if ((error.Text.Contains("is already a Microsoft account.")) || (error.Text.Contains("Try another name or"))) { driver.Quit(); exists = true; } } catch (Exception ex) { if (ex is WebDriverException) { timedOut = true; } driver.Quit(); exists = false; } PlatformApiCollection PAC = new PlatformApiCollection { Platforms = GetPlatformModel("Microsoft", value, exists, TestedAt, GetPoints(exists, 6), timedOut) }; CalculateTotalPoints(exists, value, "Microsoft", GetPoints(exists, 6)); return(PAC); }
public PlatformApiCollection GoogleAccountChecker([FromBody] EmailRequestModel emailRequest) { string value = emailRequest.Email; bool exists = false, timedOut = false, driverOld = false; var webDriverWaitUntilTimeout = new TimeSpan(0, 0, 10); DateTime TestedAt = DateTime.Now; if (value == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, String.Format("Request Body Error! Empty key/value pair or wrong content type, please use x-www-form-urlencoded."))); } var driver = new PhantomJSDriver(GetPhantomJSDriverService(driverOld)); driver.Navigate().GoToUrl("https://accounts.google.com/signup/v2/webcreateaccount?service=ahsid&continue=https%3A%2F%2Fdevelopers.google.com%2F%3Frefresh%3D1&flowName=GlifWebSignIn&flowEntry=SignUp&hl=en"); WebDriverWait wait = new WebDriverWait(driver, webDriverWaitUntilTimeout); try { var user_first_name = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#firstName"))); user_first_name.SendKeys(RandomString(15)); var user_last_name = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#lastName"))); user_last_name.SendKeys(RandomString(15)); var username = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#username"))); username.SendKeys(value); var user_password = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Name("Passwd"))); user_password.SendKeys("FakePassw0rD1@"); var user_password_confirm = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Name("ConfirmPasswd"))); user_password_confirm.SendKeys("FakePassw0rD1@"); var submit_button = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#accountDetailsNext > content > span"))); submit_button.Click(); var error = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#view_container > form > div.mbekbe.bxPAYd > div > div.RCum0c > div:nth-child(2) > div.fQxwff > div > div.LXRPh > div.dEOOab.RxsGPe"))); if (error.Text.Contains("That username is taken. Try another.")) { driver.Quit(); exists = true; } } catch (Exception ex) { if (ex is WebDriverException) { timedOut = true; } driver.Quit(); exists = false; } PlatformApiCollection PAC = new PlatformApiCollection { Platforms = GetPlatformModel("Google", value, exists, TestedAt, GetPoints(exists, 7), timedOut) }; //CalculateTotalPoints(exists, value, "Google", GetPoints(exists, 7)); return(PAC); }
public PlatformApiCollection BugCrowdChecker([FromBody] EmailRequestModel emailRequest) { string value = emailRequest.Email; bool exists = false, timedOut = false, driverOld = true; var webDriverWaitUntilTimeout = new TimeSpan(0, 0, 10); DateTime TestedAt = DateTime.Now; if (value == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, String.Format("Request Body Error! Empty key/value pair or wrong content type, please use x-www-form-urlencoded."))); } var driver = new PhantomJSDriver(GetPhantomJSDriverService(driverOld)); driver.Navigate().GoToUrl("https://tracker.bugcrowd.com/user/sign_up"); WebDriverWait wait = new WebDriverWait(driver, webDriverWaitUntilTimeout); try { var user_email = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#tracker_user_email"))); user_email.SendKeys(value); var user_password = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#tracker_user_password"))); user_password.SendKeys("FakePassw0rD1@"); var user_password_confirm = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#tracker_user_password_confirmation"))); user_password_confirm.SendKeys("FakePassw0rD1@"); var submit_button = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#new_tracker_user > div > fieldset:nth-child(2) > input.bc-btn.bc-btn--block"))); submit_button.Click(); var error = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#new_tracker_user > div > fieldset:nth-child(2) > div.field-error-messages > div"))); if (error.Text.Contains("has already been taken")) { driver.Quit(); exists = true; } } catch (Exception ex) { if (ex is WebDriverException) { timedOut = true; } driver.Quit(); exists = false; } PlatformApiCollection PAC = new PlatformApiCollection { Platforms = GetPlatformModel("BugCrowd", value, exists, TestedAt, GetPoints(exists, 5), timedOut) }; CalculateTotalPoints(exists, value, "BugCrowd", GetPoints(exists, 5)); return(PAC); }
public PlatformApiCollection AppleDeveloperChecker([FromBody] EmailRequestModel emailRequest) { string value = emailRequest.Email; bool exists = false, timedOut = false, driverOld = false; var webDriverWaitUntilTimeout = new TimeSpan(0, 0, 10); DateTime TestedAt = DateTime.Now; if (value == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, String.Format("Request Body Error! Empty key/value pair or wrong content type, please use x-www-form-urlencoded."))); } var driver = new PhantomJSDriver(GetPhantomJSDriverService(driverOld)); driver.Navigate().GoToUrl("https://appleid.apple.com/account#!&page=create"); WebDriverWait wait = new WebDriverWait(driver, webDriverWaitUntilTimeout); try { var user_email = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("input[type=email]"))); user_email.SendKeys(value); var user_password = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("password"))); user_password.Click(); var error = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("span.form-message"))); if ((error.Text.Contains("This email address is not available. Choose a different address."))) { driver.Quit(); exists = true; } else { driver.Quit(); exists = false; } } catch (Exception ex) { if (ex is WebDriverException) { timedOut = true; } driver.Quit(); } PlatformApiCollection PAC = new PlatformApiCollection { Platforms = GetPlatformModel("Apple", value, exists, TestedAt, GetPoints(exists, 8), timedOut) }; CalculateTotalPoints(exists, value, "Apple", GetPoints(exists, 8)); return(PAC); }