97 Commits

Author SHA1 Message Date
2ca2779ec9 fixed a rare error occuring when the cookie creation isn't successful 2023-05-05 11:56:26 +02:00
5ef8d8b7ca some fixes. I believe it's stable. New release tomorrow 2023-05-05 11:40:38 +02:00
f2d08e9137 still dont know 2023-05-04 20:32:19 +02:00
d946298a38 don't know 2023-05-04 17:49:51 +02:00
ed1e91b304 ptite update 2023-04-25 21:56:29 +02:00
710c272659 better logs 2023-04-17 22:28:26 +02:00
6f325c5a6a small fix 2023-04-17 22:00:46 +02:00
3b82419d4d fixed fidelity, but a new version may come sooner or later 2023-04-15 13:10:14 +02:00
9e0514a902 only the number of the config 2023-04-15 11:18:55 +02:00
5c8730dc26 only the number of the config 2023-04-15 11:18:36 +02:00
d11ae4055c euh ué 2023-04-15 11:04:23 +02:00
2dc8cda167 euh ué 2023-04-15 11:03:47 +02:00
fbb2feae31 small but infinite error 2023-04-14 10:31:12 +02:00
8d53a2b30b ok 2023-04-13 22:38:27 +02:00
f8f3ff2382 uéuéué 2023-04-13 22:22:06 +02:00
024b556f5e bruh 2023-04-13 09:11:12 +02:00
b4c9204bf2 oh gosh 2023-04-12 18:25:12 +02:00
f810f0ee3c test 2023-04-12 14:40:32 +02:00
afac7e9539 bump 2023-04-12 13:29:40 +02:00
ae12c18270 not stable either, but something need to change 2023-04-12 13:29:06 +02:00
dfd51bc040 uéuéué faster, more reliable, ... 2023-04-12 00:01:24 +02:00
12a6968ee0 well, SadPanda is still here ;( 2023-04-09 23:41:31 +02:00
8726785dc8 random test 2023-04-08 12:08:26 +02:00
e9f629dee4 sadpanda + typo 2023-04-08 11:51:27 +02:00
c9a838d368 faster overall + better discord error + better login 2023-04-07 23:28:48 +02:00
808916ddd3 testing is everything 2023-04-07 10:04:59 +02:00
c51c463338 the passage to 5.3 wasn't justified ( at least not enough) so i added a new feature 2023-04-07 10:01:47 +02:00
a22d1e6ddb you can manually add points to database 2023-04-07 09:53:11 +02:00
93bb634f7c some fixes here and there 2023-04-06 23:41:11 +02:00
31426a1dfd well, it should be really more robust as it doesn't rely on XPATH everywhere anymore 2023-04-06 23:04:57 +02:00
f862af8699 version control 2023-04-04 21:27:02 +02:00
78e7342acf last update of the night ? 2023-04-04 21:26:40 +02:00
4d8157ba1e better stronger faster 2023-04-04 21:18:09 +02:00
661566aade no clue if that's better 2023-04-04 21:07:12 +02:00
eb2b9dc2d3 you should now start using main : it can finally pass args 2023-04-04 20:59:45 +02:00
3385540350 better way if manually updated 2023-04-04 20:50:56 +02:00
0588180dda should be good for now 2023-04-04 20:46:10 +02:00
9995bc8e25 Auto Updates ? 2023-04-04 20:37:48 +02:00
98ff0a183a always more stable (no) 2023-04-04 12:55:00 +02:00
d579a2c160 once again, should be fairly stable 2023-04-02 12:32:21 +02:00
ccf284f6e2 typo + better logic + WTF everything has failed today 2023-04-02 11:02:37 +02:00
f30832d8cd OMG finally stable ? 2023-04-01 09:51:53 +02:00
799d3d67d5 may even be stable wtf 2023-03-31 10:00:45 +02:00
f10cd8d226 still testing, but on a good way 2023-03-30 09:05:45 +02:00
e41d28c142 normalement c'est insane. Il faut juste gérer le problème de login sur le mobile. 2023-03-30 08:03:49 +02:00
b0c6a93951 bizarre l'id 2023-03-29 23:24:14 +02:00
012e923ab5 better stronger (no) 2023-03-29 23:19:57 +02:00
0cb0521da6 Don't update yet 2023-03-29 23:09:16 +02:00
c5beafe036 test 2023-03-29 14:08:44 +02:00
098b934e96 told ya 2023-03-27 22:47:29 +02:00
339775bdf4 cf previous commit 2023-03-27 22:25:35 +02:00
a2b07b9fcd well don't update till tomorrow I guess 2023-03-27 22:20:54 +02:00
d5bacd99a1 2023-03-27 16:11:17 +02:00
43035e115d sorry for the pings, 2023-03-26 23:24:59 +02:00
c1bbb26c26 no clue why this need to be addressed 2023-03-26 22:56:57 +02:00
95156bacd8 wtf was that 2023-03-26 19:47:13 +02:00
f7c6d3f65e just for me 2023-03-26 10:10:08 +02:00
4ab2530f98 Update Dockerfile 2023-03-25 18:40:17 +01:00
3ca16d1f37 Update README.md 2023-03-25 18:39:42 +01:00
db4ab3bf90 OMG I tested before commiting. (btw cookies login is now implemented) 2023-03-25 18:14:41 +01:00
6fefaca00a Create .gitignore 2023-03-25 16:34:49 +01:00
a2328c2ca7 Delete temp 2023-03-25 16:33:12 +01:00
37f002049a how to only create an empty folder ? 2023-03-25 16:32:48 +01:00
8f655a04fb well, as usual, .. 2023-03-24 20:45:13 +01:00
860c7b536a -f 2023-03-24 18:02:47 +01:00
e93d4f0baf remove some thing 2023-03-19 18:50:29 +01:00
a72c74ec05 Update README.md
ptdr not on a raspberrypi anymore
2023-03-19 12:23:42 +01:00
5282b4b434 apparently, no 2023-03-19 12:21:57 +01:00
0263f2e4c1 j'arriverais jamais a faire un truc sans 14 commits ou quoi ? 2023-03-19 10:44:00 +01:00
3324fa478d oui 2023-03-19 10:17:28 +01:00
d14e0efad9 fix ? 2023-03-18 19:43:54 +01:00
16ddd7aae9 see previous commit for explaination 2023-03-18 19:26:00 +01:00
66de4dbbd2 oh, f*ck, what have I done 2023-03-18 19:12:27 +01:00
27237354b2 didn't even worked 2023-03-18 14:21:27 +01:00
484a9692cf told you 2023-03-18 14:11:51 +01:00
ebb1847a51 maybe better, as usual, probaly don't work, wait tomorrow 2023-03-17 22:37:35 +01:00
80f6cbc919 ofc I broke something 2023-03-15 10:34:59 +01:00
dff47887bc cleaned up under the hood (better error logic) 2023-03-14 19:54:12 +01:00
d0c78d7db1 don't know 2023-03-14 16:52:46 +01:00
ebd22102ef auto remove email part 2023-03-14 16:33:44 +01:00
6ce85286dd V5 2023-03-13 13:42:40 +01:00
db557c2e3c V4 now work again. You should still switch to v5 2023-03-13 07:29:34 +01:00
2888f1d761 TODO update 2023-03-12 15:33:35 +01:00
84898cee76 fixed PlayQuizz8 (most likely ?) 2023-03-12 11:22:49 +01:00
cef0204868 removed Auto Claim feature because of ban 2023-03-12 10:59:36 +01:00
93600dd78a Merge pull request #13 from augustin64/patch-1 2023-03-09 14:30:55 +01:00
7e64604e9f Update Dockerfile
Fix dependencies
2023-03-09 14:30:29 +01:00
c28c2c573d was once again broken 2023-02-27 18:31:31 +01:00
1a4cd03ae1 some error fix 2023-02-27 13:41:54 +01:00
87195de1e5 oui 2023-02-27 13:19:46 +01:00
4631a6608c oui 2023-02-27 13:19:12 +01:00
904ad83f36 test 2023-02-27 13:16:55 +01:00
cd5ce0f6c1 Update requirements.txt 2023-02-27 13:09:01 +01:00
e28660ea7d Update requirements.txt 2023-02-27 13:08:14 +01:00
bad8be5d1f bon bah je sais pas me servir de finally 2023-02-26 12:50:23 +01:00
87b47e97fd oui 2023-02-25 19:05:47 +01:00
442dbb08d9 Merge pull request #12 from augustin64/patch-3 2023-02-13 21:03:55 +01:00
19 changed files with 883 additions and 1965 deletions

4
.gitignore vendored
View File

@ -6,8 +6,10 @@ update.sh
page.html
screenshot.png
login.csv
requirements.txt
data
**/__pycache__
/user_data
install.sh
nohup.out
test.py
points.csv

View File

@ -4,17 +4,22 @@ ENV DEBIAN_FRONTEND noninteractive
ENV GECKODRIVER_VER v0.31.0
ENV FIREFOX_VER 87.0
WORKDIR /app
RUN set -x \
&& apt update \
&& apt upgrade -y \
&& apt install -y \
tzdata \
wfrench \
git \
libx11-xcb1 \
libdbus-glib-1-2 \
libasound.so.2 \
libasound2 \
libgtk-3-0 \
xvfb \
nano \
tigervnc-standalone-server \
&& git clone https://github.com/piair338/MsRewards \
&& ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime \
&& 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 \
&& tar -jxf firefox-* \
@ -27,6 +32,7 @@ RUN set -x \
&& mv geckodriver /usr/bin/
ENV TZ="Europe/Paris"
WORKDIR /app/MsRewards
CMD python main.py

View File

@ -1,9 +1,9 @@
# MsReward
A Microsoft reward automator, designed to work headless on a raspberry pi. Tested with a pi 3b+ and a pi 4 2Gb .
Using a discord webhook or SQL to log points everydays.
Using Selenium and geckodriver.
A Microsoft reward automator, designed to work headless on any server.
Using a discord webhook or SQL to log points everyday.
Using Selenium and Geckodriver.
## If you're using docker (way easier)
to use docker, run
@ -12,17 +12,17 @@ sudo docker build .
#copy the build id
sudo docker run -ti --name MsRewards [build id]
```
Then, fill the config and start the programm everydays with
Then, fill the config and start the program everyday with
```
sudo docker start MsRewards
```
## Other configuration
To use the database, I recommand MySql, Create a database with the name you want and create a table `daily`, like the one from the image :
To use the database, I recommend MySql, Create a database with the name you want and create a table `daily`, like the one from the image :
![B96F2F6D-7257-4F12-BFA7-0BEC3FB72993](https://user-images.githubusercontent.com/74496300/172872979-05396b6b-b682-471a-b71b-41602d816504.jpeg)
You have to use the default worldlist (`sudo apt install wfrench`). The language is french by default, but you can change it if you want.
You have to use the default world list (`sudo apt install wfrench`). The language is french by default, but you can change it if you want.
You can add a link to a website where content is only the link of the monthly fidelity card.
@ -33,7 +33,7 @@ You should limit to 6 account per IP, and DON'T USE outlook account, they are ba
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
tar -xjf firefox-91.9.1esr.tar.bz2

1061
V4.py

File diff suppressed because it is too large Load Diff

1140
V5.py Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,25 @@
import mysql.connector
import configparser
from os import path
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"-f",
"--file",
help="Choose a file",
type=argparse.FileType('r')
)
parser.add_argument(
"-m",
"--manual",
help="add point manually do database",
dest="manual",
action="store_true"
)
args = parser.parse_args()
MANUAL = args.manual
config_path = "./user_data/config.cfg"
config = configparser.ConfigParser()
@ -35,19 +54,39 @@ def ban_account(name: str, pts = 0):
def update_pts(name: str, pts = 0):
pass
if not MANUAL :
print("ajouter un compte : 1\nban un compte : 2")
i = input()
if i == "1":
if args.file :
l =[x.split(",")[0].split("@")[0] for x in args.file.readlines()]
endroit = input("ou est le bot ? ")
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':
name = input("quel est le compte qui a été ban ? ")
pts = input("il avait combien de points ? ")
ban_account(name, pts)
print("ajouter un compte : 1\nban un compte : 2")
i = input()
if i == "1":
name = input("quel est le nom ? ")
endroit = input("ou est le bot ? ")
proprio = input("qui est le proprio ? ")
add_account(name, endroit, proprio)
elif i == '2':
name = input("quel est le compte qui a été ban ? ")
pts = input("il avait combien de points ? ")
ban_account(name, pts)
mydb.commit()
mycursor.close()
mydb.close()
mydb.commit()
mycursor.close()
mydb.close()
else :
import modules.db as datab
config_path = f"{path.abspath(path.dirname(path.dirname( __file__ )))}/MsRewards/user_data/config.cfg"
print(config_path)
config = configparser.ConfigParser()
config.read(config_path)
sql_usr = config["SQL"]["usr"]
sql_pwd = config["SQL"]["pwd"]
sql_host = config["SQL"]["host"]
sql_database = config["SQL"]["database"]
account_name = input("compte ? ")
points = int(input("points ? "))
datab.add_to_database(account_name, points, sql_host, sql_usr, sql_pwd, sql_database)

50
main.py
View File

@ -1,8 +1,11 @@
#/usr/bin/python3.10
from packaging.version import parse as parse_version
import configparser
import os
import shutil
import requests
import sys
config = configparser.ConfigParser()
@ -16,8 +19,6 @@ except :
config.read(config_path)
def confirm(texte, default = False):
if default :
txt = '[Y/n]'
@ -41,12 +42,12 @@ text = {"fr" : {
"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 ? ",
"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 ",
"discorde" : "voulez vous envoyer les erreurs sur discord ? ",
"w1" : "entrez le lien du WebHook pour envoyer les points ",
"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 ",
"msqlu" : "entrez l'utilisateur 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.close()
print(t["ajout"])
#modifie le fichier de configuration
edit_config_txt("logpath",f'{os.getcwd()}/user_data/login.csv')
@ -111,8 +110,8 @@ def setup_settings():
discord()
proxy()
sql()
amazon()
def general():
if confirm(t["fidelity"]):
lien = input(t["lien"])
@ -143,7 +142,8 @@ def sql() :
edit_config_txt("usr",user)
pwd = input(t["msqlp"])
edit_config_txt("pwd",pwd)
def proxy() :
enabled = confirm(t["proxye"], default = False)
if enabled :
@ -152,14 +152,34 @@ def proxy() :
edit_config_txt("url",lien)
port = input(t["proxyp"])
edit_config_txt("port",port)
def amazon():
enabled = confirm("claim les recompenses automatiquement sur amazon ?", default = False)
edit_config_txt("claim_amazon",enabled)
def check_update(args):
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 (args)
f = open("./version", 'r')
txt = f.readlines()[0].replace("\n","")
f.close()
cur = parse_version(txt)
if not (cur < latest) :
print("Already up to date.")
return(args)
else :
print(f"updating to {latest}")
os.system("git reset --hard")
os.system("git pull")
os.system("python3 -m pip install -r requirements.txt > update.result")
print(f"updated to {latest}")
return(args + f" --version {latest}")
LogPath = config["PATH"]["logpath"]
if LogPath == "/your/path/to/loginandpass.csv" :
setup()
else :
os.system("python3 V4.py")
args = " ".join(sys.argv[1::])
args = check_update(args)
os.system("python3 V5.py " + args)

34
modules/cards.py Normal file
View File

@ -0,0 +1,34 @@
from modules.imports import *
def welcome_tour(elm, 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="quiz-link gray-button c-call-to-action c-glyph f-lightweight"]').click()
sleep(5)
driver.find_element(By.CSS_SELECTOR, '[class="c-glyph glyph-cancel"]').click()
elm.click()
driver.find_element(By.CSS_SELECTOR, '[class="quiz-link gray-button c-call-to-action c-glyph f-lightweight"]').click()
sleep(5)
driver.find_element(By.CSS_SELECTOR, '[class="c-glyph glyph-cancel"]').click()
elm.click()
driver.find_element(By.CSS_SELECTOR, '[class="quiz-link gray-button c-call-to-action c-glyph f-lightweight"]').click()
sleep(5)
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):
sleep(5)
driver.find_element(By.CSS_SELECTOR, '[data-bi-id="spotify-premium gratuit"]').click()
sleep(5)
close_tab(driver.window_handles[1])

View File

@ -1,16 +1,7 @@
#!/usr/bin/python3.10
import configparser
from csv import reader
from os import sys, system, path
from sys import platform
import argparse
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
RequestsWebhookAdapter,
Webhook,
)
from time import time
from random import shuffle
from modules.driver_tools import *
from modules.imports import *
import modules.globals as g
"""
Setup for option, like --override or --fulllog
"""
@ -33,13 +24,6 @@ parser.add_argument(
action="store_true"
)
parser.add_argument(
"--claim",
help="show claim",
dest="claim",
action="store_true"
)
parser.add_argument(
"-l",
"--log",
@ -55,19 +39,12 @@ parser.add_argument(
help="enable full logging in discord",
action="store_true",
)
parser.add_argument(
"-r",
"--risky",
help="make the program faster, probably better risk of ban",
dest="fast",
action="store_true"
)
parser.add_argument(
"-c",
"--config",
help="Choose a specific config file",
type=argparse.FileType('r')
default=""
)
parser.add_argument(
@ -78,87 +55,116 @@ parser.add_argument(
default=""
)
parser.add_argument(
"-v",
"--vnc",
help="enable VNC",
dest="vnc",
default="None"
)
parser.add_argument(
"--version",
help="display a message on discord to tell that the bot have been updated",
dest="update_version",
default="None"
)
parser.add_argument(
"--dev",
help="dev option",
dest="dev",
action="store_true"
)
args = parser.parse_args()
CLAIM = args.claim
CUSTOM_START = args.override
UNBAN = args.unban
LOG = args.log
FULL_LOG = args.fulllog
FAST = args.fast
if CUSTOM_START :
LOG = True
POINTS_FILE = args.points_file
g.custom_start = args.override
g.unban = args.unban
g.log = args.log
g.full_log = args.fulllog
g.dev = args.dev
if g.custom_start :
g.log = True
g.vnc_enabled = args.vnc != "None"
g.vnc_port = args.vnc
g.points_file = args.points_file
g.update_version = args.update_version
# global variables used later in the code
LINUX_HOST = platform == "linux" # if the computer running this programm is linux, it allow more things
START_TIME = time()
if LINUX_HOST:
import enquiries
else:
system("") # enable colors in windows cmd
g.islinux = platform == "linux" # if the computer running this program is Linux, it allow more things
g.start_time = time()
#reading configuration
config_path = f"{path.abspath(path.dirname(path.dirname( __file__ )))}/user_data/config.cfg"
if args.config :
config_path = path.abspath(args.config.name)
config = configparser.ConfigParser()
config.read(config_path)
if args.config :
try :
config_path =f"{path.abspath(path.dirname(path.dirname( __file__ )))}/user_data/config{args.config}.cfg"
config.read(config_path)
g.mot_path = config["PATH"]["motpath"]
except :
config_path = path.abspath(args.config)
config.read(config_path)
else :
config_path = f"{path.abspath(path.dirname(path.dirname( __file__ )))}/user_data/config.cfg"
config.read(config_path)
# path configurations
MotPath = config["PATH"]["motpath"]
CREDENTIALS_PATH = config["PATH"]["logpath"]
g.mot_path = config["PATH"]["motpath"]
g.credential_path = config["PATH"]["logpath"]
# discord configuration
DISCORD_SUCCESS_LINK = config["DISCORD"]["successlink"]
DISCORD_ERROR_LINK = config["DISCORD"]["errorlink"]
DISCORD_ENABLED_ERROR = config["DISCORD"]["DiscordErrorEnabled"] == "True"
DISCORD_ENABLED_SUCCESS = config["DISCORD"]["DiscordSuccessEnabled"]== "True"
if DISCORD_ENABLED_ERROR:
webhookFailure = Webhook.from_url(DISCORD_ERROR_LINK, adapter=RequestsWebhookAdapter())
if DISCORD_ENABLED_SUCCESS:
webhookSuccess = Webhook.from_url(DISCORD_SUCCESS_LINK, adapter=RequestsWebhookAdapter())
g.discord_success_link = config["DISCORD"]["successlink"]
g.discord_error_link = config["DISCORD"]["errorlink"]
g.discord_enabled_error = config["DISCORD"]["DiscordErrorEnabled"] == "True"
g.discord_enabled_success = config["DISCORD"]["DiscordSuccessEnabled"]== "True"
try :
g.avatar_url = config["OTHER"]["avatar"]
except :
g.avatar_url = "https://cdn.discordapp.com/icons/793934298977009674/d8055bccef6eca4855c349e808d0d788.webp"
if g.discord_enabled_error:
webhookFailure = Webhook.from_url(g.discord_error_link, adapter=RequestsWebhookAdapter())
if g.discord_enabled_success:
webhookSuccess = Webhook.from_url(g.discord_success_link, adapter=RequestsWebhookAdapter())
# base settings
FidelityLink = config["SETTINGS"]["FidelityLink"]
DISCORD_EMBED = config["SETTINGS"]["embeds"] == "True" #print new point value in an embed
Headless = config["SETTINGS"]["headless"] == "True"
g.fidelity_link = config["SETTINGS"]["FidelityLink"]
g.discord_embed = config["SETTINGS"]["embeds"] == "True" #print new point value in an embed
g.headless = config["SETTINGS"]["headless"] == "True"
# proxy settings
proxy_enabled = config["PROXY"]["proxy_enabled"] == "True"
proxy_address = config["PROXY"]["url"]
proxy_port = config["PROXY"]["port"]
g.proxy_enabled = config["PROXY"]["proxy_enabled"] == "True"
g.proxy_address = config["PROXY"]["url"]
g.proxy_port = config["PROXY"]["port"]
# MySQL settings
sql_enabled = config["SQL"]["sql_enabled"] == "True"
sql_usr = config["SQL"]["usr"]
sql_pwd = config["SQL"]["pwd"]
sql_host = config["SQL"]["host"]
sql_database = config["SQL"]["database"]
# Other seetings
IPV6_CHECKED = config["OTHER"]["ipv6"]
CLAIM_AMAZON = config["OTHER"]["claim_amazon"] == "True"
g.sql_enabled = config["SQL"]["sql_enabled"] == "True"
g.sql_usr = config["SQL"]["usr"]
g.sql_pwd = config["SQL"]["pwd"]
g.sql_host = config["SQL"]["host"]
g.sql_database = config["SQL"]["database"]
g = open(MotPath, "r", encoding="utf-8")
lines = g.readlines()
h = open(g.mot_path, "r", encoding="utf-8")
lines = h.readlines()
if len(lines) < 3 :
Liste_de_mot = list(lines[0].split(","))
else :
Liste_de_mot = [x.replace('\n', "") for x in lines]
g.close()
h.close()
with open(CREDENTIALS_PATH) as f:
with open(g.credential_path) as f:
reader = reader(f)
Credentials = list(reader)
shuffle(Credentials)
g._cred = Credentials
if g.proxy_enabled :
setup_proxy(g.proxy_address,g.proxy_port)

63
modules/driver_tools.py Normal file
View File

@ -0,0 +1,63 @@
from modules.imports import *
from modules.config import *
from modules.tools import *
import modules.globals as g
def setup_proxy(ip, port) :
PROXY = f"{ip}:{port}"
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):
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
def load_cookies(driver):
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:
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)
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")
return(True)
except TimeoutException as e:
printf(f"element not found after {timeout}s")
return(False)

View File

@ -1,7 +1,8 @@
from selenium.common.exceptions import TimeoutException, NoSuchElementException, ElementClickInterceptedException
class Banned(Exception):
pass
class NotBanned(Exception):
pass
class Identity(Exception):
pass

36
modules/globals.py Normal file
View File

@ -0,0 +1,36 @@
driver = None
_mail = '_mail temp'
_password = '_password temp'
_otp = '_otp temp'
display = None
_cred = []
custom_start = False
unban = False
log = False
full_log = False
vnc_enabled = False
vnc_port = 0
points_file = "/"
update_version = False
islinux = True
start_time = 0
mot_path = "/"
credential_path = "/"
discord_success_link = "https://example.com"
discord_error_link = "https://example.com"
discord_enabled_error = False
discord_enabled_success = False
avatar_url = ""
fidelity_link = "None"
discord_embed = False
headless = False
proxy_enabled = False
proxy_address = "0.0.0.0"
proxy_port = "0"
sql_enabled = False
sql_usr = "None"
sql_pwd = "azerty"
sql_host = "https://example.com"
sql_database = "MsRewards"
dev = False
norvege = False

33
modules/imports.py Normal file
View File

@ -0,0 +1,33 @@
import argparse
import asyncio
import configparser
import pickle
from csv import reader
from datetime import datetime, timedelta
from os import path, sys, system
from random import choice, randint, shuffle, uniform
from re import findall, search
from sys import platform
from time import sleep, time
from discord import Colour, Embed, File, RequestsWebhookAdapter, Webhook
from pyotp import TOTP
from pyvirtualdisplay import Display
from pyvirtualdisplay.smartdisplay import SmartDisplay
from requests import get
from selenium import webdriver
from selenium.common import exceptions
from selenium.common.exceptions import (ElementClickInterceptedException,
NoSuchElementException,
StaleElementReferenceException,
TimeoutException, 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 import expected_conditions as EC
from selenium.webdriver.support.ui import Select, WebDriverWait
from ast import literal_eval
try:
import enquiries
except:
system("") # enable colors in windows cmd

View 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)

View File

@ -1,87 +1,38 @@
from time import sleep
from datetime import timedelta
from random import uniform
import discord
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
Colour,
Webhook,
)
from modules.imports 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))
def LogError(message, driver, mail, log=FULL_LOG):
print(f"\n\n\033[93m Erreur : {str(message)} \033[0m\n\n")
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))
from modules.db import *
import modules.globals as g
# add the time arround the text given in [text]&
def Timer(text: str) -> str:
return(f"[{g._mail.split('@')[0]} - {datetime.today().strftime('%d/%m')} - {timedelta(seconds = round(float(time() - g.start_time)))}] " + str(text))
# replace the function print, with more options
# [txt] : string, [driver] : selenium wbdriver
def printf2(txt, mail, LOG = LOG):
if LOG:
print(Timer(txt, mail))
# [txt] : string, [driver] : selenium webdriver
def printf(txt):
print(Timer(txt))
# return current page domain
def get_domain(driver):
return(driver.current_url.split("/")[2])
# check if the user is using IPV4 using ipify.org
# [driver] : selenium webdriver
# never used here
# can be useful as Ms had issues with IPV6 at some point
def check_ipv4(driver):
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 :
return True
return False
def CustomSleep(temps):
def custom_sleep(temps):
try :
if FAST and temps > 50:
sleep(temps/10)
return()
if not LOG or not LINUX_HOST: #only print sleep when user see it
if g.log : #only print sleep when user see it
points = ["", "", "", "", "", "", "", ""]
passe = 0
for i in range(int(temps)):
@ -96,7 +47,13 @@ def CustomSleep(temps):
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"):
@ -104,3 +61,22 @@ def progressBar(current, total=30, barLength=20, name="Progress"):
arrow = "-" * int(percent / 100 * barLength - 1) + ">"
spaces = " " * (barLength - len(arrow))
print(name + ": [%s%s] %d %%" % (arrow, spaces, percent), end="\r")
def save_points_from_file(file):
with open(file) as f:
read = reader(f)
points_list = list(read)
for item in points_list:
compte, points = item[0], item[1]
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:
f.write("")
def select_accounts(multiple = True):
system("clear") # clear from previous command to allow a clean choice
emails = [x[0] for x in g._cred] # 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 g._cred if x[0] in emails_selected])

View File

@ -5,3 +5,8 @@ selenium
enquiries
rich
requests
pyvirtualdisplay
pillow
EasyProcess
pyotp
packaging

View File

@ -31,6 +31,5 @@ usr = root
pwd = password
[OTHER]
ipv6 = False
claim_amazon = False
avatar = https://cdn.discordapp.com/icons/793934298977009674/d8055bccef6eca4855c349e808d0d788.webp
ipv6 = False

4
user_data/cookies/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

1
version Normal file
View File

@ -0,0 +1 @@
v5.10.4