├── README.md └── main.py /README.md: -------------------------------------------------------------------------------- 1 | [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YUV3GZF22HZQC&source=url) 2 | 3 | [](https://paxful.com/?r=zGMQymwDNQW) 4 | 3Mm7ueNMKpZdPX7t7ZWRXzKTfovLqrYCCT 5 |
6 | WARNING 7 |
8 |9 | This code is not recommended to run in a real world environment. 10 |
11 | 12 | # Xbox Turbo 13 | Get the gamertag you want for Xbox 14 | 15 | ## Requirements: 16 | - Download chromedriver via https://chromedriver.storage.googleapis.com/73.0.3683.20/chromedriver_win32.zip 17 | - unzip the chromedriver to your desired destination 18 | - edit main.py with your desired editor and set the destination path for chromedriver on line 28. 19 | - Yes, you must include the **r** so that python knows its a real string. 20 | - An example path would look like: 21 | - r"C:/Users/Nubonix/python_programming/webdrivers/chrome/version73/chromedriver.exe" 22 | - Must have accessed https://account.xbox.com/ChangeGamerTag at least 23 | once (recently), with the email you wish to claim the gamertag with. 24 | - Must have an email that is associated with the email above so that it can be used for validation / verification INSTEAD of a phone number. 25 | - `pip install selenium` 26 | ## Usage 27 | 28 | python main.py --email="myusername@hotmail.com" --password="myhotmailpassword" --screen_name="the_gamer_tag_to_monitor_then_claim" 29 | 30 | ## Possible Future Updates 31 | 32 | - [ ] Phone verification 33 | - [ ] Automatic recognition of the verification code 34 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import time 2 | import selenium 3 | import argparse 4 | from os import system 5 | from sys import exit 6 | from selenium import webdriver 7 | from selenium.webdriver.common.keys import Keys 8 | from selenium.webdriver.chrome.options import Options 9 | from selenium.webdriver.common.by import By 10 | from selenium.webdriver.support.ui import WebDriverWait 11 | from selenium.webdriver.support import expected_conditions as EC 12 | 13 | 14 | options = Options() 15 | options.add_argument('--ignore-certificate-errors') 16 | options.add_argument('--start-maximized') 17 | #options.add_argument('--headless') 18 | options.add_argument("--disable-extensions") 19 | #options.add_argument('--proxy-server=') 20 | 21 | system('clear') 22 | 23 | parser = argparse.ArgumentParser() 24 | parser.add_argument('--email', type=str, help='The email you wish to use to login to use to claim a gamertag.') 25 | parser.add_argument('--password', type=str, help='The password for the email you wish to use.') 26 | parser.add_argument('--validation', type=str, help='The validation email for the email that is required to login.') 27 | parser.add_argument('--username', type=str, help='The gamertag you wish to try and claim.') 28 | args = parser.parse_args() 29 | 30 | my_chrome_drivers_executable_path = r"chromedriver" 31 | driver = webdriver.Chrome(options=options, executable_path=my_chrome_drivers_executable_path) 32 | username = args.username 33 | 34 | # claiming account details 35 | email_id = args.email 36 | password_id = args.password 37 | 38 | # (if required) validation account details 39 | validation_email_id = args.validation 40 | 41 | # urls 42 | url = "https://www.gamertag.net/check.php" 43 | xbox_login_page = "https://login.live.com/login.srf?" 44 | xbox_change_gamer_tag_page = "https://account.xbox.com/ChangeGamerTag" 45 | 46 | 47 | def search(): 48 | # switch to the second tab, and begin our search here 49 | second_window = driver.switch_to.window(driver.window_handles[1]) 50 | second_window 51 | driver.get(url) 52 | gamertag_send = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="page-full"]/div[1]/div/div[2]/div/form/div/div[1]/div[1]/input'))) 53 | gamertag_send.send_keys(username) 54 | check_button = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="page-full"]/div[1]/div/div[2]/div/form/div/div[1]/div[2]/input'))) 55 | check_button.click() 56 | report = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="report"]'))) 57 | 58 | if "is available to use!" in str(report.text): 59 | return True 60 | 61 | def looper(): 62 | while True: 63 | start = time.time() 64 | if search(): 65 | return 66 | end = time.time() 67 | total = str(1.0 / float(end-start)) 68 | print('checks per second: '+total) 69 | 70 | def signin(): 71 | # create a new tab 72 | driver.execute_script('''window.open("https://www.google.com","_blank");''') 73 | 74 | # switch back to the zeroeth tab 75 | first_window = driver.switch_to.window(driver.window_handles[0]) 76 | first_window 77 | 78 | driver.get(xbox_login_page) 79 | # email 80 | email = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="i0116"]'))) 81 | email.clear() 82 | email.send_keys(email_id) 83 | next = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="idSIButton9"]'))) 84 | next.click() 85 | 86 | # password 87 | password = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="i0118"]'))) 88 | password.clear() 89 | password.send_keys(password_id) 90 | 91 | # signin 92 | signin = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="idSIButton9"]'))) 93 | signin.click() 94 | 95 | driver.get(xbox_change_gamer_tag_page) 96 | 97 | try: 98 | # if microsoft requires a validation email... 99 | send_email_option = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="idDiv_SAOTCS_Proofs"]/div[1]/div/div/div[2]/div'))) 100 | send_email_option.click() 101 | verify_email_id_by_typing_email_id = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="idTxtBx_SAOTCS_ProofConfirmation"]'))) 102 | verify_email_id_by_typing_email_id.send_keys(validation_email_id) 103 | send_me_a_code = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="idSubmit_SAOTCS_SendCode"]'))) 104 | send_me_a_code.click() 105 | manually_entered_verification_code = str(input('Please enter the code, that you were sent in the verification email.\n I\'ll wait: ')) 106 | verification_code = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="idTxtBx_SAOTCC_OTC"]'))) 107 | verification_code.send_keys(manually_entered_verification_code) 108 | click_to_verify = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="idSubmit_SAOTCC_Continue"]'))) 109 | click_to_verify.click() 110 | except: 111 | driver.get(xbox_change_gamer_tag_page) 112 | 113 | while True: 114 | if "https://account.xbox.com/" in driver.current_url: # this is so that other countries (like Europe) wont break the code on this line. 115 | print('Let\'s if we can\'t get that username before anyone else!') 116 | break 117 | # switch to the second tab, and begin our search here 118 | second_window = driver.switch_to.window(driver.window_handles[1]) 119 | second_window 120 | 121 | def claim_gamertag(): 122 | type_gamertag = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '//*[@id="xbox-changegamertag-9m4a82r"]/div/div[1]/div[3]/input'))) 123 | type_gamertag.send_keys(username) 124 | 125 | check_availability = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '//*[@id="checkavailability"]'))) 126 | check_availability.click() 127 | 128 | claim_it = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '//*[@id="claimgamertag"]'))) 129 | claim_it.click() 130 | 131 | 132 | def main(): 133 | # lets signin to setup our claimer 134 | signin() 135 | # after we are signed in, lets start our looper, to find when the gamertag is/has changed. 136 | looper() 137 | # looper has found that the gamertag is NOW unclaimed, lets focus the primary tab and claim the gamertag 138 | first_window = driver.switch_to.window(driver.window_handles[0]) 139 | first_window 140 | # lets execute the claim_gamertag function, so that the gamertag IS claimed. 141 | claim_gamertag() 142 | # now, lets sell this code and make some $$$ 143 | 144 | 145 | if __name__ == "__main__": 146 | system('clear') 147 | print('Program initiated.\n') 148 | main() 149 | 150 | --------------------------------------------------------------------------------