work first try ? POG
This commit is contained in:
parent
b8690dfd05
commit
fd7feebca5
96
V4.py
96
V4.py
|
@ -7,12 +7,12 @@ from random import choice, randint, shuffle, uniform
|
||||||
from re import findall, search
|
from re import findall, search
|
||||||
from sys import platform
|
from sys import platform
|
||||||
from time import sleep, time
|
from time import sleep, time
|
||||||
|
from tkinter import EXCEPTION
|
||||||
from requests import get
|
from requests import get
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import discord
|
import discord
|
||||||
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
|
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
|
||||||
Colour,
|
Colour,
|
||||||
Embed,
|
|
||||||
RequestsWebhookAdapter,
|
RequestsWebhookAdapter,
|
||||||
Webhook,
|
Webhook,
|
||||||
)
|
)
|
||||||
|
@ -65,7 +65,7 @@ if CUSTOM_START :
|
||||||
gloabal variables used later in the code
|
gloabal variables used later in the code
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LINUX_HOST = platform == "linux"
|
LINUX_HOST = platform == "linux" #if the computer running this programm is linux, it allow more things
|
||||||
START_TIME = time()
|
START_TIME = time()
|
||||||
|
|
||||||
global driver
|
global driver
|
||||||
|
@ -75,42 +75,49 @@ driver = None
|
||||||
if LINUX_HOST:
|
if LINUX_HOST:
|
||||||
import enquiries
|
import enquiries
|
||||||
else:
|
else:
|
||||||
system("") # enable colors in cmd
|
system("") # enable colors in windows cmd
|
||||||
|
|
||||||
|
#reading configuration
|
||||||
config_path = f"{path.abspath( path.dirname( __file__ ) )}/config"
|
config_path = f"{path.abspath( path.dirname( __file__ ) )}/config"
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(config_path)
|
config.read(config_path)
|
||||||
#path comfigurations
|
|
||||||
|
# path comfigurations
|
||||||
MotPath = config["PATH"]["motpath"]
|
MotPath = config["PATH"]["motpath"]
|
||||||
CREDENTIALS_PATH = config["PATH"]["logpath"]
|
CREDENTIALS_PATH = config["PATH"]["logpath"]
|
||||||
|
|
||||||
"""
|
|
||||||
discord configuration
|
|
||||||
"""
|
|
||||||
|
|
||||||
SuccessLink = config["DISCORD"]["successlink"]
|
# discord configuration
|
||||||
ErrorLink = config["DISCORD"]["errorlink"]
|
DISCORD_SUCCESS_LINK = config["DISCORD"]["successlink"]
|
||||||
discord_enabled = config["DISCORD"]["enabled"]
|
DISCORD_ERROR_LINK = config["DISCORD"]["errorlink"]
|
||||||
|
DISCORD_ENABLED = config["DISCORD"]["enabled"]
|
||||||
|
|
||||||
if discord_enabled:
|
if DISCORD_ENABLED:
|
||||||
webhookFailure = Webhook.from_url(ErrorLink, adapter=RequestsWebhookAdapter())
|
webhookFailure = Webhook.from_url(DISCORD_ERROR_LINK, adapter=RequestsWebhookAdapter())
|
||||||
webhookSuccess = Webhook.from_url(SuccessLink, adapter=RequestsWebhookAdapter())
|
webhookSuccess = Webhook.from_url(DISCORD_SUCCESS_LINK, adapter=RequestsWebhookAdapter())
|
||||||
|
|
||||||
#base settings
|
# base settings
|
||||||
FidelityLink = config["SETTINGS"]["FidelityLink"]
|
FidelityLink = config["SETTINGS"]["FidelityLink"]
|
||||||
embeds = config["SETTINGS"]["embeds"] == "True" #print new point value in an embed
|
embeds = config["SETTINGS"]["embeds"] == "True" #print new point value in an embed
|
||||||
Headless = config["SETTINGS"]["headless"] == "True"
|
Headless = config["SETTINGS"]["headless"] == "True"
|
||||||
#proxy settings
|
|
||||||
|
# proxy settings
|
||||||
proxy_enabled = config["PROXY"]["enabled"] == "True"
|
proxy_enabled = config["PROXY"]["enabled"] == "True"
|
||||||
proxy_address = config["PROXY"]["url"]
|
proxy_address = config["PROXY"]["url"]
|
||||||
proxy_port = config["PROXY"]["port"]
|
proxy_port = config["PROXY"]["port"]
|
||||||
#MySQL settings
|
|
||||||
|
# MySQL settings
|
||||||
sql_enabled = config["SQL"]["enabled"] == "True"
|
sql_enabled = config["SQL"]["enabled"] == "True"
|
||||||
sql_usr = config["SQL"]["usr"]
|
sql_usr = config["SQL"]["usr"]
|
||||||
sql_pwd = config["SQL"]["pwd"]
|
sql_pwd = config["SQL"]["pwd"]
|
||||||
sql_host = config["SQL"]["host"]
|
sql_host = config["SQL"]["host"]
|
||||||
sql_database = config["SQL"]["database"]
|
sql_database = config["SQL"]["database"]
|
||||||
|
|
||||||
|
# Other seetings
|
||||||
|
IPV6_CHECKED = config["OTHER"]["ipv6"]
|
||||||
|
CLAIM_AMAZON = config["OTHER"]["claim_amazon"]
|
||||||
|
|
||||||
|
|
||||||
g = open(MotPath, "r", encoding="utf-8")
|
g = open(MotPath, "r", encoding="utf-8")
|
||||||
lines = g.readlines()
|
lines = g.readlines()
|
||||||
if len(lines) < 3 :
|
if len(lines) < 3 :
|
||||||
|
@ -134,6 +141,38 @@ def check_ipv4():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def claim_amazon(): #only work in french for now
|
||||||
|
try :
|
||||||
|
driver.get("https://rewards.microsoft.com/redeem/000803000031")
|
||||||
|
driver.find_element(By.XPATH, "//span[contains( text( ), 'ÉCHANGER UNE RÉCOMPENSE')]").click()
|
||||||
|
sleep(5)
|
||||||
|
driver.find_element(By.XPATH, "//span[contains( text( ), 'CONFIRMER LA RÉCOMPENSE')]").click()
|
||||||
|
sleep(5)
|
||||||
|
|
||||||
|
if ("/rewards/redeem/orderhistory" in driver.page_source) :
|
||||||
|
driver.get("https://rewards.microsoft.com/redeem/orderhistory")
|
||||||
|
driver.find_element(By.XPATH, "//span[contains( text( ), 'Détails de la commande')]").click()
|
||||||
|
sleep(5)
|
||||||
|
code = driver.find_element(By.CLASS_NAME, "tango-credential-value").get_attribute('innerHTML')
|
||||||
|
lien = driver.find_elements(By.CLASS_NAME, "tango-credential-key")[1].get_attribute('innerHTML')
|
||||||
|
lien = search('\"([^\"]+)\"',lien)[1]
|
||||||
|
driver.get(lien)
|
||||||
|
sleep(10)
|
||||||
|
box = driver.find_element(By.ID, "input-45")
|
||||||
|
box.click()
|
||||||
|
box.send_keys(code)
|
||||||
|
driver.find_element(By.XPATH, "//span[contains( text( ), 'Déverrouillez votre récompense')]").click()
|
||||||
|
sleep(5)
|
||||||
|
fcode = driver.find_element(By.XPATH, "//div[@data-test-id='rewardCredentialValue-cardNumber']").get_attribute("innerHTML")
|
||||||
|
amazon = search("> ([^ ]+) <", fcode)[1]
|
||||||
|
webhookSuccess.send(amazon)
|
||||||
|
else :
|
||||||
|
LogError("la recuperation ne peux pas être automatique")
|
||||||
|
except Exception as e :
|
||||||
|
LogError('problème dans la recuperation')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def setup_proxy(ip, port) :
|
def setup_proxy(ip, port) :
|
||||||
PROXY = f"{ip}:{port}"
|
PROXY = f"{ip}:{port}"
|
||||||
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
|
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
|
||||||
|
@ -143,7 +182,6 @@ def setup_proxy(ip, port) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def FirefoxDriver(mobile=False, Headless=Headless):
|
def FirefoxDriver(mobile=False, Headless=Headless):
|
||||||
if proxy_enabled :
|
if proxy_enabled :
|
||||||
setup_proxy(proxy_address,proxy_port)
|
setup_proxy(proxy_address,proxy_port)
|
||||||
|
@ -187,16 +225,7 @@ def CustomSleep(temps):
|
||||||
sleep(temps/10)
|
sleep(temps/10)
|
||||||
return()
|
return()
|
||||||
if LOG or not LINUX_HOST: #only print sleep when user see it
|
if LOG or not LINUX_HOST: #only print sleep when user see it
|
||||||
points = [
|
points = ["⢿", "⣻", "⣽", "⣾", "⣷", "⣯", "⣟", "⡿"]
|
||||||
" . ",
|
|
||||||
" . ",
|
|
||||||
" . ",
|
|
||||||
" .",
|
|
||||||
" .",
|
|
||||||
" . ",
|
|
||||||
" . ",
|
|
||||||
" . ",
|
|
||||||
]
|
|
||||||
passe = 0
|
passe = 0
|
||||||
for i in range(int(temps)):
|
for i in range(int(temps)):
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
|
@ -230,7 +259,7 @@ def LogError(message, log=FULL_LOG, Mobdriver=None):
|
||||||
else:
|
else:
|
||||||
gdriver = driver
|
gdriver = driver
|
||||||
|
|
||||||
if LINUX_HOST and discord_enabled:
|
if LINUX_HOST and DISCORD_ENABLED:
|
||||||
with open("page.html", "w") as f:
|
with open("page.html", "w") as f:
|
||||||
f.write(gdriver.page_source)
|
f.write(gdriver.page_source)
|
||||||
|
|
||||||
|
@ -522,6 +551,7 @@ def send_keys_wait(element, keys):
|
||||||
else :
|
else :
|
||||||
sleep(uniform(0.1, 0.3))
|
sleep(uniform(0.1, 0.3))
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
login() tries to login to your micrososft account.
|
login() tries to login to your micrososft account.
|
||||||
it uses global variable _mail and _password to login
|
it uses global variable _mail and _password to login
|
||||||
|
@ -874,7 +904,7 @@ def LogPoint(account="unknown"): # log des points sur discord
|
||||||
|
|
||||||
account = account.split("@")[0]
|
account = account.split("@")[0]
|
||||||
|
|
||||||
if discord_enabled:
|
if DISCORD_ENABLED:
|
||||||
|
|
||||||
if embeds:
|
if embeds:
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
|
@ -888,6 +918,9 @@ def LogPoint(account="unknown"): # log des points sur discord
|
||||||
if sql_enabled :
|
if sql_enabled :
|
||||||
add_to_database(account, points, sql_host, sql_usr, sql_pwd, sql_database)
|
add_to_database(account, points, sql_host, sql_usr, sql_pwd, sql_database)
|
||||||
|
|
||||||
|
if CLAIM_AMAZON:
|
||||||
|
claim_amazon()
|
||||||
|
|
||||||
|
|
||||||
def Fidelite():
|
def Fidelite():
|
||||||
try:
|
try:
|
||||||
|
@ -1069,11 +1102,8 @@ shuffle(Credentials)
|
||||||
if CUSTOM_START:
|
if CUSTOM_START:
|
||||||
CustomStart(Credentials)
|
CustomStart(Credentials)
|
||||||
else:
|
else:
|
||||||
for i in Credentials:
|
for _mail, _password in Credentials:
|
||||||
system("pkill -9 firefox")
|
system("pkill -9 firefox")
|
||||||
_mail = i[0]
|
|
||||||
_password = i[1]
|
|
||||||
|
|
||||||
print("\n\n")
|
print("\n\n")
|
||||||
print(_mail)
|
print(_mail)
|
||||||
CustomSleep(1)
|
CustomSleep(1)
|
||||||
|
|
1
config
1
config
|
@ -32,3 +32,4 @@ pwd = password
|
||||||
[OTHER]
|
[OTHER]
|
||||||
|
|
||||||
ipv6 = False
|
ipv6 = False
|
||||||
|
claim_amazon = False
|
52
main.py
52
main.py
|
@ -43,7 +43,6 @@ text = {"fr" : {
|
||||||
"proxye" : "voulez vous utiliser un proxy",
|
"proxye" : "voulez vous utiliser un proxy",
|
||||||
"proxyl" : "entrez le lien du proxy",
|
"proxyl" : "entrez le lien du proxy",
|
||||||
"proxyp" : "entrez le port du proxy"
|
"proxyp" : "entrez le port du proxy"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +73,10 @@ def setup_comptes():
|
||||||
print(t["ajout"])
|
print(t["ajout"])
|
||||||
|
|
||||||
#modifie le fichier de configuration
|
#modifie le fichier de configuration
|
||||||
edit_config(3,f'{os.getcwd()}/login.csv')
|
edit_config_txt("logpath",f'{os.getcwd()}/login.csv')
|
||||||
|
|
||||||
|
|
||||||
def edit_config(ligne, contenu):
|
def edit_config_ligne(ligne, contenu):
|
||||||
f = open(config_path, "r")
|
f = open(config_path, "r")
|
||||||
txt = f.readlines()
|
txt = f.readlines()
|
||||||
txt[ligne] = f'{txt[ligne].split("=")[0]}= {contenu}\n'
|
txt[ligne] = f'{txt[ligne].split("=")[0]}= {contenu}\n'
|
||||||
|
@ -89,47 +88,70 @@ def edit_config(ligne, contenu):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
def edit_config_txt(ligne, contenu):
|
||||||
|
f = open(config_path, "r")
|
||||||
|
txt = f.readlines()
|
||||||
|
f.close()
|
||||||
|
if txt.count(txt) >1:
|
||||||
|
raise NameError("il y a plus d'une occurence, echec de la modification")
|
||||||
|
|
||||||
|
for i in range(len(txt)) :
|
||||||
|
name = txt[i].split(" = ")[0]
|
||||||
|
if name == ligne:
|
||||||
|
txt[i] = name + " = " + contenu
|
||||||
|
|
||||||
|
f = open(config_path, "w")
|
||||||
|
for i in txt :
|
||||||
|
f.write(i)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
def setup_settings():
|
def setup_settings():
|
||||||
general()
|
general()
|
||||||
discord()
|
discord()
|
||||||
proxy()
|
proxy()
|
||||||
sql()
|
sql()
|
||||||
|
amazon()
|
||||||
|
|
||||||
def general():
|
def general():
|
||||||
if confirm(t["fidelity"]):
|
if confirm(t["fidelity"]):
|
||||||
lien = input(t["lien"])
|
lien = input(t["lien"])
|
||||||
edit_config(7,lien)
|
edit_config_txt('FidelityLink',lien)
|
||||||
|
|
||||||
def discord():
|
def discord():
|
||||||
enabled = confirm(t["discorde"], default = True)
|
enabled = confirm(t["discorde"], default = True)
|
||||||
if enabled :
|
if enabled :
|
||||||
edit_config(13, True)
|
edit_config_ligne(13, True)
|
||||||
w1 = input(t["w1"])
|
w1 = input(t["w1"])
|
||||||
edit_config(14,w1)
|
edit_config_txt("successlink",w1)
|
||||||
w2 = input(t["w2"])
|
w2 = input(t["w2"])
|
||||||
edit_config(15,w2)
|
edit_config_txt("errorlink",w2)
|
||||||
|
|
||||||
def sql() :
|
def sql() :
|
||||||
enabled = confirm(t["msqle"], default = False)
|
enabled = confirm(t["msqle"], default = False)
|
||||||
if enabled :
|
if enabled :
|
||||||
edit_config(25, True)
|
edit_config_ligne(25, True)
|
||||||
lien = input(t["msqll"])
|
lien = input(t["msqll"])
|
||||||
edit_config(26,lien)
|
edit_config_txt("host",lien)
|
||||||
table = input(t["msqlt"])
|
table = input(t["msqlt"])
|
||||||
edit_config(27,table)
|
edit_config_txt("database",table)
|
||||||
user = input(t["msqlu"])
|
user = input(t["msqlu"])
|
||||||
edit_config(28,user)
|
edit_config_txt("usr",user)
|
||||||
pwd = input(t["msqlp"])
|
pwd = input(t["msqlp"])
|
||||||
edit_config(29,pwd)
|
edit_config_txt("pwd",pwd)
|
||||||
|
|
||||||
def proxy() :
|
def proxy() :
|
||||||
enabled = confirm(t["proxye"], default = False)
|
enabled = confirm(t["proxye"], default = False)
|
||||||
if enabled :
|
if enabled :
|
||||||
edit_config(19, True)
|
edit_config_ligne(19, True)
|
||||||
lien = input(t["proxyl"])
|
lien = input(t["proxyl"])
|
||||||
edit_config(20,lien)
|
edit_config_txt("url",lien)
|
||||||
port = input(t["proxyp"])
|
port = input(t["proxyp"])
|
||||||
edit_config(21,port)
|
edit_config_txt("port",port)
|
||||||
|
|
||||||
|
def amazon():
|
||||||
|
enabled = confirm("claim les recompenses automatiquement sur amazon ?", default = False)
|
||||||
|
edit_config_txt("claim_amazon",enabled)
|
||||||
|
|
||||||
|
|
||||||
LogPath = config["PATH"]["logpath"]
|
LogPath = config["PATH"]["logpath"]
|
||||||
|
|
Loading…
Reference in New Issue