mirror of
https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
synced 2025-07-16 16:56:37 +02:00
Compare commits
62 Commits
05b88945ed
...
v5.1.2
Author | SHA1 | Date | |
---|---|---|---|
3385540350 | |||
0588180dda | |||
9995bc8e25 | |||
98ff0a183a | |||
d579a2c160 | |||
ccf284f6e2 | |||
f30832d8cd | |||
799d3d67d5 | |||
f10cd8d226 | |||
e41d28c142 | |||
b0c6a93951 | |||
012e923ab5 | |||
0cb0521da6 | |||
c5beafe036 | |||
098b934e96 | |||
339775bdf4 | |||
a2b07b9fcd | |||
d5bacd99a1 | |||
43035e115d | |||
c1bbb26c26 | |||
95156bacd8 | |||
f7c6d3f65e | |||
4ab2530f98 | |||
3ca16d1f37 | |||
db4ab3bf90 | |||
6fefaca00a | |||
a2328c2ca7 | |||
37f002049a | |||
8f655a04fb | |||
860c7b536a | |||
e93d4f0baf | |||
a72c74ec05 | |||
5282b4b434 | |||
0263f2e4c1 | |||
3324fa478d | |||
d14e0efad9 | |||
16ddd7aae9 | |||
66de4dbbd2 | |||
27237354b2 | |||
484a9692cf | |||
ebb1847a51 | |||
80f6cbc919 | |||
dff47887bc | |||
d0c78d7db1 | |||
ebd22102ef | |||
6ce85286dd | |||
db557c2e3c | |||
2888f1d761 | |||
84898cee76 | |||
cef0204868 | |||
93600dd78a | |||
7e64604e9f | |||
c28c2c573d | |||
1a4cd03ae1 | |||
87195de1e5 | |||
4631a6608c | |||
904ad83f36 | |||
cd5ce0f6c1 | |||
e28660ea7d | |||
bad8be5d1f | |||
87b47e97fd | |||
442dbb08d9 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,8 +6,8 @@ update.sh
|
|||||||
page.html
|
page.html
|
||||||
screenshot.png
|
screenshot.png
|
||||||
login.csv
|
login.csv
|
||||||
requirements.txt
|
|
||||||
data
|
data
|
||||||
**/__pycache__
|
**/__pycache__
|
||||||
/user_data
|
/user_data
|
||||||
install.sh
|
install.sh
|
||||||
|
nohup.out
|
||||||
|
@ -13,7 +13,11 @@ RUN set -x \
|
|||||||
git \
|
git \
|
||||||
libx11-xcb1 \
|
libx11-xcb1 \
|
||||||
libdbus-glib-1-2 \
|
libdbus-glib-1-2 \
|
||||||
libasound.so.2 \
|
libasound2 \
|
||||||
|
libgtk-3-0 \
|
||||||
|
xvfb \
|
||||||
|
nano \
|
||||||
|
tigervnc-standalone-server \
|
||||||
&& git clone https://github.com/piair338/MsRewards \
|
&& git clone https://github.com/piair338/MsRewards \
|
||||||
&& pip install -r MsRewards/requirements.txt \
|
&& pip install -r MsRewards/requirements.txt \
|
||||||
&& curl -sSLO https://download-installer.cdn.mozilla.net/pub/firefox/releases/91.9.1esr/linux-x86_64/en-US/firefox-91.9.1esr.tar.bz2 \
|
&& curl -sSLO https://download-installer.cdn.mozilla.net/pub/firefox/releases/91.9.1esr/linux-x86_64/en-US/firefox-91.9.1esr.tar.bz2 \
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# MsReward
|
# MsReward
|
||||||
|
|
||||||
|
|
||||||
A Microsoft reward automator, designed to work headless on a raspberry pi. Tested with a pi 3b+ and a pi 4 2Gb .
|
A Microsoft reward automator, designed to work headless on any server.
|
||||||
Using a discord webhook or SQL to log points everydays.
|
Using a discord webhook or SQL to log points everyday.
|
||||||
Using Selenium and geckodriver.
|
Using Selenium and geckodriver.
|
||||||
|
|
||||||
## If you're using docker (way easier)
|
## If you're using docker (way easier)
|
||||||
@ -33,7 +33,7 @@ You should limit to 6 account per IP, and DON'T USE outlook account, they are ba
|
|||||||
|
|
||||||
installation recommandation :
|
installation recommandation :
|
||||||
```
|
```
|
||||||
sudo apt-get install xdg-utils libdbus-glib-1-2 bzip2 wfrench -y
|
sudo apt-get install xdg-utils libdbus-glib-1-2 bzip2 wfrench tigervnc-standalone-server -y
|
||||||
|
|
||||||
curl -sSLO https://download-installer.cdn.mozilla.net/pub/firefox/releases/91.9.1esr/linux-x86_64/en-US/firefox-91.9.1esr.tar.bz2
|
curl -sSLO https://download-installer.cdn.mozilla.net/pub/firefox/releases/91.9.1esr/linux-x86_64/en-US/firefox-91.9.1esr.tar.bz2
|
||||||
tar -xjf firefox-91.9.1esr.tar.bz2
|
tar -xjf firefox-91.9.1esr.tar.bz2
|
||||||
|
27
database.py
27
database.py
@ -1,6 +1,18 @@
|
|||||||
import mysql.connector
|
import mysql.connector
|
||||||
import configparser
|
import configparser
|
||||||
from os import path
|
from os import path
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
"-f",
|
||||||
|
"--file",
|
||||||
|
help="Choose a file",
|
||||||
|
type=argparse.FileType('r')
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
config_path = "./user_data/config.cfg"
|
config_path = "./user_data/config.cfg"
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
@ -39,10 +51,17 @@ def update_pts(name: str, pts = 0):
|
|||||||
print("ajouter un compte : 1\nban un compte : 2")
|
print("ajouter un compte : 1\nban un compte : 2")
|
||||||
i = input()
|
i = input()
|
||||||
if i == "1":
|
if i == "1":
|
||||||
name = input("quel est le nom ? ")
|
if args.file :
|
||||||
endroit = input("ou est le bot ? ")
|
l =[x.split(",")[0].split("@")[0] for x in args.file.readlines()]
|
||||||
proprio = input("qui est le proprio ? ")
|
endroit = input("ou est le bot ? ")
|
||||||
add_account(name, endroit, proprio)
|
proprio = input("qui est le proprio ? ")
|
||||||
|
for name in l :
|
||||||
|
add_account(name, endroit, proprio)
|
||||||
|
else :
|
||||||
|
name = input("quel est le nom ? ").split("@")[0]
|
||||||
|
endroit = input("ou est le bot ? ")
|
||||||
|
proprio = input("qui est le proprio ? ")
|
||||||
|
add_account(name, endroit, proprio)
|
||||||
elif i == '2':
|
elif i == '2':
|
||||||
name = input("quel est le compte qui a été ban ? ")
|
name = input("quel est le compte qui a été ban ? ")
|
||||||
pts = input("il avait combien de points ? ")
|
pts = input("il avait combien de points ? ")
|
||||||
|
46
main.py
46
main.py
@ -1,8 +1,11 @@
|
|||||||
#/usr/bin/python3.10
|
#/usr/bin/python3.10
|
||||||
|
from packaging.version import parse as parse_version
|
||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
|
|
||||||
@ -16,8 +19,6 @@ except :
|
|||||||
config.read(config_path)
|
config.read(config_path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def confirm(texte, default = False):
|
def confirm(texte, default = False):
|
||||||
if default :
|
if default :
|
||||||
txt = '[Y/n]'
|
txt = '[Y/n]'
|
||||||
@ -41,12 +42,12 @@ text = {"fr" : {
|
|||||||
"next" : "voulez vous ajouter un compte ? ",
|
"next" : "voulez vous ajouter un compte ? ",
|
||||||
"finc" : "comptes en cours d'ajout ",
|
"finc" : "comptes en cours d'ajout ",
|
||||||
"ajout" : "comptes 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 ? ",
|
"fidelity" : "avez vous un lien sur lequel le lien vers la page fidélité du mois est le seul contenu de la page ? ",
|
||||||
"lien" : "entrez le lien ",
|
"lien" : "entrez le lien ",
|
||||||
"discorde" : "voulez vous envoyer les erreurs sur discord ? ",
|
"discorde" : "voulez vous envoyer les erreurs sur discord ? ",
|
||||||
"w1" : "entrez le lien du WebHook pour envoyer les points ",
|
"w1" : "entrez le lien du WebHook pour envoyer les points ",
|
||||||
"w2" : "entrez le lien du WebHook pour envoyer les erreurs ",
|
"w2" : "entrez le lien du WebHook pour envoyer les erreurs ",
|
||||||
"msqle" : "voulez vous untiliser une base de donnée ",
|
"msqle" : "voulez vous utiliser une base de donnée ",
|
||||||
"msqll" : "entrez le lien de la base de donnée ",
|
"msqll" : "entrez le lien de la base de donnée ",
|
||||||
"msqlu" : "entrez l'utilisateur 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 ",
|
"msqlp" : "entrez le mot de passe de la base de donnée ",
|
||||||
@ -83,8 +84,6 @@ def setup_comptes():
|
|||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.close()
|
f.close()
|
||||||
print(t["ajout"])
|
print(t["ajout"])
|
||||||
|
|
||||||
#modifie le fichier de configuration
|
|
||||||
edit_config_txt("logpath",f'{os.getcwd()}/user_data/login.csv')
|
edit_config_txt("logpath",f'{os.getcwd()}/user_data/login.csv')
|
||||||
|
|
||||||
|
|
||||||
@ -111,8 +110,8 @@ def setup_settings():
|
|||||||
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"])
|
||||||
@ -143,7 +142,8 @@ def sql() :
|
|||||||
edit_config_txt("usr",user)
|
edit_config_txt("usr",user)
|
||||||
pwd = input(t["msqlp"])
|
pwd = input(t["msqlp"])
|
||||||
edit_config_txt("pwd",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 :
|
||||||
@ -152,14 +152,30 @@ def proxy() :
|
|||||||
edit_config_txt("url",lien)
|
edit_config_txt("url",lien)
|
||||||
port = input(t["proxyp"])
|
port = input(t["proxyp"])
|
||||||
edit_config_txt("port",port)
|
edit_config_txt("port",port)
|
||||||
|
|
||||||
def amazon():
|
|
||||||
enabled = confirm("claim les recompenses automatiquement sur amazon ?", default = False)
|
def check_update():
|
||||||
edit_config_txt("claim_amazon",enabled)
|
try :
|
||||||
|
latest = requests.get("https://api.github.com/repos/piair338/MsRewards/releases").json()[0]["tag_name"]
|
||||||
|
latest = parse_version(latest)
|
||||||
|
except Exception as e :
|
||||||
|
print(e)
|
||||||
|
return ()
|
||||||
|
f = open("./version", 'r')
|
||||||
|
txt = f.readlines()[0].replace("\n","")
|
||||||
|
f.close()
|
||||||
|
cur = parse_version(txt)
|
||||||
|
if (cur < latest) :
|
||||||
|
print("Already up to date.")
|
||||||
|
else :
|
||||||
|
print(f"updating to {latest}")
|
||||||
|
os.system("git pull")
|
||||||
|
print("updated")
|
||||||
|
|
||||||
|
|
||||||
LogPath = config["PATH"]["logpath"]
|
LogPath = config["PATH"]["logpath"]
|
||||||
if LogPath == "/your/path/to/loginandpass.csv" :
|
if LogPath == "/your/path/to/loginandpass.csv" :
|
||||||
setup()
|
setup()
|
||||||
else :
|
else :
|
||||||
os.system("python3 V4.py")
|
check_update()
|
||||||
|
os.system("python3 V5.py")
|
||||||
|
69
manual_claim.py
Normal file
69
manual_claim.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
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()
|
@ -7,7 +7,9 @@ import argparse
|
|||||||
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
|
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
|
||||||
RequestsWebhookAdapter,
|
RequestsWebhookAdapter,
|
||||||
Webhook,
|
Webhook,
|
||||||
|
Colour,
|
||||||
)
|
)
|
||||||
|
|
||||||
from time import time
|
from time import time
|
||||||
from random import shuffle
|
from random import shuffle
|
||||||
|
|
||||||
@ -33,13 +35,6 @@ parser.add_argument(
|
|||||||
action="store_true"
|
action="store_true"
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
"--claim",
|
|
||||||
help="show claim",
|
|
||||||
dest="claim",
|
|
||||||
action="store_true"
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-l",
|
"-l",
|
||||||
"--log",
|
"--log",
|
||||||
@ -78,8 +73,16 @@ parser.add_argument(
|
|||||||
default=""
|
default=""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"-v",
|
||||||
|
"--vnc",
|
||||||
|
help="enable VNC",
|
||||||
|
dest="vnc",
|
||||||
|
default="None"
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
CLAIM = args.claim
|
|
||||||
CUSTOM_START = args.override
|
CUSTOM_START = args.override
|
||||||
UNBAN = args.unban
|
UNBAN = args.unban
|
||||||
LOG = args.log
|
LOG = args.log
|
||||||
@ -87,11 +90,12 @@ FULL_LOG = args.fulllog
|
|||||||
FAST = args.fast
|
FAST = args.fast
|
||||||
if CUSTOM_START :
|
if CUSTOM_START :
|
||||||
LOG = True
|
LOG = True
|
||||||
|
VNC_ENABLED = args.vnc != "None"
|
||||||
|
VNC_PORT = args.vnc
|
||||||
POINTS_FILE = args.points_file
|
POINTS_FILE = args.points_file
|
||||||
|
|
||||||
# global variables used later in the code
|
# global variables used later in the code
|
||||||
LINUX_HOST = platform == "linux" # if the computer running this programm is linux, it allow more things
|
LINUX_HOST = platform == "linux" # if the computer running this program is Linux, it allow more things
|
||||||
START_TIME = time()
|
START_TIME = time()
|
||||||
|
|
||||||
|
|
||||||
@ -144,9 +148,8 @@ 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
|
# Other settings
|
||||||
IPV6_CHECKED = config["OTHER"]["ipv6"]
|
IPV6_CHECKED = config["OTHER"]["ipv6"]
|
||||||
CLAIM_AMAZON = config["OTHER"]["claim_amazon"] == "True"
|
|
||||||
|
|
||||||
|
|
||||||
g = open(MotPath, "r", encoding="utf-8")
|
g = open(MotPath, "r", encoding="utf-8")
|
||||||
|
57
modules/driver_tools.py
Normal file
57
modules/driver_tools.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
from modules.imports import *
|
||||||
|
from modules.config import *
|
||||||
|
|
||||||
|
|
||||||
|
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",
|
||||||
|
}
|
||||||
|
|
||||||
|
#Deal with rgpd popup as well as some random popup like 'are you satisfied' one
|
||||||
|
def rgpd_popup(driver) -> None:
|
||||||
|
for i in ["bnp_btn_accept", "bnp_hfly_cta2", "bnp_hfly_close"] :
|
||||||
|
try:
|
||||||
|
driver.find_element(By.ID, i).click()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# save webdriver cookies
|
||||||
|
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, _mail):
|
||||||
|
cookies = pickle.load(open(f"{'/'.join(__file__.split('/')[:-2])}/user_data/cookies/{_mail}.pkl", "rb"))
|
||||||
|
for cookie in cookies:
|
||||||
|
driver.add_cookie(cookie)
|
||||||
|
|
||||||
|
"""
|
||||||
|
send_keys_wait([selenium element:element, str:keys]) send the different keys to the field element, with a random time between each press to simulate human action.
|
||||||
|
keys can be an string, but also selenium keys
|
||||||
|
"""
|
||||||
|
def send_keys_wait(element, keys):
|
||||||
|
for i in keys:
|
||||||
|
element.send_keys(i)
|
||||||
|
if FAST :
|
||||||
|
pass
|
||||||
|
else :
|
||||||
|
sleep(uniform(0.1, 0.3))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Wait for the presence of the element identifier or [timeout]s
|
||||||
|
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:
|
||||||
|
print(f"element not found after {timeout}s")
|
||||||
|
|
@ -1,5 +1,3 @@
|
|||||||
from selenium.common.exceptions import TimeoutException, NoSuchElementException, ElementClickInterceptedException
|
|
||||||
|
|
||||||
class Banned(Exception):
|
class Banned(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
24
modules/imports.py
Normal file
24
modules/imports.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import asyncio
|
||||||
|
import csv
|
||||||
|
from os import sys, system, path
|
||||||
|
from random import choice, randint, shuffle, uniform
|
||||||
|
from re import findall, search
|
||||||
|
from sys import platform
|
||||||
|
from time import sleep
|
||||||
|
from requests import get
|
||||||
|
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
|
||||||
|
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
|
@ -1,32 +0,0 @@
|
|||||||
#add return a string witx tabs
|
|
||||||
def tabs(x):
|
|
||||||
return(x*4*" ")
|
|
||||||
|
|
||||||
|
|
||||||
#create dictionnary with all progress bars
|
|
||||||
def dico(progress):
|
|
||||||
dico_task = {
|
|
||||||
"daily" : {
|
|
||||||
"all" : progress.add_task("[yellow]daily", total=100, start=False, visible=False),
|
|
||||||
"carte0" : progress.add_task(f"[yellow]{tabs(1)}carte 1", total=100, start=False, visible = False),
|
|
||||||
"carte1" : progress.add_task(f"[yellow]{tabs(1)}carte 2", total=100, start=False, visible = False),
|
|
||||||
"carte2" : progress.add_task(f"[yellow]{tabs(1)}carte 3", total=100, start=False, visible = False)
|
|
||||||
},
|
|
||||||
"weekly" : {
|
|
||||||
"all" : progress.add_task("[yellow]weekly", total=100, start=False, visible=False),
|
|
||||||
"carte1" : progress.add_task(f"[yellow]{tabs(1)}carte 1", total=100, start=False, visible = False),
|
|
||||||
"carte2" : progress.add_task(f"[yellow]{tabs(1)}carte 2", total=100, start=False, visible = False),
|
|
||||||
"carte3" : progress.add_task(f"[yellow]{tabs(1)}carte 3", total=100, start=False, visible = False),
|
|
||||||
"carte3" : progress.add_task(f"[yellow]{tabs(1)}carte 4", total=100, start=False, visible = False),
|
|
||||||
"carte3" : progress.add_task(f"[yellow]{tabs(1)}carte 5", total=100, start=False, visible = False),
|
|
||||||
"carte3" : progress.add_task(f"[yellow]{tabs(1)}carte 6", total=100, start=False, visible = False),
|
|
||||||
"carte3" : progress.add_task(f"[yellow]{tabs(1)}carte 7", total=100, start=False, visible = False),
|
|
||||||
"carte3" : progress.add_task(f"[yellow]{tabs(1)}carte 8", total=100, start=False, visible = False),
|
|
||||||
"carte3" : progress.add_task(f"[yellow]{tabs(1)}carte 9", total=100, start=False, visible = False),
|
|
||||||
},
|
|
||||||
"PC" : progress.add_task(f"[yellow]PC", total=100, start=False, visible = False),
|
|
||||||
"Mobile" : progress.add_task(f"[yellow]Mobile", total=100, start=False, visible = False),
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return(dico_task)
|
|
101
modules/tools.py
101
modules/tools.py
@ -1,87 +1,37 @@
|
|||||||
from time import sleep
|
from modules.imports import *
|
||||||
from datetime import timedelta
|
|
||||||
from random import uniform
|
|
||||||
import discord
|
|
||||||
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
|
|
||||||
Colour,
|
|
||||||
Webhook,
|
|
||||||
)
|
|
||||||
|
|
||||||
from modules.config import *
|
from modules.config import *
|
||||||
|
|
||||||
"""
|
|
||||||
send_keys_wait([selenium element:element, str:keys]) send the different keys to the field element, with a random time between each press to simulate human action.
|
|
||||||
keys can be an string, but alos selenium keys
|
|
||||||
"""
|
|
||||||
def send_keys_wait(element, keys):
|
|
||||||
for i in keys:
|
|
||||||
element.send_keys(i)
|
|
||||||
if FAST :
|
|
||||||
pass
|
|
||||||
else :
|
|
||||||
sleep(uniform(0.1, 0.3))
|
|
||||||
|
|
||||||
|
# add the time arround the text given in [text]&
|
||||||
def LogError(message, driver, mail, log=FULL_LOG):
|
def Timer(text: str, mail: str) -> str:
|
||||||
print(f"\n\n\033[93m Erreur : {str(message)} \033[0m\n\n")
|
return(f"[{mail} - {datetime.today().strftime('%d-%m-%Y')} - {timedelta(seconds = round(float(time() - START_TIME)))}] " + str(text))
|
||||||
if DISCORD_ENABLED_ERROR:
|
|
||||||
with open("page.html", "w") as f:
|
|
||||||
f.write(driver.page_source)
|
|
||||||
|
|
||||||
driver.save_screenshot("screenshot.png")
|
|
||||||
if not log:
|
|
||||||
embed = discord.Embed(
|
|
||||||
title="An Error has occured",
|
|
||||||
description=str(message),
|
|
||||||
colour=Colour.red(),
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
embed = discord.Embed(
|
|
||||||
title="Full log is enabled",
|
|
||||||
description=str(message),
|
|
||||||
colour=Colour.blue(),
|
|
||||||
)
|
|
||||||
|
|
||||||
file = discord.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"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# add the time arround the text given in [text]
|
|
||||||
# [text] : string
|
|
||||||
def Timer(text, mail):
|
|
||||||
return(f"[{mail} - {timedelta(seconds = round(float(time() - START_TIME)))}] " + str(text))
|
|
||||||
|
|
||||||
|
|
||||||
# replace the function print, with more options
|
# replace the function print, with more options
|
||||||
# [txt] : string, [driver] : selenium wbdriver
|
# [txt] : string, [driver] : selenium webdriver
|
||||||
def printf2(txt, mail, LOG = LOG):
|
def printf2(txt, mail, LOG = LOG):
|
||||||
if LOG:
|
print(Timer(txt, mail))
|
||||||
print(Timer(txt, mail))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# check if the user is using IPV4 using ipify.org
|
# check if the user is using IPV4 using ipify.org
|
||||||
# [driver] : selenium webdriver
|
# [driver] : selenium webdriver
|
||||||
|
# never used here
|
||||||
|
# can be useful as Ms had issues with IPV6 at some point
|
||||||
def check_ipv4(driver):
|
def check_ipv4(driver):
|
||||||
driver.get("https://api64.ipify.org")
|
driver.get("https://api64.ipify.org")
|
||||||
elm = driver.find_element(BY.TAG_NAME, "body")
|
elm = driver.find_element(By.TAG_NAME, "body")
|
||||||
if len(elm.text.split('.')) == 4 :
|
if len(elm.text.split('.')) == 4 :
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def CustomSleep(temps):
|
def custom_sleep(temps):
|
||||||
try :
|
try :
|
||||||
if FAST and temps > 50:
|
if FAST and temps > 50:
|
||||||
sleep(temps/10)
|
sleep(temps/10)
|
||||||
return()
|
elif LOG: #only print sleep when user see it
|
||||||
if not 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)):
|
||||||
@ -96,7 +46,13 @@ def CustomSleep(temps):
|
|||||||
print("attente annulée")
|
print("attente annulée")
|
||||||
|
|
||||||
|
|
||||||
|
def format_error(e) -> str:
|
||||||
|
tb = e.__traceback__
|
||||||
|
txt = ""
|
||||||
|
while tb != None :
|
||||||
|
txt = txt + f" -> {tb.tb_frame.f_code.co_name} ({tb.tb_lineno}) "
|
||||||
|
tb = tb.tb_next
|
||||||
|
return(txt + "\n" + str(e))
|
||||||
|
|
||||||
|
|
||||||
def progressBar(current, total=30, barLength=20, name="Progress"):
|
def progressBar(current, total=30, barLength=20, name="Progress"):
|
||||||
@ -104,3 +60,24 @@ def progressBar(current, total=30, barLength=20, name="Progress"):
|
|||||||
arrow = "-" * int(percent / 100 * barLength - 1) + ">"
|
arrow = "-" * int(percent / 100 * barLength - 1) + ">"
|
||||||
spaces = " " * (barLength - len(arrow))
|
spaces = " " * (barLength - len(arrow))
|
||||||
print(name + ": [%s%s] %d %%" % (arrow, spaces, percent), end="\r")
|
print(name + ": [%s%s] %d %%" % (arrow, spaces, percent), end="\r")
|
||||||
|
|
||||||
|
|
||||||
|
def save_points_from_file(file):
|
||||||
|
with open(file) as f:
|
||||||
|
reader = csv.reader(f)
|
||||||
|
points_list = list(reader)
|
||||||
|
|
||||||
|
for item in points_list:
|
||||||
|
compte, points = item[0], item[1]
|
||||||
|
add_to_database(compte, points, sql_host,sql_usr,sql_pwd,sql_database, save_if_fail=False)
|
||||||
|
|
||||||
|
with open(file, "w") as f:
|
||||||
|
f.write("")
|
||||||
|
|
||||||
|
|
||||||
|
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])
|
||||||
|
|
||||||
|
@ -5,3 +5,8 @@ selenium
|
|||||||
enquiries
|
enquiries
|
||||||
rich
|
rich
|
||||||
requests
|
requests
|
||||||
|
pyvirtualdisplay
|
||||||
|
pillow
|
||||||
|
EasyProcess
|
||||||
|
pyotp
|
||||||
|
packaging
|
||||||
|
@ -32,5 +32,4 @@ pwd = password
|
|||||||
|
|
||||||
[OTHER]
|
[OTHER]
|
||||||
|
|
||||||
ipv6 = False
|
ipv6 = False
|
||||||
claim_amazon = False
|
|
4
user_data/cookies/.gitignore
vendored
Normal file
4
user_data/cookies/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
Reference in New Issue
Block a user