-
Notifications
You must be signed in to change notification settings - Fork 2
/
txbot.py
77 lines (63 loc) · 2.33 KB
/
txbot.py
1
from selenium import webdriverimport timefrom bs4 import BeautifulSoupfrom uszipcode import SearchEngineimport mathimport randomchromedriver_location = "/Users/delracman/Downloads/chromedriver"driver = webdriver.Chrome(chromedriver_location)driver.get("https://prolifewhistleblower.com/anonymous-form/")url = 'https://www.fakenamegenerator.com/gen-random-us-us.php'driver2 = webdriver.Chrome(chromedriver_location)driver2.get(url)page = driver2.page_sourcesoup = BeautifulSoup(page, "html.parser")violated_law = '//*[@id="forminator-field-textarea-1"]'evidence = '//*[@id="forminator-field-text-1"]'doctor = '//*[@id="forminator-field-text-6"]'city = '//*[@id="forminator-field-text-2"]'state = '//*[@id="forminator-field-text-3"]'zip_code = '//*[@id="forminator-field-text-4"]'county = '//*[@id="forminator-field-text-5"]'public_official = '//*[@id="checkbox-1"]/div/label[2]/span[1]';submit = '//*[@id="forminator-module-26"]/div[12]/div/div/button'captcha = '//*[@id="captcha-1"]/div/div/div/iframe'def humanizeKeyInput(xpath, keys): time.sleep(5) path = driver.find_element_by_xpath(xpath) webdriver.ActionChains(driver).move_to_element(path) time.sleep(1) for s in keys: path.send_keys(s) time.sleep(0.5) def generateName(): name = soup.find("div", class_='address').find('h3').text return namesearch = SearchEngine(simple_zipcode=True)def getZip(): codes = search.by_state('tx') code = math.floor(random.random() * len(codes)) return codes[code]def humanizeClick(xpath): time.sleep(5) path = driver.find_element_by_xpath(xpath) webdriver.ActionChains(driver).move_to_element(path) time.sleep(1) path.click()while True: #run until you want to stop driver.implicitly_wait(100) humanizeKeyInput(violated_law, 'My mommy aborted me') humanizeKeyInput(evidence, "I'm dead") time.sleep(2) driver2.find_element_by_xpath('//*[@id="genbtn"]').click() humanizeKeyInput(doctor, 'Dr. ' + generateName()) code = getZip() humanizeKeyInput(city, code.major_city) humanizeKeyInput(state, code.state_abbr) humanizeKeyInput(zip_code, code.zipcode) humanizeKeyInput(county, code.county) humanizeClick(public_official) humanizeClick(captcha) humanizeClick(submit) time.sleep(60) driver.refresh()