told ya
This commit is contained in:
parent
339775bdf4
commit
098b934e96
45
V5.py
45
V5.py
|
@ -22,6 +22,37 @@ def printf(e, f = ""):
|
|||
custom_sleep = CustomSleep
|
||||
|
||||
|
||||
# create a webdriver
|
||||
def firefox_driver(mobile=False, headless=False):
|
||||
PC_USER_AGENT = (
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko)"
|
||||
"Chrome/112.0.0.0 Safari/537.36 Edg/110.0.1587.56")
|
||||
MOBILE_USER_AGENT = (
|
||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X)"
|
||||
"AppleWebKit/605.1.15 (KHTML, like Gecko)"
|
||||
"CriOS/107.0.5060.63 Mobile/15E148 Safari/604.1"
|
||||
)
|
||||
options = Options()
|
||||
options.set_preference('intl.accept_languages', 'fr-FR, fr')
|
||||
if proxy_enabled :
|
||||
setup_proxy(proxy_address,proxy_port, options)
|
||||
options.set_preference("browser.link.open_newwindow", 3)
|
||||
if FAST :
|
||||
options.set_preference("permissions.default.image", 2) #disable image loading. You shouldn't use it except if really nessecary
|
||||
if headless:
|
||||
options.add_argument("-headless")
|
||||
if mobile :
|
||||
options.set_preference("general.useragent.override", MOBILE_USER_AGENT)
|
||||
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 ?
|
||||
else :
|
||||
options.set_preference("general.useragent.override", PC_USER_AGENT)
|
||||
driver = webdriver.Firefox(options=options)
|
||||
driver.set_window_size(1900 + hash(_mail)%20 , 1070 + hash(_password + "salt")%10)
|
||||
return(driver)
|
||||
|
||||
|
||||
def log_error(error, ldriver=driver, log=FULL_LOG):
|
||||
global driver
|
||||
if ldriver is None:
|
||||
|
@ -38,22 +69,22 @@ def log_error(error, ldriver=driver, log=FULL_LOG):
|
|||
except :
|
||||
ldriver.save_screenshot("screenshot.png")
|
||||
if not log:
|
||||
embed = discord.Embed(
|
||||
embed = Embed(
|
||||
title="An Error has occured",
|
||||
description=str(error),
|
||||
colour=Colour.red(),
|
||||
)
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
embed = Embed(
|
||||
title="Full log is enabled",
|
||||
description=str(error),
|
||||
colour=Colour.blue(),
|
||||
)
|
||||
file = discord.File("screenshot.png")
|
||||
file = File("screenshot.png")
|
||||
embed.set_image(url="attachment://screenshot.png")
|
||||
embed.set_footer(text=_mail)
|
||||
webhookFailure.send(embed=embed, file=file)
|
||||
webhookFailure.send(file=discord.File("page.html"))
|
||||
webhookFailure.send(file=File("page.html"))
|
||||
|
||||
|
||||
|
||||
|
@ -383,7 +414,7 @@ def login(ldriver):
|
|||
if ('Abuse' in ldriver.current_url) :
|
||||
log_error("account suspended")
|
||||
raise Banned()
|
||||
save_cookies(driver)
|
||||
save_cookies(driver, _mail)
|
||||
for id in ["KmsiCheckboxField","iLooksGood", "idSIButton9", "iCancel"]:
|
||||
try:
|
||||
ldriver.find_element(By.ID, id).click()
|
||||
|
@ -418,7 +449,7 @@ def login(ldriver):
|
|||
def cookie_login():
|
||||
ldriver.get("https://login.live.com")
|
||||
try :
|
||||
load_cookies(ldriver)
|
||||
load_cookies(ldriver, _mail)
|
||||
except FileNotFoundError :
|
||||
print("Creating cookies file")
|
||||
return(False)
|
||||
|
@ -562,7 +593,7 @@ def log_points(account="unknown"):
|
|||
|
||||
if DISCORD_ENABLED_SUCCESS:
|
||||
if DISCORD_EMBED:
|
||||
embed = discord.Embed(
|
||||
embed = Embed(
|
||||
title=f"{account_name} actuellement à {str(points)} points", colour=Colour.green()
|
||||
)
|
||||
embed.set_footer(text=account_name)
|
||||
|
|
|
@ -1,36 +1,7 @@
|
|||
from modules.imports import *
|
||||
from modules.config import *
|
||||
|
||||
|
||||
# create a webdriver
|
||||
def firefox_driver(mobile=False, headless=False):
|
||||
PC_USER_AGENT = (
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko)"
|
||||
"Chrome/112.0.0.0 Safari/537.36 Edg/110.0.1587.56")
|
||||
MOBILE_USER_AGENT = (
|
||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X)"
|
||||
"AppleWebKit/605.1.15 (KHTML, like Gecko)"
|
||||
"CriOS/107.0.5060.63 Mobile/15E148 Safari/604.1"
|
||||
)
|
||||
options = Options()
|
||||
options.set_preference('intl.accept_languages', 'fr-FR, fr')
|
||||
if proxy_enabled :
|
||||
setup_proxy(proxy_address,proxy_port, options)
|
||||
options.set_preference("browser.link.open_newwindow", 3)
|
||||
if FAST :
|
||||
options.set_preference("permissions.default.image", 2) #disable image loading. You shouldn't use it except if really nessecary
|
||||
if headless:
|
||||
options.add_argument("-headless")
|
||||
if mobile :
|
||||
options.set_preference("general.useragent.override", MOBILE_USER_AGENT)
|
||||
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 ?
|
||||
else :
|
||||
options.set_preference("general.useragent.override", PC_USER_AGENT)
|
||||
driver = webdriver.Firefox(options=options)
|
||||
driver.set_window_size(1900 + hash(_mail)%20 , 1070 + hash(_password + "salt")%10)
|
||||
return(driver)
|
||||
|
||||
def setup_proxy(ip, port, options, socks=False) :
|
||||
PROXY = f"{ip}:{port}"
|
||||
if socks :
|
||||
|
@ -54,12 +25,12 @@ def rgpd_popup(driver) -> None:
|
|||
pass
|
||||
|
||||
# save webdriver cookies
|
||||
def save_cookies():
|
||||
pickle.dump(driver.get_cookies(), open(f"{'/'.join(__file__.split('/')[:-1])}/user_data/cookies/{_mail}.pkl", "wb"))
|
||||
def save_cookies(driver, _mail):
|
||||
pickle.dump(driver.get_cookies(), open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{_mail}.pkl", "wb"))
|
||||
|
||||
# load cookies previously saved to the driver
|
||||
def load_cookies(driver):
|
||||
cookies = pickle.load(open(f"{'/'.join(__file__.split('/')[:-1])}/user_data/cookies/{_mail}.pkl", "rb"))
|
||||
def load_cookies(driver, _mail):
|
||||
cookies = pickle.load(open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{_mail}.pkl", "rb"))
|
||||
for cookie in cookies:
|
||||
driver.add_cookie(cookie)
|
||||
|
||||
|
@ -78,7 +49,7 @@ def send_keys_wait(element, keys):
|
|||
|
||||
|
||||
# Wait for the presence of the element identifier or [timeout]s
|
||||
def wait_until_visible(search_by: str, identifier: str, timeout = 20, browser = driver) -> None:
|
||||
def wait_until_visible(search_by: str, identifier: str, timeout = 20, browser = None) -> None:
|
||||
try :
|
||||
WebDriverWait(browser, timeout).until(EC.visibility_of_element_located((search_by,identifier)), "element not found")
|
||||
except TimeoutException as e:
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from selenium.common.exceptions import TimeoutException, NoSuchElementException, ElementClickInterceptedException
|
||||
|
||||
class Banned(Exception):
|
||||
pass
|
||||
|
||||
|
|
|
@ -8,15 +8,17 @@ from time import sleep
|
|||
from requests import get
|
||||
from selenium import webdriver
|
||||
from selenium.common import exceptions
|
||||
from selenium.common.exceptions import WebDriverException
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.firefox.options import Options
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.common.exceptions import WebDriverException, TimeoutException, NoSuchElementException, ElementClickInterceptedException
|
||||
|
||||
from pyotp import TOTP
|
||||
from pyvirtualdisplay import Display
|
||||
from pyvirtualdisplay.smartdisplay import SmartDisplay
|
||||
import pickle
|
||||
from datetime import timedelta, datetime
|
||||
from discord import Embed, Colour, File
|
Loading…
Reference in New Issue