parent
81deaf05b0
commit
afabd94f0d
42
V6.py
42
V6.py
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python3.10
|
||||
#!/usr/bin/python3
|
||||
from modules.Classes.Config import Config
|
||||
from modules.Classes.DiscordLogger import DiscordLogger
|
||||
from modules.Classes.UserCredentials import UserCredentials
|
||||
|
@ -9,6 +9,7 @@ from modules.db import add_to_database
|
|||
from modules.driver_tools import *
|
||||
from modules.error import *
|
||||
|
||||
import os
|
||||
|
||||
# create a webdriver
|
||||
def create_driver(mobile=False):
|
||||
|
@ -22,14 +23,35 @@ def create_driver(mobile=False):
|
|||
"AppleWebKit/537.36 (KHTML, like Gecko)"
|
||||
"Chrome/22 Mobile Safari/537.36"
|
||||
)
|
||||
chrome_options = webdriver.ChromeOptions()
|
||||
|
||||
# Profile dir
|
||||
chrome_profile_dir = "/app/MsRewards-Reborn/user_data/profile/"+config.UserCredentials.get_mail()
|
||||
os.makedirs(chrome_profile_dir, exist_ok=True)
|
||||
|
||||
# Full list on https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
|
||||
arguments = [
|
||||
"--no-first-run",
|
||||
"--ash-no-nudges",
|
||||
"--no-default-browser-check",
|
||||
"--disable-features=PrivacySandboxSettings4",
|
||||
f"--user-data-dir={chrome_profile_dir}/",
|
||||
"--disable-features=Translate",
|
||||
"--disable-search-engine-choice-screen"
|
||||
]
|
||||
|
||||
if mobile:
|
||||
chrome_options.add_argument(f"--user-agent={mobile_user_agent}")
|
||||
arguments.append(f"--user-agent={mobile_user_agent}")
|
||||
else:
|
||||
chrome_options.add_argument(f"--user-agent={pc_user_agent}")
|
||||
arguments.append(f"--user-agent={pc_user_agent}")
|
||||
|
||||
# disabled as it may cause detection
|
||||
if config.proxy.is_enabled():
|
||||
chrome_options.add_argument(f'--proxy-server={config.proxy.ip}:{config.proxy.port}')
|
||||
arguments.append(f'--proxy-server={config.proxy.ip}:{config.proxy.port}')
|
||||
|
||||
chrome_options = webdriver.ChromeOptions()
|
||||
for arg in arguments:
|
||||
chrome_options.add_argument(arg)
|
||||
|
||||
driver = uc.Chrome(options=chrome_options)
|
||||
set_language(driver)
|
||||
return driver
|
||||
|
@ -192,7 +214,7 @@ def all_cards():
|
|||
info("no promo card")
|
||||
|
||||
if len(card_list) < 10: # most likely an error during loading
|
||||
if "suspendu" in driver.page_source:
|
||||
if "suspendu" in driver.page_source or "suspended" in driver.page_source:
|
||||
raise Banned()
|
||||
driver.refresh()
|
||||
card_list = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||
|
@ -412,8 +434,16 @@ def login_part_2():
|
|||
# login() tries to login to your Microsoft account.
|
||||
# it uses global variable g._mail and g._password to login
|
||||
def login():
|
||||
def logged_in():
|
||||
driver.get("https://login.live.com")
|
||||
custom_sleep(10)
|
||||
if get_domain(driver) == "account.microsoft.com":
|
||||
return True
|
||||
return False
|
||||
|
||||
driver = config.WebDriver.driver
|
||||
try:
|
||||
if not logged_in():
|
||||
login_part_1()
|
||||
login_part_2()
|
||||
driver.get("https://rewards.bing.com/")
|
||||
|
|
Loading…
Reference in New Issue