2022-06-22 12:30:08 +02:00
|
|
|
#/usr/bin/python3.10
|
|
|
|
|
|
|
|
import configparser
|
|
|
|
import os
|
2022-06-22 20:16:04 +02:00
|
|
|
print
|
2022-06-22 18:58:28 +02:00
|
|
|
config_path = f"{os.path.abspath( os.path.dirname( __file__ ) )}/config"
|
2022-06-22 12:30:08 +02:00
|
|
|
config = configparser.ConfigParser()
|
|
|
|
config.read(config_path)
|
|
|
|
|
2022-06-22 20:16:04 +02:00
|
|
|
def confirm(texte, default = False):
|
|
|
|
if default :
|
|
|
|
txt = '[Y/n]'
|
2022-06-22 21:18:08 +02:00
|
|
|
else :
|
|
|
|
txt = '[y/N]'
|
2022-06-22 20:16:04 +02:00
|
|
|
|
|
|
|
yes = ['y', 'yes', 'o', 'oui']
|
|
|
|
no = ['n', 'non', 'no']
|
|
|
|
a = input(f"{texte} {txt}").lower()
|
|
|
|
if a in yes :
|
|
|
|
return True
|
|
|
|
elif a in no :
|
|
|
|
return False
|
|
|
|
return default
|
|
|
|
|
2022-06-22 12:30:08 +02:00
|
|
|
lang = "fr"
|
|
|
|
|
|
|
|
text = {"fr" : {
|
|
|
|
"compte" : "entrer l'adresse mail du compte ",
|
|
|
|
"mdp" : "entrez le mot de passe du compte ",
|
|
|
|
"next" : "voulez vous ajouter un compte ?",
|
|
|
|
"finc" : "comptes en cours d'ajout",
|
|
|
|
"ajout" : "comptes ajouté",
|
|
|
|
"fidelity" : "avez vous un lien sur lequel le lien vers la page fidelité du mois est le seul contenu de la page ?",
|
|
|
|
"lien" : "entrez le lien",
|
|
|
|
"discorde" : "voulez vous envoyer les points sur discord ?",
|
2022-06-22 12:31:00 +02:00
|
|
|
"w1" : "entrez le lien du WebHook pour envoyer les points (https://support.discord.com/hc/fr/articles/228383668-Utiliser-les-Webhooks)",
|
2022-06-22 12:30:08 +02:00
|
|
|
"w2" : "entrez le lien du WebHook pour envoyer les erreurs",
|
|
|
|
"msqle" : "voulez vous untiliser une base de donnée",
|
|
|
|
"msqll" : "entrez le lien de la base de donnée",
|
|
|
|
"msqlu" : "entrez l'utilisateur de la base de donnée",
|
|
|
|
"msqlp" : "entrez le mot de passe de la base de donnée",
|
|
|
|
"msqlt" : "entrez le nom de la table de la base de donnée",
|
|
|
|
"proxye" : "voulez vous utiliser un proxy",
|
|
|
|
"proxyl" : "entrez le lien du proxy",
|
|
|
|
"proxyp" : "entrez le port du proxy"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
t = text[lang]
|
|
|
|
|
|
|
|
def setup():
|
|
|
|
setup_comptes()
|
|
|
|
setup_settings()
|
|
|
|
|
|
|
|
|
|
|
|
def setup_comptes():
|
|
|
|
lc = []
|
2022-06-22 20:16:04 +02:00
|
|
|
compte = input(t["compte"])
|
|
|
|
mdp = input(t["mdp"])
|
2022-06-22 12:30:08 +02:00
|
|
|
lc.append(f"{compte},{mdp}")
|
|
|
|
for i in range(5):
|
2022-06-22 20:22:52 +02:00
|
|
|
if confirm(t["next"], default = True):
|
2022-06-22 20:16:04 +02:00
|
|
|
compte = input(t["compte"])
|
|
|
|
mdp = input(t["mdp"])
|
2022-06-22 12:30:08 +02:00
|
|
|
lc.append(f"{compte},{mdp}\n")
|
|
|
|
else:
|
|
|
|
print(t["finc"])
|
|
|
|
break
|
|
|
|
f = open('./login.csv', "w")
|
|
|
|
for i in lc :
|
|
|
|
f.write(i)
|
|
|
|
f.close()
|
|
|
|
print(t["ajout"])
|
|
|
|
|
|
|
|
#modifie le fichier de configuration
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("logpath",f'{os.getcwd()}/login.csv')
|
2022-06-22 12:30:08 +02:00
|
|
|
|
|
|
|
|
2022-10-09 13:33:13 +02:00
|
|
|
def edit_config_ligne(ligne, contenu):
|
2022-06-22 12:30:08 +02:00
|
|
|
f = open(config_path, "r")
|
|
|
|
txt = f.readlines()
|
|
|
|
txt[ligne] = f'{txt[ligne].split("=")[0]}= {contenu}\n'
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
f = open(config_path, "w")
|
|
|
|
for i in txt :
|
|
|
|
f.write(i)
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
2022-10-09 13:33:13 +02:00
|
|
|
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()
|
|
|
|
|
|
|
|
|
2022-06-22 12:30:08 +02:00
|
|
|
def setup_settings():
|
|
|
|
general()
|
|
|
|
discord()
|
|
|
|
proxy()
|
|
|
|
sql()
|
2022-10-09 13:33:13 +02:00
|
|
|
amazon()
|
2022-06-22 12:30:08 +02:00
|
|
|
|
|
|
|
def general():
|
2022-06-22 20:22:52 +02:00
|
|
|
if confirm(t["fidelity"]):
|
2022-06-22 20:16:04 +02:00
|
|
|
lien = input(t["lien"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt('FidelityLink',lien)
|
2022-06-22 12:30:08 +02:00
|
|
|
|
|
|
|
def discord():
|
2022-06-22 20:22:52 +02:00
|
|
|
enabled = confirm(t["discorde"], default = True)
|
2022-06-22 12:30:08 +02:00
|
|
|
if enabled :
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_ligne(13, True)
|
2022-06-22 20:16:04 +02:00
|
|
|
w1 = input(t["w1"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("successlink",w1)
|
2022-06-22 20:16:04 +02:00
|
|
|
w2 = input(t["w2"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("errorlink",w2)
|
2022-06-22 12:30:08 +02:00
|
|
|
|
|
|
|
def sql() :
|
2022-06-22 20:22:52 +02:00
|
|
|
enabled = confirm(t["msqle"], default = False)
|
2022-06-22 12:30:08 +02:00
|
|
|
if enabled :
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_ligne(25, True)
|
2022-06-22 20:16:04 +02:00
|
|
|
lien = input(t["msqll"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("host",lien)
|
2022-06-22 20:16:04 +02:00
|
|
|
table = input(t["msqlt"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("database",table)
|
2022-06-22 20:16:04 +02:00
|
|
|
user = input(t["msqlu"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("usr",user)
|
2022-06-22 20:16:04 +02:00
|
|
|
pwd = input(t["msqlp"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("pwd",pwd)
|
2022-06-22 12:30:08 +02:00
|
|
|
|
|
|
|
def proxy() :
|
2022-06-22 20:22:52 +02:00
|
|
|
enabled = confirm(t["proxye"], default = False)
|
2022-06-22 12:30:08 +02:00
|
|
|
if enabled :
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_ligne(19, True)
|
2022-06-22 20:16:04 +02:00
|
|
|
lien = input(t["proxyl"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("url",lien)
|
2022-06-22 20:16:04 +02:00
|
|
|
port = input(t["proxyp"])
|
2022-10-09 13:33:13 +02:00
|
|
|
edit_config_txt("port",port)
|
2022-06-22 12:30:08 +02:00
|
|
|
|
2022-10-09 13:33:13 +02:00
|
|
|
def amazon():
|
|
|
|
enabled = confirm("claim les recompenses automatiquement sur amazon ?", default = False)
|
|
|
|
edit_config_txt("claim_amazon",enabled)
|
|
|
|
|
2022-06-22 12:30:08 +02:00
|
|
|
|
|
|
|
LogPath = config["PATH"]["logpath"]
|
|
|
|
if LogPath == "/your/path/to/loginandpass.csv" :
|
|
|
|
setup()
|
|
|
|
else :
|
|
|
|
os.system("python3.10 V4.py")
|