mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-03 23:23:53 +01:00 
			
		
		
		
	oh gosh
This commit is contained in:
		
							
								
								
									
										217
									
								
								V5.py
									
									
									
									
									
								
							
							
						
						
									
										217
									
								
								V5.py
									
									
									
									
									
								
							@@ -5,18 +5,15 @@ from modules.config import *
 | 
				
			|||||||
from modules.tools import *
 | 
					from modules.tools import *
 | 
				
			||||||
from modules.error import *
 | 
					from modules.error import *
 | 
				
			||||||
from modules.driver_tools import *
 | 
					from modules.driver_tools import *
 | 
				
			||||||
 | 
					import modules.globals as g
 | 
				
			||||||
 | 
					
 | 
				
			||||||
global driver
 | 
					 | 
				
			||||||
driver = None
 | 
					 | 
				
			||||||
global _mail, _password, _otp, display
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO : replace by a better print (with logging, cf https://realpython.com/python-logging/)
 | 
					driver = g.driver
 | 
				
			||||||
def printf(e):
 | 
					display = g.display
 | 
				
			||||||
    printf2(str(e), _mail)
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO
 | 
					# TODO
 | 
				
			||||||
# handle "panda"'s error: error while logging in preventing some task to be done SadPanda.svg
 | 
					# handle "panda"'s error: error while logging in preventing some task to be done SadPanda.svg:
 | 
				
			||||||
# check that each card worked (lot of misses lately) -- test that -- don't crash at least
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# create a webdriver 
 | 
					# create a webdriver 
 | 
				
			||||||
@@ -43,11 +40,11 @@ def firefox_driver(mobile=False, headless=False):
 | 
				
			|||||||
    if mobile :
 | 
					    if mobile :
 | 
				
			||||||
        options.set_preference("general.useragent.override", MOBILE_USER_AGENT)
 | 
					        options.set_preference("general.useragent.override", MOBILE_USER_AGENT)
 | 
				
			||||||
        driver = webdriver.Firefox(options=options)
 | 
					        driver = webdriver.Firefox(options=options)
 | 
				
			||||||
        driver.set_window_size(1070 + hash(_mail)%20 , 1900 + hash(_password + "salt")%10) # mobile resolution are crazy high now, right ?
 | 
					        driver.set_window_size(1070 + hash(g._mail)%20 , 1900 + hash(g._password + "salt")%10) # mobile resolution are crazy high now, right ?
 | 
				
			||||||
    else :
 | 
					    else :
 | 
				
			||||||
        options.set_preference("general.useragent.override", PC_USER_AGENT)
 | 
					        options.set_preference("general.useragent.override", PC_USER_AGENT)
 | 
				
			||||||
        driver = webdriver.Firefox(options=options)
 | 
					        driver = webdriver.Firefox(options=options)
 | 
				
			||||||
        driver.set_window_size(1900 + hash(_mail)%20 , 1070 + hash(_password + "salt")%10)
 | 
					        driver.set_window_size(1900 + hash(g._mail)%20 , 1070 + hash(g._password + "salt")%10)
 | 
				
			||||||
    return(driver)
 | 
					    return(driver)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -83,7 +80,7 @@ def log_error(error, ldriver=driver, log=FULL_LOG):
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
        file = File("screenshot.png")
 | 
					        file = File("screenshot.png")
 | 
				
			||||||
        embed.set_image(url="attachment://screenshot.png")
 | 
					        embed.set_image(url="attachment://screenshot.png")
 | 
				
			||||||
        embed.set_footer(text=_mail)
 | 
					        embed.set_footer(text=g._mail)
 | 
				
			||||||
        webhookFailure.send(embed=embed, username="error", file=file, avatar_url = AVATAR_URL)
 | 
					        webhookFailure.send(embed=embed, username="error", file=file, avatar_url = AVATAR_URL)
 | 
				
			||||||
        webhookFailure.send(username="error", file=File("page.html"), avatar_url = AVATAR_URL)
 | 
					        webhookFailure.send(username="error", file=File("page.html"), avatar_url = AVATAR_URL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -382,156 +379,94 @@ def try_play(nom="inconnu"):
 | 
				
			|||||||
            custom_sleep(uniform(3, 5))
 | 
					            custom_sleep(uniform(3, 5))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# login() tries to login to your Microsoft account.
 | 
					# Login with password or with cookies.
 | 
				
			||||||
# it uses global variable _mail and _password to login
 | 
					# The driver should be in the same state on both case 
 | 
				
			||||||
def login(ldriver):
 | 
					def pwd_login(ldriver):    
 | 
				
			||||||
    def pwd_login():    
 | 
					 | 
				
			||||||
    printf("pwd_login : start")
 | 
					    printf("pwd_login : start")
 | 
				
			||||||
    ldriver.get("https://login.live.com")
 | 
					    ldriver.get("https://login.live.com")
 | 
				
			||||||
        custom_sleep(2)
 | 
					 | 
				
			||||||
    wait_until_visible(By.ID, "i0116", browser = ldriver)
 | 
					    wait_until_visible(By.ID, "i0116", browser = ldriver)
 | 
				
			||||||
    mail_elem = ldriver.find_element(By.ID, "i0116")
 | 
					    mail_elem = ldriver.find_element(By.ID, "i0116")
 | 
				
			||||||
        send_keys_wait(mail_elem, _mail)
 | 
					    send_keys_wait(mail_elem, g._mail)
 | 
				
			||||||
    mail_elem.send_keys(Keys.ENTER)
 | 
					    mail_elem.send_keys(Keys.ENTER)
 | 
				
			||||||
        custom_sleep(2)
 | 
					 | 
				
			||||||
    wait_until_visible(By.ID, "i0118", browser = ldriver)
 | 
					    wait_until_visible(By.ID, "i0118", browser = ldriver)
 | 
				
			||||||
    pwd_elem = ldriver.find_element(By.ID, "i0118")
 | 
					    pwd_elem = ldriver.find_element(By.ID, "i0118")
 | 
				
			||||||
        send_keys_wait(pwd_elem, _password)
 | 
					    send_keys_wait(pwd_elem, g._password)
 | 
				
			||||||
    pwd_elem.send_keys(Keys.ENTER)
 | 
					    pwd_elem.send_keys(Keys.ENTER)
 | 
				
			||||||
    custom_sleep(2)
 | 
					    custom_sleep(2)
 | 
				
			||||||
 | 
					    # 2FA
 | 
				
			||||||
    if "Entrez le code de sécurité" in ldriver.page_source : 
 | 
					    if "Entrez le code de sécurité" in ldriver.page_source : 
 | 
				
			||||||
        try : 
 | 
					        try : 
 | 
				
			||||||
            a2f_elem = ldriver.find_element(By.ID, "idTxtBx_SAOTCC_OTC")
 | 
					            a2f_elem = ldriver.find_element(By.ID, "idTxtBx_SAOTCC_OTC")
 | 
				
			||||||
                a2f_elem.send_keys(_otp.now())
 | 
					            a2f_elem.send_keys(g._otp.now())
 | 
				
			||||||
            a2f_elem.send_keys(Keys.ENTER)
 | 
					            a2f_elem.send_keys(Keys.ENTER)
 | 
				
			||||||
        except Exception as e :
 | 
					        except Exception as e :
 | 
				
			||||||
            log_error(e)
 | 
					            log_error(e)
 | 
				
			||||||
        custom_sleep(5)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def cookie_login(ldriver):
 | 
				
			||||||
 | 
					    printf("cookies_login : start")
 | 
				
			||||||
 | 
					    ldriver.get("https://login.live.com")
 | 
				
			||||||
 | 
					    try : 
 | 
				
			||||||
 | 
					        load_cookies(ldriver)
 | 
				
			||||||
 | 
					    except FileNotFoundError :
 | 
				
			||||||
 | 
					        printf("No cookies file Found.")
 | 
				
			||||||
 | 
					        return(False)
 | 
				
			||||||
 | 
					    ldriver.refresh()
 | 
				
			||||||
 | 
					    return(True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Accept all cookies question, and check if the account is locked
 | 
				
			||||||
 | 
					def login_part_2(ldriver, cookies = False):
 | 
				
			||||||
 | 
					    custom_sleep(5)
 | 
				
			||||||
    if ('Abuse' in ldriver.current_url) : 
 | 
					    if ('Abuse' in ldriver.current_url) : 
 | 
				
			||||||
            log_error("account suspended")
 | 
					 | 
				
			||||||
        raise Banned()
 | 
					        raise Banned()
 | 
				
			||||||
        save_cookies(driver, _mail)
 | 
					    if cookies:
 | 
				
			||||||
        for id in ["KmsiCheckboxField","iLooksGood", "idSIButton9", "iCancel"]:
 | 
					        save_cookies(ldriver)
 | 
				
			||||||
 | 
					    for id in ["KmsiCheckboxField", "id__0", "iLooksGood", "idSIButton9", "iCancel"]:
 | 
				
			||||||
 | 
					        if get_domain(ldriver) == "account.microsoft.com":
 | 
				
			||||||
 | 
					            break
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            ldriver.find_element(By.ID, id).click()
 | 
					            ldriver.find_element(By.ID, id).click()
 | 
				
			||||||
            restart = True
 | 
					            restart = True
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
 | 
					    wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 20, ldriver)
 | 
				
			||||||
 | 
					    ldriver.get("https://www.bing.com")
 | 
				
			||||||
 | 
					    rgpd_popup(ldriver)
 | 
				
			||||||
 | 
					    ldriver.refresh()
 | 
				
			||||||
 | 
					    rgpd_popup(ldriver)
 | 
				
			||||||
 | 
					    ldriver.get("https://account.microsoft.com/")
 | 
				
			||||||
 | 
					    if wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 30, ldriver) :
 | 
				
			||||||
 | 
					        return(True) #the account logging was successful
 | 
				
			||||||
 | 
					    else :
 | 
				
			||||||
 | 
					        log_error("Error during login. Trying to refresh")
 | 
				
			||||||
 | 
					        ldriver.refresh()
 | 
				
			||||||
 | 
					        return(wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 30, ldriver))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try : 
 | 
					
 | 
				
			||||||
            body_elem = ldriver.find_element(By.TAG_NAME, "body") # in case of any random popup
 | 
					#going to MsRewards
 | 
				
			||||||
            body_elem.send_keys(Keys.ENTER)
 | 
					def go_to_msrewards(ldriver):
 | 
				
			||||||
        except :
 | 
					    for i in ["[h='ID=RewardsFlyout,2.1']", f'[title="Rejoindre maintenant"]', f'[title="Rejoindre"]', f'[title="Join now"]'] :
 | 
				
			||||||
            pass
 | 
					 | 
				
			||||||
        printf("login completed - going to MsRewards")
 | 
					 | 
				
			||||||
        custom_sleep(uniform(3,5))
 | 
					 | 
				
			||||||
        ldriver.get("https://www.bing.com/rewardsapp/flyout")
 | 
					        ldriver.get("https://www.bing.com/rewardsapp/flyout")
 | 
				
			||||||
        custom_sleep(uniform(3,5))
 | 
					        if ('>Tableau de bord' in ldriver.page_source) :
 | 
				
			||||||
        for i in [f'[title="Rejoindre maintenant"]', f'[title="Rejoindre"]', f'[title="Join now"]'] :
 | 
					            printf('On MsRewards flyout')
 | 
				
			||||||
 | 
					            return(True)
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            ldriver.find_element(By.CSS_SELECTOR, i).click()  # depend of the language of the page
 | 
					            ldriver.find_element(By.CSS_SELECTOR, i).click()  # depend of the language of the page
 | 
				
			||||||
        except:
 | 
					        except:
 | 
				
			||||||
            printf(f"element {i} not found")
 | 
					            printf(f"element {i} not found")
 | 
				
			||||||
        rgpd_popup(ldriver)
 | 
					 | 
				
			||||||
        custom_sleep(uniform(3,5))
 | 
					 | 
				
			||||||
        ldriver.get("https://www.bing.com/rewardsapp/flyout")
 | 
					 | 
				
			||||||
        try:
 | 
					 | 
				
			||||||
            ldriver.find_element(By.CSS_SELECTOR, '[title="Rejoindre maintenant"]').click()  # depend of the language of the page
 | 
					 | 
				
			||||||
        except:
 | 
					 | 
				
			||||||
            printf(f"unlock test: fail, probably normal")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        printf('on MsRewards')
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def cookie_login():
 | 
					# login() tries to login to your Microsoft account.
 | 
				
			||||||
        ldriver.get("https://login.live.com")
 | 
					# it uses global variable g._mail and g._password to login
 | 
				
			||||||
 | 
					def login(ldriver):
 | 
				
			||||||
    try : 
 | 
					    try : 
 | 
				
			||||||
            load_cookies(ldriver, _mail)
 | 
					        success_cookies = cookie_login(ldriver)
 | 
				
			||||||
        except FileNotFoundError :
 | 
					        input("paused")
 | 
				
			||||||
            printf("Creating cookies file")
 | 
					        if not success_cookies:
 | 
				
			||||||
            return(False)
 | 
					            pwd_login(ldriver)
 | 
				
			||||||
        try : 
 | 
					        login_part_2(ldriver, not success_cookies)
 | 
				
			||||||
            ldriver.refresh()
 | 
					        go_to_msrewards(ldriver)
 | 
				
			||||||
        except WebDriverException as e: # This error occurs at random time. Don't really know why
 | 
					 | 
				
			||||||
            if "Reached error page: about:neterror?e=netTimeout" in str(e):
 | 
					 | 
				
			||||||
                log_error("Timeout error occurred. \"normal\"....., maybe because of mismatch date ?", ldriver, True) # TODO check this hypothesis
 | 
					 | 
				
			||||||
            else:
 | 
					 | 
				
			||||||
                log_error(e, ldriver)
 | 
					 | 
				
			||||||
        wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-rewards"]', 20, ldriver)
 | 
					 | 
				
			||||||
        if "Abuse" in ldriver.current_url:
 | 
					 | 
				
			||||||
            log_error("banned", ldriver)
 | 
					 | 
				
			||||||
            raise Banned()
 | 
					 | 
				
			||||||
        if ("account.microsoft.com" in ldriver.current_url) :
 | 
					 | 
				
			||||||
            if "notice" in ldriver.current_url:
 | 
					 | 
				
			||||||
                ldriver.find_element(By.ID, "id__0").click()
 | 
					 | 
				
			||||||
                wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-rewards"]', 20, ldriver)
 | 
					 | 
				
			||||||
            ldriver.get("https://bing.com")
 | 
					 | 
				
			||||||
            wait_until_visible(By.CSS_SELECTOR, '[id="bnp_btn_accept"]', 5, ldriver)
 | 
					 | 
				
			||||||
            ldriver.refresh()
 | 
					 | 
				
			||||||
            rgpd_popup(ldriver) # Ultra important
 | 
					 | 
				
			||||||
            ldriver.get("https://www.bing.com/rewardsapp/flyout")
 | 
					 | 
				
			||||||
            log_error("1", ldriver, True)
 | 
					 | 
				
			||||||
            #if "SadPanda.svg" in ldriver.page_source :
 | 
					 | 
				
			||||||
            #    log_error('test SadPanda before', ldriver)
 | 
					 | 
				
			||||||
            #    driver.execute_script("location.reload(true);")
 | 
					 | 
				
			||||||
            #    log_error('test SadPanda after', ldriver)
 | 
					 | 
				
			||||||
            if not('>Tableau de bord' in ldriver.page_source):
 | 
					 | 
				
			||||||
                log_error("2", ldriver, True)
 | 
					 | 
				
			||||||
                try : 
 | 
					 | 
				
			||||||
                    ldriver.find_element(By.CSS_SELECTOR, "[h='ID=RewardsFlyout,2.1']").click()
 | 
					 | 
				
			||||||
                    custom_sleep(5)
 | 
					 | 
				
			||||||
                    log_error("3", ldriver, True)
 | 
					 | 
				
			||||||
                    if "bing.com" in ldriver.current_url :
 | 
					 | 
				
			||||||
                        rgpd_popup(ldriver)
 | 
					 | 
				
			||||||
                        ldriver.get("https://www.bing.com/rewardsapp/flyout")
 | 
					 | 
				
			||||||
                        if ('>Tableau de bord' in ldriver.page_source) :
 | 
					 | 
				
			||||||
                            return(True)
 | 
					 | 
				
			||||||
                        if "bing.com" in ldriver.current_url : # Mobile ONLY -> check that that is true
 | 
					 | 
				
			||||||
                            ldriver.get("https://www.bing.com/rewardsapp/flyout")
 | 
					 | 
				
			||||||
                            custom_sleep(2)
 | 
					 | 
				
			||||||
                            log_error("4", ldriver, True)
 | 
					 | 
				
			||||||
                            return(True)
 | 
					 | 
				
			||||||
                    else :
 | 
					 | 
				
			||||||
                        printf("error during the connection. Trying something else")
 | 
					 | 
				
			||||||
                except Exception as e:
 | 
					 | 
				
			||||||
                    log_error(f"not connected 5 - error {e}", ldriver)
 | 
					 | 
				
			||||||
                if not('>Tableau de bord' in ldriver.page_source):
 | 
					 | 
				
			||||||
                    try : 
 | 
					 | 
				
			||||||
                        log_error("5", ldriver, True)
 | 
					 | 
				
			||||||
                        ldriver.find_element(By.XPATH, "/html/body/div/div/div/div/div[2]/a").click()
 | 
					 | 
				
			||||||
                        custom_sleep(5)
 | 
					 | 
				
			||||||
                    except Exception as e:
 | 
					 | 
				
			||||||
                        log_error(f"erreur not connected 6{e}", ldriver)
 | 
					 | 
				
			||||||
                        return(False)
 | 
					 | 
				
			||||||
                    if "bing.com" in ldriver.current_url :
 | 
					 | 
				
			||||||
                        rgpd_popup(ldriver)
 | 
					 | 
				
			||||||
                        ldriver.get("https://www.bing.com/rewardsapp/flyout")
 | 
					 | 
				
			||||||
                        if ('>Tableau de bord' in ldriver.page_source) :
 | 
					 | 
				
			||||||
                            log_error("7", ldriver, True)
 | 
					 | 
				
			||||||
                            return(True)
 | 
					 | 
				
			||||||
                        else :
 | 
					 | 
				
			||||||
                            log_error("not connected 6", ldriver)
 | 
					 | 
				
			||||||
                            return(False)
 | 
					 | 
				
			||||||
            return(True)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if ('account.live.com' in ldriver.current_url):
 | 
					 | 
				
			||||||
            log_error("error 1", ldriver, True)
 | 
					 | 
				
			||||||
            ldriver.refresh()
 | 
					 | 
				
			||||||
            log_error("error 2", ldriver, True)
 | 
					 | 
				
			||||||
            ldriver.get("https://bing.com")
 | 
					 | 
				
			||||||
            ldriver.refresh()
 | 
					 | 
				
			||||||
            rgpd_popup(ldriver)
 | 
					 | 
				
			||||||
            log_error("error 3", ldriver, True)
 | 
					 | 
				
			||||||
            sleep(5)
 | 
					 | 
				
			||||||
            return(True)
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
        printf("cookies plus valides ?")
 | 
					 | 
				
			||||||
        return(False)
 | 
					 | 
				
			||||||
    try : 
 | 
					 | 
				
			||||||
        if cookie_login():
 | 
					 | 
				
			||||||
            return (ldriver.current_window_handle)
 | 
					 | 
				
			||||||
        pwd_login() #mobile login in never called. TODO : check if it's bad.
 | 
					 | 
				
			||||||
        return(ldriver.current_window_handle)
 | 
					 | 
				
			||||||
    except Banned:
 | 
					    except Banned:
 | 
				
			||||||
        raise Banned()
 | 
					        raise Banned()
 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
