ptite update
This commit is contained in:
parent
710c272659
commit
ed1e91b304
48
V5.py
48
V5.py
|
@ -212,16 +212,24 @@ def do_poll():
|
||||||
|
|
||||||
def all_cards():
|
def all_cards():
|
||||||
driver.get("https://rewards.bing.com")
|
driver.get("https://rewards.bing.com")
|
||||||
|
wait_until_visible(By.CLASS_NAME, "c-card-content", 10, driver)
|
||||||
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
liste = driver.find_elements(By.CLASS_NAME, "c-card-content")
|
||||||
custom_sleep(2)
|
custom_sleep(2)
|
||||||
|
if "welcometour" in driver.current_url:
|
||||||
|
welcome_tour_NO(driver)
|
||||||
try :
|
try :
|
||||||
promo()
|
promo()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
printf("no promo card")
|
printf("no promo card")
|
||||||
|
if(len(liste) < 10):
|
||||||
|
log_error("moins de 10 cartes", driver)
|
||||||
|
if (len(liste) < 20):
|
||||||
|
if not g.norvege :
|
||||||
|
g.norvege = True
|
||||||
|
printf("moins de 20 cartes, disabling fidelity")
|
||||||
|
g.fidelity_link = "Disabled because norway"
|
||||||
|
log_error("Verifying if Norway", driver, True)
|
||||||
for i in range(len(liste)):
|
for i in range(len(liste)):
|
||||||
if(len(liste) < 20):
|
|
||||||
log_error("moins de 20 cartes", driver)
|
|
||||||
printf(f"carte {i}")
|
printf(f"carte {i}")
|
||||||
try :
|
try :
|
||||||
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
checked = ("mee-icon-AddMedium" in liste[i].get_attribute("innerHTML"))
|
||||||
|
@ -258,8 +266,8 @@ def all_cards():
|
||||||
try :
|
try :
|
||||||
welcome_tour(liste[i], driver)
|
welcome_tour(liste[i], driver)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(format_error(e))
|
printf("no new windows" + format_error(e))
|
||||||
log_error("no new windows", driver)
|
driver.get("https://rewards.bing.com")
|
||||||
custom_sleep(3)
|
custom_sleep(3)
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,7 +390,12 @@ def cookie_login(ldriver):
|
||||||
except FileNotFoundError :
|
except FileNotFoundError :
|
||||||
printf("No cookies file Found.")
|
printf("No cookies file Found.")
|
||||||
return(False)
|
return(False)
|
||||||
ldriver.refresh()
|
try :
|
||||||
|
ldriver.refresh()
|
||||||
|
except Exception as e:
|
||||||
|
printf(format_error(e))
|
||||||
|
printf("FIX YOUR SITE MS.......")
|
||||||
|
|
||||||
return(True)
|
return(True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -402,18 +415,18 @@ def login_part_2(ldriver, cookies = False):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 20, ldriver)
|
wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 20, ldriver)
|
||||||
ldriver.get("https://www.bing.com")
|
ldriver.get("https://www.bing.com/?setlang=fr&cc=fr&cc=FR")
|
||||||
rgpd_popup(ldriver)
|
rgpd_popup(ldriver)
|
||||||
ldriver.refresh()
|
ldriver.refresh()
|
||||||
rgpd_popup(ldriver)
|
rgpd_popup(ldriver)
|
||||||
ldriver.get("https://account.microsoft.com/")
|
#ldriver.get("https://account.microsoft.com/")
|
||||||
if wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 30, ldriver) :
|
#if wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 30, ldriver) :
|
||||||
return(True) #the account logging was successful
|
# return(True) #the account logging was successful
|
||||||
else :
|
#else :
|
||||||
log_error("Error during login. Trying to refresh")
|
# log_error("Error during login. Trying to refresh")
|
||||||
ldriver.refresh()
|
# ldriver.refresh()
|
||||||
return(wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 30, ldriver))
|
# return(wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-home"]', 30, ldriver))
|
||||||
|
# useless ?
|
||||||
|
|
||||||
# login() tries to login to your Microsoft account.
|
# login() tries to login to your Microsoft account.
|
||||||
# it uses global variable g._mail and g._password to login
|
# it uses global variable g._mail and g._password to login
|
||||||
|
@ -659,7 +672,7 @@ def daily_routine(custom = False):
|
||||||
if not custom: # custom already login
|
if not custom: # custom already login
|
||||||
login(driver)
|
login(driver)
|
||||||
except Banned :
|
except Banned :
|
||||||
log_error("THIS ACCOUNT IS BANNED. FIX THIS ISSUE WITH -U")
|
log_error("This account is locked. Fix that. (-U ?)", driver)
|
||||||
return()
|
return()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -676,13 +689,12 @@ def daily_routine(custom = False):
|
||||||
bing_pc_search()
|
bing_pc_search()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bing_mobile_search()
|
bing_mobile_search()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
log_points(g._mail)
|
log_points(g._mail)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
from easyprocess import EasyProcess
|
|
||||||
from pyvirtualdisplay import Display
|
|
||||||
from modules.config import *
|
|
||||||
from selenium import webdriver
|
|
||||||
from selenium.common import exceptions
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
def setup_proxy(ip, port, options, socks=False) :
|
|
||||||
PROXY = f"{ip}:{port}"
|
|
||||||
if socks :
|
|
||||||
options.set_preference('network.proxy.type', 1)
|
|
||||||
options.set_preference('network.proxy.socks', ip)
|
|
||||||
options.set_preference('network.proxy.socks_port', int(port))
|
|
||||||
options.set_preference("browser.link.open_newwindow", 3)
|
|
||||||
else :
|
|
||||||
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
|
|
||||||
"httpProxy": PROXY,
|
|
||||||
"sslProxy": PROXY,
|
|
||||||
"proxyType": "MANUAL",
|
|
||||||
}
|
|
||||||
|
|
||||||
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/110.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/103.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. May add this without the fast option soon
|
|
||||||
if Headless:
|
|
||||||
options.add_argument("-headless")
|
|
||||||
if mobile :
|
|
||||||
options.set_preference("general.useragent.override", MOBILE_USER_AGENT)
|
|
||||||
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 select_accounts(multiple = True):
|
|
||||||
system("clear") # clear from previous command to allow a clean choice
|
|
||||||
emails = [x[0] for x in Credentials] # list of all email adresses
|
|
||||||
emails_selected = enquiries.choose(f"quel{'s' if multiple else ''} compte{'s' if multiple else ''} ?", emails, multi=multiple)
|
|
||||||
return([x for x in Credentials if x[0] in emails_selected])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
with Display(backend="xvnc", size=(2000, 1000), rfbport=5904) as disp:
|
|
||||||
_mail, _password = select_accounts(False)[0]
|
|
||||||
driver = firefox_driver()
|
|
||||||
print(f"connect via VNC to port 5904. \nID: {_mail}\npwd : {_password}")
|
|
||||||
i = input('stop ? ')
|
|
||||||
driver.close()
|
|
|
@ -18,6 +18,14 @@ def welcome_tour(elm, driver):
|
||||||
sleep(5)
|
sleep(5)
|
||||||
driver.find_element(By.CSS_SELECTOR, '[class="c-glyph glyph-cancel"]').click()
|
driver.find_element(By.CSS_SELECTOR, '[class="c-glyph glyph-cancel"]').click()
|
||||||
|
|
||||||
|
def welcome_tour_NO(driver):
|
||||||
|
try :
|
||||||
|
driver.find_element(By.CSS_SELECTOR, '[class="welcome-tour-next-button c-call-to-action c-glyph"]').click()
|
||||||
|
except :
|
||||||
|
pass
|
||||||
|
driver.find_element(By.CSS_SELECTOR, '[class="c-glyph glyph-cancel"]').click()
|
||||||
|
sleep(5)
|
||||||
|
|
||||||
|
|
||||||
def spotify(driver):
|
def spotify(driver):
|
||||||
sleep(5)
|
sleep(5)
|
||||||
|
|
|
@ -69,12 +69,22 @@ parser.add_argument(
|
||||||
dest="update_version",
|
dest="update_version",
|
||||||
default="None"
|
default="None"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--dev",
|
||||||
|
help="dev option",
|
||||||
|
dest="dev",
|
||||||
|
action="store_true"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
g.custom_start = args.override
|
g.custom_start = args.override
|
||||||
g.unban = args.unban
|
g.unban = args.unban
|
||||||
g.log = args.log
|
g.log = args.log
|
||||||
g.full_log = args.fulllog
|
g.full_log = args.fulllog
|
||||||
|
g.dev = args.dev
|
||||||
|
|
||||||
if g.custom_start :
|
if g.custom_start :
|
||||||
g.log = True
|
g.log = True
|
||||||
|
|
|
@ -21,11 +21,23 @@ def rgpd_popup(driver) -> None:
|
||||||
|
|
||||||
# save webdriver cookies
|
# save webdriver cookies
|
||||||
def save_cookies(driver):
|
def save_cookies(driver):
|
||||||
pickle.dump(driver.get_cookies(), open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{g._mail}.pkl", "wb"))
|
if g.dev:
|
||||||
|
f = open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{g._mail}_unsafe.pkl", "w")
|
||||||
|
for i in driver.get_cookies():
|
||||||
|
f.write(str(i) + "\n")
|
||||||
|
f.close()
|
||||||
|
else :
|
||||||
|
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):
|
def load_cookies(driver):
|
||||||
cookies = pickle.load(open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{g._mail}.pkl", "rb"))
|
if g.dev:
|
||||||
|
f = open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{g._mail}_unsafe.pkl", "r")
|
||||||
|
lines = f.readlines()
|
||||||
|
f.close()
|
||||||
|
cookies = [literal_eval(x) for x in lines]
|
||||||
|
else :
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,6 @@ sql_enabled = False
|
||||||
sql_usr = "None"
|
sql_usr = "None"
|
||||||
sql_pwd = "azerty"
|
sql_pwd = "azerty"
|
||||||
sql_host = "https://example.com"
|
sql_host = "https://example.com"
|
||||||
sql_database = "MsRewards"
|
sql_database = "MsRewards"
|
||||||
|
dev = False
|
||||||
|
norvege = False
|
|
@ -26,7 +26,8 @@ from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.firefox.options import Options
|
from selenium.webdriver.firefox.options import Options
|
||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||||
|
from ast import literal_eval
|
||||||
try:
|
try:
|
||||||
import enquiries
|
import enquiries
|
||||||
except:
|
except:
|
||||||
system("") # enable colors in windows cmd
|
system("") # enable colors in windows cmd
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from modules.imports import *
|
from modules.imports import *
|
||||||
from modules.config import *
|
from modules.config import *
|
||||||
|
from modules.db import *
|
||||||
import modules.globals as g
|
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) -> str:
|
def Timer(text: str) -> str:
|
||||||
|
@ -64,13 +65,11 @@ def progressBar(current, total=30, barLength=20, name="Progress"):
|
||||||
|
|
||||||
def save_points_from_file(file):
|
def save_points_from_file(file):
|
||||||
with open(file) as f:
|
with open(file) as f:
|
||||||
reader = csv.reader(f)
|
read = reader(f)
|
||||||
points_list = list(reader)
|
points_list = list(read)
|
||||||
|
|
||||||
for item in points_list:
|
for item in points_list:
|
||||||
compte, points = item[0], item[1]
|
compte, points = item[0], item[1]
|
||||||
add_to_database(compte, points, sql_host,sql_usr,sql_pwd,sql_database, save_if_fail=False)
|
add_to_database(compte, points, g.sql_host,g.sql_usr,g.sql_pwd,g.sql_database, save_if_fail=False)
|
||||||
|
|
||||||
with open(file, "w") as f:
|
with open(file, "w") as f:
|
||||||
f.write("")
|
f.write("")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue