custom error + better code + some things
This commit is contained in:
parent
945497c1d4
commit
c9aa75e61c
157
V4.py
157
V4.py
|
@ -19,6 +19,7 @@ from selenium.common.exceptions import TimeoutException, NoSuchElementException
|
||||||
from modules.db import add_to_database
|
from modules.db import add_to_database
|
||||||
from modules.config import *
|
from modules.config import *
|
||||||
from modules.tools import *
|
from modules.tools import *
|
||||||
|
from modules.error import *
|
||||||
|
|
||||||
global driver
|
global driver
|
||||||
|
|
||||||
|
@ -126,18 +127,11 @@ def Close(fenetre, SwitchTo=0):
|
||||||
|
|
||||||
#Deal with RGPD popup as well as some random popup like 'are you satisfied' one
|
#Deal with RGPD popup as well as some random popup like 'are you satisfied' one
|
||||||
def RGPD():
|
def RGPD():
|
||||||
try:
|
for i in ["bnp_btn_accept", "bnp_hfly_cta2", "bnp_hfly_close"] :
|
||||||
driver.find_element(By.ID, "bnp_btn_accept").click()
|
try:
|
||||||
except:
|
driver.find_element(By.ID, ).click()
|
||||||
pass
|
except:
|
||||||
try:
|
pass
|
||||||
driver.find_element(By.ID, "bnp_hfly_cta2").click()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try :
|
|
||||||
driver.find_element(By.id, "bnp_hfly_close").click() #are you satisfied popup
|
|
||||||
except :
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -373,16 +367,16 @@ it uses global variable _mail and _password to login
|
||||||
"""
|
"""
|
||||||
def login():
|
def login():
|
||||||
global driver
|
global driver
|
||||||
def sub_login():
|
def sub_login():
|
||||||
printf("sublogin : start")
|
printf("sublogin : start")
|
||||||
driver.get("https://www.bing.com/rewardsapp/flyout")
|
driver.get("https://www.bing.com/rewardsapp/flyout")
|
||||||
try:
|
for i in [f'[title="Rejoindre"]', f'[title="Join now"]', f'[title="Rejoindre maintenant"]'] :
|
||||||
driver.find_element(By.CSS_SELECTOR, f'[title="Rejoindre"]').click() # depend of the language of the page
|
try:
|
||||||
except:
|
driver.find_element(By.CSS_SELECTOR, i).click() # depend of the language of the page
|
||||||
try :
|
break
|
||||||
driver.find_element(By.CSS_SELECTOR, f'[title="Join now"]').click() # depend of the language of the page
|
except:
|
||||||
except :
|
pass
|
||||||
raise ValueError('already logged in')
|
|
||||||
|
|
||||||
WaitUntilVisible(By.ID, "i0116", browser = driver)
|
WaitUntilVisible(By.ID, "i0116", browser = driver)
|
||||||
mail = driver.find_element(By.ID, "i0116")
|
mail = driver.find_element(By.ID, "i0116")
|
||||||
|
@ -393,6 +387,12 @@ def login():
|
||||||
send_keys_wait(pwd, _password)
|
send_keys_wait(pwd, _password)
|
||||||
pwd.send_keys(Keys.ENTER)
|
pwd.send_keys(Keys.ENTER)
|
||||||
CustomSleep(5)
|
CustomSleep(5)
|
||||||
|
|
||||||
|
if ('Abuse' in driver.current_url) :
|
||||||
|
LogError("account suspended", driver, _mail)
|
||||||
|
raise Banned()
|
||||||
|
|
||||||
|
|
||||||
for i in ["KmsiCheckboxField","iLooksGood", "idSIButton9", "iCancel"]:
|
for i in ["KmsiCheckboxField","iLooksGood", "idSIButton9", "iCancel"]:
|
||||||
try:
|
try:
|
||||||
driver.find_element(By.ID, i).click()
|
driver.find_element(By.ID, i).click()
|
||||||
|
@ -413,6 +413,8 @@ def login():
|
||||||
try :
|
try :
|
||||||
sub_login()
|
sub_login()
|
||||||
return (driver.current_window_handle)
|
return (driver.current_window_handle)
|
||||||
|
except Banned:
|
||||||
|
raise Banned()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LogError("login - 3 - " + str(e), driver, _mail)
|
LogError("login - 3 - " + str(e), driver, _mail)
|
||||||
driver.close()
|
driver.close()
|
||||||
|
@ -464,7 +466,29 @@ def BingPcSearch(override=randint(35, 40)):
|
||||||
print("\n\n")
|
print("\n\n")
|
||||||
|
|
||||||
|
|
||||||
|
def unban():
|
||||||
|
driver.find_element(By.ID, "StartAction").click()
|
||||||
|
txt = driver.page_source
|
||||||
|
uuid1 = findall('wlspispHIPPhoneInput([a-z0-9]+)', txt)[0]
|
||||||
|
uuid2 = findall('wlspispHipSendCode([a-z0-9]+)', txt)[0]
|
||||||
|
uuid3 = findall('wlspispSolutionElement([a-z0-9]+)', txt)[0]
|
||||||
|
phone = input("entrez le numero de téléphone : +33")
|
||||||
|
WaitUntilVisible(By.ID, "wlspispHIPPhoneInput" + uuid1)
|
||||||
|
phone_box = driver.find_element(By.ID, "wlspispHIPPhoneInput" + uuid1)
|
||||||
|
phone_box.send_keys(phone)
|
||||||
|
WaitUntilVisible(By.ID, "wlspispHipSendCode" + uuid2)
|
||||||
|
send_link = driver.find_element(By.ID, "wlspispHipSendCode" + uuid2)
|
||||||
|
send_link.click()
|
||||||
|
WaitUntilVisible(By.ID, "wlspispSolutionElement" + uuid3)
|
||||||
|
answer_box = driver.find_element(By.ID, "wlspispSolutionElement" + uuid3)
|
||||||
|
answer = input("entrez le contenu du msg : ")
|
||||||
|
answer_box.send_keys(answer)
|
||||||
|
send_box = driver.find_element(By.ID, "ProofAction")
|
||||||
|
send_box.click()
|
||||||
|
WaitUntilVisible(By.ID, "FinishAction")
|
||||||
|
continue_box = driver.find_element(By.ID, "FinishAction")
|
||||||
|
continue_box.click()
|
||||||
|
|
||||||
|
|
||||||
def TryPlay(nom="inconnu"):
|
def TryPlay(nom="inconnu"):
|
||||||
RGPD()
|
RGPD()
|
||||||
|
@ -699,6 +723,7 @@ def Mlogin(echec):
|
||||||
MobileDriver.quit()
|
MobileDriver.quit()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def MRGPD():
|
def MRGPD():
|
||||||
try:
|
try:
|
||||||
MobileDriver.find_element(By.ID, "bnp_btn_accept").click()
|
MobileDriver.find_element(By.ID, "bnp_btn_accept").click()
|
||||||
|
@ -709,6 +734,7 @@ def MRGPD():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def Alerte():
|
def Alerte():
|
||||||
try:
|
try:
|
||||||
alert = MobileDriver.switch_to.alert
|
alert = MobileDriver.switch_to.alert
|
||||||
|
@ -760,40 +786,37 @@ def BingMobileSearch(override=randint(22, 25)):
|
||||||
|
|
||||||
|
|
||||||
def DailyRoutine(custom = False):
|
def DailyRoutine(custom = False):
|
||||||
if not custom :
|
try :
|
||||||
MainWindows = login()
|
login()
|
||||||
else :
|
except Banned :
|
||||||
MainWindows = ""
|
LogError("THIS ACCOUND IS BANNED. FIX THIS ISSUE WITH -U", driver, mail)
|
||||||
|
return()
|
||||||
|
|
||||||
|
try:
|
||||||
|
AllCard()
|
||||||
|
except Exception as e:
|
||||||
|
LogError(f"DailyRoutine - AllCard - \n{e}", driver, _mail)
|
||||||
|
|
||||||
|
try:
|
||||||
|
BingPcSearch()
|
||||||
|
except Exception as e:
|
||||||
|
LogError(f"DailyRoutine - BingPcSearch - \n{e}", driver, _mail)
|
||||||
|
|
||||||
|
try:
|
||||||
|
Fidelite()
|
||||||
|
except Exception as e:
|
||||||
|
LogError(f"DailyRoutine - Fidelité - \n{e}", driver, _mail)
|
||||||
|
|
||||||
if MainWindows != "STOP" :
|
try:
|
||||||
try:
|
BingMobileSearch()
|
||||||
AllCard()
|
except Exception as e:
|
||||||
except Exception as e:
|
LogError(f"DailyRoutine - BingMobileSearch - \n{e}", driver, _mail)
|
||||||
LogError(f"DailyRoutine - AllCard - \n{e}", driver, _mail)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
BingPcSearch()
|
LogPoint(_mail)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LogError(f"DailyRoutine - BingPcSearch - \n{e}", driver, _mail)
|
LogError(f"DailyRoutine - LogPoint - \n{e}", driver, _mail)
|
||||||
CustomSleep(uniform(3, 20))
|
|
||||||
|
|
||||||
try:
|
|
||||||
Fidelite()
|
|
||||||
except Exception as e:
|
|
||||||
LogError(f"DailyRoutine - Fidelité - \n{e}", driver, _mail)
|
|
||||||
|
|
||||||
try:
|
|
||||||
BingMobileSearch()
|
|
||||||
except Exception as e:
|
|
||||||
LogError(f"DailyRoutine - BingMobileSearch - \n{e}", driver, _mail)
|
|
||||||
CustomSleep(uniform(3, 20))
|
|
||||||
|
|
||||||
try:
|
|
||||||
LogPoint(_mail)
|
|
||||||
except Exception as e:
|
|
||||||
LogError(f"DailyRoutine - LogPoint - \n{e}", driver, _mail)
|
|
||||||
else :
|
|
||||||
LogError(f"probleme de login sur le comte {_mail}", driver, _mail)
|
|
||||||
|
|
||||||
|
|
||||||
def close():
|
def close():
|
||||||
|
@ -809,20 +832,14 @@ def CustomStart(Credentials):
|
||||||
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
|
global driver
|
||||||
global _mail
|
global _mail, _password
|
||||||
global _password
|
|
||||||
|
|
||||||
ids = [x[0] for x in Credentials] # list of all email adresses
|
|
||||||
actions = ["tout", "daily", "pc", "mobile", "LogPoint","Fidelite", "dev"]
|
|
||||||
|
|
||||||
system("clear") # clear from previous command to allow a clean choice
|
system("clear") # clear from previous command to allow a clean choice
|
||||||
Comptes = enquiries.choose("quels comptes ?", ids, multi=True)
|
actions = ["tout", "daily", "pc", "mobile", "LogPoint","Fidelite", "dev"]
|
||||||
Actions = enquiries.choose("quels Actions ?", actions, multi=True)
|
Actions = enquiries.choose("quels Actions ?", actions, multi=True)
|
||||||
|
|
||||||
for i in Comptes:
|
for _mail, _password in SelectAccount():
|
||||||
|
|
||||||
_mail = Credentials[ids.index(i)][0]
|
|
||||||
_password = Credentials[ids.index(i)][1]
|
|
||||||
driver = FirefoxDriver()
|
driver = FirefoxDriver()
|
||||||
driver.implicitly_wait(10)
|
driver.implicitly_wait(10)
|
||||||
|
|
||||||
|
@ -869,14 +886,24 @@ def CustomStart(Credentials):
|
||||||
driver.close()
|
driver.close()
|
||||||
|
|
||||||
|
|
||||||
with open(CREDENTIALS_PATH) as f:
|
def SelectAccount(multiple = True):
|
||||||
reader = reader(f)
|
system("clear") # clear from previous command to allow a clean choice
|
||||||
Credentials = list(reader)
|
emails = [x[0] for x in Credentials] # list of all email adresses
|
||||||
|
emailsSelected = enquiries.choose("quels comptes ?", emails, multi=multiple)
|
||||||
|
return([x for x in Credentials if x[0] in emailsSelected])
|
||||||
|
|
||||||
shuffle(Credentials)
|
|
||||||
|
|
||||||
if CUSTOM_START:
|
if CUSTOM_START:
|
||||||
CustomStart(Credentials)
|
CustomStart(Credentials)
|
||||||
|
elif UNBAN:
|
||||||
|
_mail, _password = SelectAccount(False)[0]
|
||||||
|
try :
|
||||||
|
login()
|
||||||
|
raise NotBanned
|
||||||
|
except Banned :
|
||||||
|
unban()
|
||||||
|
except NotBanned :
|
||||||
|
LogError("you are not cureently banned on this account")
|
||||||
else:
|
else:
|
||||||
for _mail, _password in Credentials:
|
for _mail, _password in Credentials:
|
||||||
system("pkill -9 firefox")
|
system("pkill -9 firefox")
|
||||||
|
|
|
@ -18,11 +18,30 @@ Setup for option, like --override or --fulllog
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-o", "--override", help="override", dest="override", action="store_true"
|
"-o",
|
||||||
|
"--override",
|
||||||
|
help="override",
|
||||||
|
dest="override",
|
||||||
|
action="store_true"
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-l", "--log", dest="log", help="enable logging in terminal", action="store_true"
|
"-u",
|
||||||
|
"--unban",
|
||||||
|
help="unban an account",
|
||||||
|
dest="unban",
|
||||||
|
action="store_true"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"-l",
|
||||||
|
"--log",
|
||||||
|
dest="log",
|
||||||
|
help="enable logging in terminal",
|
||||||
|
action="store_true"
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-fl",
|
"-fl",
|
||||||
"--fulllog",
|
"--fulllog",
|
||||||
|
@ -31,15 +50,23 @@ parser.add_argument(
|
||||||
action="store_true",
|
action="store_true",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-r", "--risky", help="make the program faster, probably better risk of ban", dest="fast", action="store_true"
|
"-r",
|
||||||
|
"--risky",
|
||||||
|
help="make the program faster, probably better risk of ban",
|
||||||
|
dest="fast",
|
||||||
|
action="store_true"
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c", "--config", help="Choose a specific config file", type=argparse.FileType('r')
|
"-c",
|
||||||
|
"--config",
|
||||||
|
help="Choose a specific config file",
|
||||||
|
type=argparse.FileType('r')
|
||||||
)
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
CUSTOM_START = args.override
|
CUSTOM_START = args.override
|
||||||
|
UNBAN = args.unban
|
||||||
LOG = args.log
|
LOG = args.log
|
||||||
FULL_LOG = args.fulllog
|
FULL_LOG = args.fulllog
|
||||||
FAST = args.fast
|
FAST = args.fast
|
||||||
|
@ -115,3 +142,7 @@ else :
|
||||||
g.close()
|
g.close()
|
||||||
|
|
||||||
|
|
||||||
|
with open(CREDENTIALS_PATH) as f:
|
||||||
|
reader = reader(f)
|
||||||
|
Credentials = list(reader)
|
||||||
|
shuffle(Credentials)
|
|
@ -0,0 +1,5 @@
|
||||||
|
class Banned(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class NotBanned(Exception):
|
||||||
|
pass
|
|
@ -90,7 +90,6 @@ def CustomSleep(temps):
|
||||||
passe += 0.125
|
passe += 0.125
|
||||||
print(f"{points[i]} - {round(float(temps) - passe, 3)}", end="\r")
|
print(f"{points[i]} - {round(float(temps) - passe, 3)}", end="\r")
|
||||||
print(" ", end="\r")
|
print(" ", end="\r")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
sleep(temps)
|
sleep(temps)
|
||||||
except KeyboardInterrupt :
|
except KeyboardInterrupt :
|
||||||
|
|
Loading…
Reference in New Issue