diff --git a/README.md b/README.md index e8ff0fa..ee1e1a0 100644 --- a/README.md +++ b/README.md @@ -4,30 +4,8 @@ Credit to SeanDaBlack for the basis of the script. req.py is selenium python bot. sc.js is a the base of the ios shortcut [COMING SOON] -# Setup - -On mac/pc: +# Setup (Mac/Windows/Linux) `pip install -r requirements.txt` -You will probably need to go get the chrome driver to make selenium work, as they are version-specific. The one in the repo might not do it for you. Find your chrome version by going to **Chrome** >> **About Google Chrome**. - -This will open a tab that shows you your verison. Visit https://sites.google.com/chromium.org/driver/downloads and download the driver for your version. - -folder. Extract the downloaded zip file. Move the extracted chromedriver binary to this project folder - -`mv ~/Downloads/chromedriver .` - -It needs to be found in your `PATH` variable. - -`export PATH=$PATH:$(pwd)` - -`python req.py` to run. It will loop until you kill the job. `ctrl + c` in your terminal to give the pro lifes a break (optional). - -mac: - -You might also get a trust issue with the downloaded driver being unverified. To fix that, run - -`xattr -d com.apple.quarantine chromedriver` - -this just tells the OS it's safe to use this driver, and Selenium will start working. See https://timonweb.com/misc/fixing-error-chromedriver-cannot-be-opened-because-the-developer-cannot-be-verified-unable-to-launch-the-chrome-browser-on-mac-os/ for more info. +`python req.py` to run. It will loop until you kill the job. `ctrl + c` in your terminal to give the pro lifes a break (optional). \ No newline at end of file diff --git a/chromedriver.exe b/chromedriver.exe deleted file mode 100644 index 60449ae..0000000 Binary files a/chromedriver.exe and /dev/null differ diff --git a/req.py b/req.py index 5005041..49794b6 100644 --- a/req.py +++ b/req.py @@ -1,14 +1,29 @@ +import warnings +warnings.filterwarnings("ignore", category=DeprecationWarning) from selenium import webdriver from selenium.webdriver.support.ui import Select +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options +from selenium.webdriver.common.by import By import requests import random import time import os import functools from faker import Faker +from concurrent.futures import ThreadPoolExecutor +from webdriver_manager.chrome import ChromeDriverManager +os.environ['WDM_LOG_LEVEL'] = '0' +import speech_recognition as sr +from pydub import AudioSegment +filename = '1.mp3' +r = sr.Recognizer() +executor = ThreadPoolExecutor(max_workers=500) +processes = [] fake = Faker() -chromedriver_location = "./chromedriver" print = functools.partial(print, flush=True) +options = Options() +count = 0 urls = ['https://jobs.kellogg.com/job/Lancaster-Permanent-Production-Associate-Lancaster-PA-17601/817684800/#', 'https://jobs.kellogg.com/job/Omaha-Permanent-Production-Associate-Omaha-NE-68103/817685900/z', @@ -51,6 +66,28 @@ 'Memphis': ['38116', '38118', '38122', '38127', '38134', '38103'], } +def audioToText(mp3Path): + dst = "2.wav" + + # convert wav to mp3 + sound = AudioSegment.from_mp3(mp3Path) + sound.export(dst, format="wav") + + with sr.AudioFile(dst) as source: + audio_text = r.listen(source) + try: + text = r.recognize_google(audio_text) + print('Converting audio transcripts into text ...') + return(text) + except Exception as e: + print(e) + print('Sorry.. run again...') + +def saveFile(content,filename): + with open(filename, "wb") as handle: + for data in content.iter_content(): + handle.write(data) + def random_email(name=None): if name == None: name = fake.name() @@ -176,159 +213,215 @@ def random_email(name=None): def start_driver(rand_num): - driver = webdriver.Chrome(chromedriver_location) + global options + driver = webdriver.Chrome(ChromeDriverManager().install(), options=options) + #driver.set_window_size(1440, 900) driver.get(urls[rand_num]) # driver.manage().timeouts().pageLoadTimeout(5, SECONDS) # time.sleep(10) driver.implicitly_wait(10) time.sleep(2) - driver.find_element_by_xpath( + driver.find_element(By.XPATH, '//*[@id="content"]/div/div[2]/div/div[1]/div[1]/div/div/button').click() - driver.find_element_by_xpath( + driver.find_element(By.XPATH, '//*[@id="applyOption-top-manual"]').click() - driver.find_element_by_xpath( + driver.find_element(By.XPATH, '//*[@id="page_content"]/div[2]/div/div/div[2]/div/div/div[2]/a').click() return driver -def generate_account(driver, rand_num): +def generate_account(rand_num): + # start driver + try: + driver = start_driver(rand_num) + except Exception as e: + print(f"Failed to start driver: {str(e)}") + driver.close() + # make fake account info and fill - - name = fake.name() - first_name = name.split(" ")[0] - last_name = name.split(" ")[1] - email = random_email(name) - password = fake.password() - for key in data.keys(): - match key: - case 'email' | 'email-retype': - info = email - case 'pass' | 'pass-retype': - info = password - case 'first_name': - info = first_name - case 'last_name': - info = last_name - case 'pn': - info = fake.phone_number() - - driver.find_element_by_xpath(data.get(key)).send_keys(info) - - time.sleep(random.randint(0, 2)) - select = Select(driver.find_element_by_id('fbclc_ituCode')) - select.select_by_value('US') - select = Select(driver.find_element_by_id('fbclc_country')) - select.select_by_value('US') - - driver.find_element_by_xpath('//*[@id="dataPrivacyId"]').click() - time.sleep(1.5) - driver.find_element_by_xpath('//*[@id="dlgButton_20:"]').click() - time.sleep(2) - driver.find_element_by_xpath('//*[@id="fbclc_createAccountButton"]').click() + global count + try: + name = fake.name() + first_name = name.split(" ")[0] + last_name = name.split(" ")[1] + email = random_email(name) + password = fake.password() + for key in data.keys(): + match key: + case 'email' | 'email-retype': + info = email + case 'pass' | 'pass-retype': + info = password + case 'first_name': + info = first_name + case 'last_name': + info = last_name + case 'pn': + info = fake.phone_number() + + driver.find_element(By.XPATH, data.get(key)).send_keys(info) + + time.sleep(random.randint(0, 2)) + select = Select(driver.find_element(By.ID, 'fbclc_ituCode')) + select.select_by_value('US') + select = Select(driver.find_element(By.ID, 'fbclc_country')) + select.select_by_value('US') + + driver.find_element(By.XPATH, '//*[@id="dataPrivacyId"]').click() + time.sleep(1.5) + driver.find_element(By.XPATH, '//*[@id="dlgButton_20:"]').click() + time.sleep(2) - time.sleep(1.5) + googleClass = driver.find_elements(By.CLASS_NAME, 'recapBorderAccessible')[0] + time.sleep(2) + outeriframe = googleClass.find_element(By.TAG_NAME, 'iframe') + time.sleep(1) + outeriframe.click() + time.sleep(2) + allIframesLen = driver.find_elements(By.TAG_NAME, 'iframe') + time.sleep(1) + audioBtnFound = False + audioBtnIndex = -1 + for index in range(len(allIframesLen)): + driver.switch_to.default_content() + iframe = driver.find_elements(By.TAG_NAME, 'iframe')[index] + driver.switch_to.frame(iframe) + driver.implicitly_wait(2) + try: + audioBtn = driver.find_element(By.ID, 'recaptcha-audio-button') or driver.find_element(By.ID, 'recaptcha-anchor') + audioBtn.click() + audioBtnFound = True + audioBtnIndex = index + break + except Exception as e: + pass + if audioBtnFound: + try: + while True: + href = driver.find_element(By.ID, 'audio-source').get_attribute('src') + response = requests.get(href, stream=True) + saveFile(response,filename) + response = audioToText(filename) + print(response) + driver.switch_to.default_content() + iframe = driver.find_elements(By.TAG_NAME, 'iframe')[audioBtnIndex] + driver.switch_to.frame(iframe) + inputbtn = driver.find_element(By.ID, 'audio-response') + inputbtn.send_keys(response) + inputbtn.send_keys(Keys.ENTER) + time.sleep(2) + errorMsg = driver.find_elements(By.CLASS_NAME, 'rc-audiochallenge-error-message')[0] + if errorMsg.text == "" or errorMsg.value_of_css_property('display') == 'none': + print("reCaptcha defeated!") + break + except Exception as e: + print(e) + print('Oops, something happened. Check above this message for errors or check the chrome window to see if captcha locked you out...') + else: + print('Button not found. This should not happen.') - print(f"successfully made account for fake email {email}") -def fill_out_application_and_submit(driver, rand_num): + time.sleep(2) + driver.switch_to.default_content() + driver.find_element(By.XPATH, '//*[@id="fbclc_createAccountButton"]').click() - driver.implicitly_wait(10) - city = list(cities.keys())[rand_num] - - # fill out form parts of app - driver.find_element_by_xpath('//*[@id="109:topBar"]').click() - driver.find_element_by_xpath('//*[@id="260:topBar"]').click() - - zip_num = random.randint(0, 4) - - for key in data2.keys(): - - match key: - case 'resume': - driver.find_element_by_xpath('//*[@id="48:_attach"]/div[6]').click() - info = os.getcwd()+"/src/resume.png" - case 'addy': - info = fake.street_address() - case 'city': - info = city - case 'zip': - zipp = zip_codes[city] - info = zipp[zip_num] - case 'job': - info = fake.job() - case 'salary': - info = random.randint(15, 35) - - driver.find_element_by_xpath(data2.get(key)).send_keys(info) - - print(f"successfully filled out app forms for {city}") - - # fill out dropdowns - select = Select(driver.find_element_by_id('154:_select')) - select.select_by_visible_text('Yes') - select = Select(driver.find_element_by_id('195:_select')) - select.select_by_visible_text('United States') - - select = Select(driver.find_element_by_id('211:_select')) - select.select_by_visible_text('Yes') - select = Select(driver.find_element_by_id('215:_select')) - select.select_by_visible_text('No') - select = Select(driver.find_element_by_id('219:_select')) - select.select_by_visible_text('No') - select = Select(driver.find_element_by_id('223:_select')) - select.select_by_visible_text('No') - select = Select(driver.find_element_by_id('227:_select')) - select.select_by_visible_text('No') - select = Select(driver.find_element_by_id('231:_select')) - select.select_by_visible_text('Yes') - select = Select(driver.find_element_by_id('223:_select')) - select.select_by_visible_text('No') - - time.sleep(1) - - select = Select(driver.find_element_by_id('235:_select')) - gender = random.choice(['Male', 'Female', 'Other']) - select.select_by_visible_text(gender) - - driver.find_element_by_xpath('//label[text()="350 LBS"]').click() - driver.find_element_by_xpath('//label[text()="800 LBS"]').click() - els = driver.find_elements_by_xpath('//label[text()="Yes"]') - for el in els: - el.click() - - time.sleep(5) - driver.find_element_by_xpath('//*[@id="261:_submitBtn"]').click() - print(f"successfully submitted application") + time.sleep(1.5) -def main(): - i = 1 - while (i < 10000): - rand_num = random.randint(0, 3) - try: - driver = start_driver(rand_num) - except Exception as e: - print(f"failed to start driver: {str(e)}") - driver.close() - continue + print(f"Successfully made account for fake email {email}") + fill_out_application_and_submit(driver, rand_num) + except Exception as e: + print(f"Failed to create account: {str(e)}") + driver.close() - time.sleep(2) +def fill_out_application_and_submit(driver, rand_num): + global count + try: + driver.implicitly_wait(10) + city = list(cities.keys())[rand_num] + + # fill out form parts of app + driver.find_element(By.XPATH, '//*[@id="109:topBar"]').click() + driver.find_element(By.XPATH, '//*[@id="260:topBar"]').click() + + zip_num = random.randint(0, 4) + + for key in data2.keys(): + + match key: + case 'resume': + driver.find_element(By.XPATH, '//*[@id="48:_attach"]/div[6]').click() + info = os.getcwd()+"/src/resume.png" + case 'addy': + info = fake.street_address() + case 'city': + info = city + case 'zip': + zipp = zip_codes[city] + info = zipp[zip_num] + case 'job': + info = fake.job() + case 'salary': + info = random.randint(15, 35) + + driver.find_element(By.XPATH, data2.get(key)).send_keys(info) + + print(f"Successfully filled out app forms for {city}") + + # fill out dropdowns + select = Select(driver.find_element(By.ID, '154:_select')) + select.select_by_visible_text('Yes') + select = Select(driver.find_element(By.ID, '195:_select')) + select.select_by_visible_text('United States') + + select = Select(driver.find_element(By.ID, '211:_select')) + select.select_by_visible_text('Yes') + select = Select(driver.find_element(By.ID, '215:_select')) + select.select_by_visible_text('No') + select = Select(driver.find_element(By.ID, '219:_select')) + select.select_by_visible_text('No') + select = Select(driver.find_element(By.ID, '223:_select')) + select.select_by_visible_text('No') + select = Select(driver.find_element(By.ID, '227:_select')) + select.select_by_visible_text('No') + select = Select(driver.find_element(By.ID, '231:_select')) + select.select_by_visible_text('Yes') + select = Select(driver.find_element(By.ID, '223:_select')) + select.select_by_visible_text('No') + + time.sleep(1) + + select = Select(driver.find_element(By.ID, '235:_select')) + gender = random.choice(['Male', 'Female', 'Other']) + select.select_by_visible_text(gender) + + driver.find_element(By.XPATH, '//label[text()="350 LBS"]').click() + driver.find_element(By.XPATH, '//label[text()="800 LBS"]').click() + els = driver.find_elements_by_xpath('//label[text()="Yes"]') + for el in els: + el.click() - try: - generate_account(driver, rand_num) - except Exception as e: - print(f"failed to create account: {str(e)}") - driver.close() - continue + time.sleep(5) + driver.find_element(By.XPATH, '//*[@id="261:_submitBtn"]').click() + print(f"Successfully submitted application") + count += 1 + print(f"Jobs requested: {str(count)}") + driver.close() + except Exception as e: + print(f"Failed to fill out app and submit: {str(e)}") + driver.close() - try: - fill_out_application_and_submit(driver, rand_num) - except Exception as e: - print(f"failed to fill out app and submit: {str(e)}") - driver.close() - continue +def main(): + global processes + global executor - driver.close() - time.sleep(5) + speed = int(input("How many seconds between new windows?: ")) + while True: + rand_num = random.randint(0, 3) + processes.append(executor.submit(generate_account, rand_num)) + print("One operation started") + time.sleep(speed) if __name__ == '__main__': main() sys.exit() + + diff --git a/requirements.txt b/requirements.txt index f32abf4..6546644 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,12 @@ -certifi==2021.5.30 -charset-normalizer==2.0.4 -idna==3.2 -requests==2.26.0 -selenium==3.141.0 -urllib3==1.26.6 -Faker==9.9.1 \ No newline at end of file +certifi==2021.5.30 +charset-normalizer==2.0.4 +idna==3.2 +requests==2.26.0 +selenium==3.141.0 +urllib3==1.26.7 +Faker==9.9.1 +futures==3.0.5 +webdriver-manager==3.5.2 +SpeechRecognition==3.8.1 +pydub==0.25.1 +chardet==3.0.4 \ No newline at end of file