@@ -792,20 +727,20 @@ def daily_routine(custom = False):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        log_points(_mail)
 | 
					        log_points(g._mail)
 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        log_error(e)
 | 
					        log_error(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def dev():
 | 
					def dev():
 | 
				
			||||||
    log_error("test")
 | 
					    input("paused")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def CustomStart(Credentials):
 | 
					def CustomStart(Credentials):
 | 
				
			||||||
    global START_TIME
 | 
					    global START_TIME
 | 
				
			||||||
    if not LINUX_HOST :
 | 
					    if not LINUX_HOST :
 | 
				
			||||||
        raise NameError('You need to be on linux to do that, due to the utilisation of a module named enquieries, sorry.') 
 | 
					        raise NameError('You need to be on linux to do that, due to the utilisation of a module named enquieries, sorry.') 
 | 
				
			||||||
    global driver, _mail, _password, p, _otp
 | 
					    global driver, p
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    system("clear")  # clear from previous command to allow a clean choice
 | 
					    system("clear")  # clear from previous command to allow a clean choice
 | 
				
			||||||
    actions = ["tout", "daily", "pc", "mobile", "log_points","fidelity", "dev"]
 | 
					    actions = ["tout", "daily", "pc", "mobile", "log_points","fidelity", "dev"]
 | 
				
			||||||
@@ -814,10 +749,10 @@ def CustomStart(Credentials):
 | 
				
			|||||||
    START_TIME = time() # Reset timer to the start of the actions
 | 
					    START_TIME = time() # Reset timer to the start of the actions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for cred in liste:
 | 
					    for cred in liste:
 | 
				
			||||||
        _mail = cred[0]
 | 
					        g._mail = cred[0]
 | 
				
			||||||
        _password = cred[1]
 | 
					        g._password = cred[1]
 | 
				
			||||||
        if len(cred) == 3:
 | 
					        if len(cred) == 3:
 | 
				
			||||||
            _otp = TOTP(cred[2])
 | 
					            g._otp = TOTP(cred[2])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        driver = firefox_driver()
 | 
					        driver = firefox_driver()
 | 
				
			||||||
        driver.implicitly_wait(3)
 | 
					        driver.implicitly_wait(3)
 | 
				
			||||||
@@ -853,7 +788,7 @@ def CustomStart(Credentials):
 | 
				
			|||||||
                    break
 | 
					                    break
 | 
				
			||||||
            if not "tout" in Actions:
 | 
					            if not "tout" in Actions:
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    log_points(_mail)
 | 
					                    log_points(g._mail)
 | 
				
			||||||
                except Exception as e:
 | 
					                except Exception as e:
 | 
				
			||||||
                    printf(f"CustomStart {e}")
 | 
					                    printf(f"CustomStart {e}")
 | 
				
			||||||
            driver.close()
 | 
					            driver.close()
 | 
				
			||||||
@@ -869,7 +804,7 @@ display.start()
 | 
				
			|||||||
if CUSTOM_START:
 | 
					if CUSTOM_START:
 | 
				
			||||||
        CustomStart(Credentials)
 | 
					        CustomStart(Credentials)
 | 
				
			||||||
elif UNBAN:
 | 
					elif UNBAN:
 | 
				
			||||||
    _mail, _password  = select_accounts(False)[0]
 | 
					    g._mail, g._password  = select_accounts(False)[0]
 | 
				
			||||||
    driver = firefox_driver()
 | 
					    driver = firefox_driver()
 | 
				
			||||||
    try : 
 | 
					    try : 
 | 
				
			||||||
        login(driver)
 | 
					        login(driver)
 | 
				
			||||||
@@ -884,12 +819,10 @@ else:
 | 
				
			|||||||
        if DISCORD_ENABLED_ERROR:
 | 
					        if DISCORD_ENABLED_ERROR:
 | 
				
			||||||
            webhookFailure.send(f"Updated to {UPDATE_VERSION}", username="UPDATE", avatar_url="https://cdn-icons-png.flaticon.com/512/1688/1688988.png")
 | 
					            webhookFailure.send(f"Updated to {UPDATE_VERSION}", username="UPDATE", avatar_url="https://cdn-icons-png.flaticon.com/512/1688/1688988.png")
 | 
				
			||||||
    for cred in Credentials:
 | 
					    for cred in Credentials:
 | 
				
			||||||
        _mail = cred[0]
 | 
					        g._mail = cred[0]
 | 
				
			||||||
        _password = cred[1]
 | 
					        g._password = cred[1]
 | 
				
			||||||
        if len(cred) == 3:
 | 
					        if len(cred) == 3:
 | 
				
			||||||
            _otp = TOTP(cred[2])
 | 
					            g._otp = TOTP(cred[2])
 | 
				
			||||||
        printf("\n\n")
 | 
					 | 
				
			||||||
        printf(_mail)
 | 
					 | 
				
			||||||
        custom_sleep(1)
 | 
					        custom_sleep(1)
 | 
				
			||||||
        printf("Début du driver.")
 | 
					        printf("Début du driver.")
 | 
				
			||||||
        driver = firefox_driver()
 | 
					        driver = firefox_driver()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
from modules.imports import *
 | 
					from modules.imports import *
 | 
				
			||||||
from modules.config import *
 | 
					from modules.config import *
 | 
				
			||||||
 | 
					import modules.globals as g
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def setup_proxy(ip, port, options, socks=False) :
 | 
					def setup_proxy(ip, port, options, socks=False) :
 | 
				
			||||||
    PROXY = f"{ip}:{port}"
 | 
					    PROXY = f"{ip}:{port}"
 | 
				
			||||||
@@ -25,12 +25,12 @@ def rgpd_popup(driver) -> None:
 | 
				
			|||||||
            pass
 | 
					            pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# save webdriver cookies
 | 
					# save webdriver cookies
 | 
				
			||||||
def save_cookies(driver, _mail):
 | 
					def save_cookies(driver):
 | 
				
			||||||
    pickle.dump(driver.get_cookies(), open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{_mail}.pkl", "wb"))
 | 
					    pickle.dump(driver.get_cookies(), open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{g._mail}.pkl", "wb"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# load cookies previously saved to the driver
 | 
					# load cookies previously saved to the driver
 | 
				
			||||||
def load_cookies(driver, _mail):
 | 
					def load_cookies(driver):
 | 
				
			||||||
    cookies = pickle.load(open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{_mail}.pkl", "rb"))
 | 
					    cookies = pickle.load(open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{g._mail}.pkl", "rb"))
 | 
				
			||||||
    for cookie in cookies:
 | 
					    for cookie in cookies:
 | 
				
			||||||
        driver.add_cookie(cookie)
 | 
					        driver.add_cookie(cookie)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -52,6 +52,8 @@ def send_keys_wait(element, keys):
 | 
				
			|||||||
def wait_until_visible(search_by: str, identifier: str, timeout = 20, browser = None) -> None:
 | 
					def wait_until_visible(search_by: str, identifier: str, timeout = 20, browser = None) -> None:
 | 
				
			||||||
    try :
 | 
					    try :
 | 
				
			||||||
        WebDriverWait(browser, timeout).until(EC.visibility_of_element_located((search_by,identifier)), "element not found")
 | 
					        WebDriverWait(browser, timeout).until(EC.visibility_of_element_located((search_by,identifier)), "element not found")
 | 
				
			||||||
 | 
					        return(True)
 | 
				
			||||||
    except TimeoutException as e:
 | 
					    except TimeoutException as e:
 | 
				
			||||||
        print(f"element not found after {timeout}s")
 | 
					        print(f"element not found after {timeout}s")
 | 
				
			||||||
 | 
					        return(False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								modules/globals.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								modules/globals.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					driver = None
 | 
				
			||||||
 | 
					_mail = '_mail temp'
 | 
				
			||||||
 | 
					_password = '_password temp'
 | 
				
			||||||
 | 
					_otp = '_otp temp'
 | 
				
			||||||
 | 
					display = None
 | 
				
			||||||
@@ -1,18 +1,22 @@
 | 
				
			|||||||
from modules.imports import *
 | 
					from modules.imports import *
 | 
				
			||||||
from modules.config import *
 | 
					from modules.config import *
 | 
				
			||||||
 | 
					import modules.globals as g
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# add the time arround the text given in [text]&
 | 
					# add the time arround the text given in [text]&
 | 
				
			||||||
def Timer(text: str, mail: str) -> str:
 | 
					def Timer(text: str) -> str:
 | 
				
			||||||
    return(f"[{mail.split('@')[0]} - {datetime.today().strftime('%d/%m')} - {timedelta(seconds = round(float(time() - START_TIME)))}] " + str(text))
 | 
					    return(f"[{g._mail.split('@')[0]} - {datetime.today().strftime('%d/%m')} - {timedelta(seconds = round(float(time() - START_TIME)))}] " + str(text))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# replace the function print, with more options
 | 
					# replace the function print, with more options
 | 
				
			||||||
# [txt] : string, [driver] : selenium webdriver
 | 
					# [txt] : string, [driver] : selenium webdriver
 | 
				
			||||||
def printf2(txt, mail, LOG = LOG):
 | 
					def printf(txt):
 | 
				
			||||||
    print(Timer(txt, mail))
 | 
					    print(Timer(txt))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# return current page domain
 | 
				
			||||||
 | 
					def get_domain(driver):
 | 
				
			||||||
 | 
					    return(driver.current_url.split("/")[2])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
# check if the user is using IPV4 using ipify.org
 | 
					# check if the user is using IPV4 using ipify.org
 | 
				
			||||||
# [driver] : selenium webdriver
 | 
					# [driver] : selenium webdriver
 | 
				
			||||||
@@ -26,7 +30,6 @@ def check_ipv4(driver):
 | 
				
			|||||||
    return False
 | 
					    return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
def custom_sleep(temps):
 | 
					def custom_sleep(temps):
 | 
				
			||||||
    try : 
 | 
					    try : 
 | 
				
			||||||
        if FAST and temps > 50:
 | 
					        if FAST and temps > 50:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user