2022-10-24 20:08:33 +02:00
|
|
|
#!/usr/bin/python3.10
|
2023-04-15 11:03:47 +02:00
|
|
|
from modules.driver_tools import *
|
|
|
|
from modules.imports import *
|
|
|
|
import modules.globals as g
|
2023-06-17 16:52:47 +02:00
|
|
|
import json
|
2022-10-24 20:08:33 +02:00
|
|
|
|
2023-09-30 17:23:37 +02:00
|
|
|
class FakeWebHook:
|
|
|
|
def send(self, text = "", username='', avatar_url='', embed = "", file =""):
|
|
|
|
print(text)
|
|
|
|
|
2022-10-24 20:08:33 +02:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
|
|
|
parser.add_argument(
|
2022-10-31 15:32:39 +01:00
|
|
|
"-o",
|
|
|
|
"--override",
|
|
|
|
help="override",
|
|
|
|
dest="override",
|
|
|
|
action="store_true"
|
2022-10-24 20:08:33 +02:00
|
|
|
)
|
2022-10-31 15:32:39 +01:00
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
"-u",
|
|
|
|
"--unban",
|
|
|
|
help="unban an account",
|
|
|
|
dest="unban",
|
|
|
|
action="store_true"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-10-24 20:08:33 +02:00
|
|
|
parser.add_argument(
|
|
|
|
"-fl",
|
|
|
|
"--fulllog",
|
|
|
|
dest="fulllog",
|
|
|
|
help="enable full logging in discord",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
|
2023-09-24 21:19:02 +02:00
|
|
|
parser.add_argument(
|
|
|
|
"-d",
|
|
|
|
"--dev",
|
|
|
|
dest="dev",
|
|
|
|
help="enable dev mode",
|
|
|
|
action="store_true",
|
|
|
|
)
|
2023-06-17 16:52:47 +02:00
|
|
|
|
2022-10-24 20:08:33 +02:00
|
|
|
parser.add_argument(
|
2022-10-31 15:32:39 +01:00
|
|
|
"-c",
|
|
|
|
"--config",
|
|
|
|
help="Choose a specific config file",
|
2023-04-15 11:18:36 +02:00
|
|
|
default=""
|
2022-10-24 20:08:33 +02:00
|
|
|
)
|
|
|
|
|
2022-11-16 18:12:43 +01:00
|
|
|
|
2023-02-25 19:05:47 +01:00
|
|
|
parser.add_argument(
|
|
|
|
"-v",
|
|
|
|
"--vnc",
|
|
|
|
help="enable VNC",
|
|
|
|
dest="vnc",
|
2023-09-24 21:45:35 +02:00
|
|
|
default="2345"
|
2023-02-25 19:05:47 +01:00
|
|
|
)
|
|
|
|
|
2023-04-07 10:01:47 +02:00
|
|
|
parser.add_argument(
|
2023-04-09 23:41:31 +02:00
|
|
|
"--version",
|
2023-04-07 10:01:47 +02:00
|
|
|
help="display a message on discord to tell that the bot have been updated",
|
|
|
|
dest="update_version",
|
|
|
|
default="None"
|
|
|
|
)
|
2023-04-25 21:56:29 +02:00
|
|
|
|
2023-09-30 17:23:37 +02:00
|
|
|
parser.add_argument(
|
|
|
|
"--very-custom",
|
|
|
|
help="Choose a specific config file",
|
|
|
|
default=""
|
|
|
|
)
|
|
|
|
|
2023-06-26 21:49:30 +02:00
|
|
|
with open("/app/MsRewards-Reborn/user_data/discord.json", "r") as inFile:
|
2023-06-17 16:52:47 +02:00
|
|
|
discord = json.load(inFile)
|
2023-06-26 21:49:30 +02:00
|
|
|
with open("/app/MsRewards-Reborn/user_data/settings.json", "r") as inFile:
|
2023-06-17 16:52:47 +02:00
|
|
|
settings = json.load(inFile)
|
2023-06-26 21:49:30 +02:00
|
|
|
with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile:
|
2023-06-17 16:52:47 +02:00
|
|
|
proxy = json.load(inFile)
|
2023-06-26 21:49:30 +02:00
|
|
|
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
2023-06-17 16:52:47 +02:00
|
|
|
config = json.load(inFile)
|
2023-08-25 11:43:09 +02:00
|
|
|
|
2023-04-25 21:56:29 +02:00
|
|
|
|
2022-10-24 20:08:33 +02:00
|
|
|
args = parser.parse_args()
|
2023-03-12 10:59:36 +01:00
|
|
|
|
2023-04-15 11:03:47 +02:00
|
|
|
g.custom_start = args.override
|
|
|
|
g.unban = args.unban
|
|
|
|
g.full_log = args.fulllog
|
2023-09-24 21:19:02 +02:00
|
|
|
g.dev = args.dev
|
2023-09-30 17:23:37 +02:00
|
|
|
g.very_custom = args.very_custom
|
|
|
|
|
2023-04-15 11:03:47 +02:00
|
|
|
if g.custom_start :
|
|
|
|
g.log = True
|
2022-10-24 20:08:33 +02:00
|
|
|
|
2023-04-15 11:03:47 +02:00
|
|
|
g.vnc_enabled = args.vnc != "None"
|
|
|
|
g.vnc_port = args.vnc
|
|
|
|
g.update_version = args.update_version
|
|
|
|
# global variables used later in the code
|
|
|
|
g.islinux = platform == "linux" # if the computer running this program is Linux, it allow more things
|
|
|
|
g.start_time = time()
|
2022-10-24 20:08:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
# path configurations
|
2023-06-17 16:52:47 +02:00
|
|
|
g.mot_path = "/usr/share/dict/french"
|
2023-06-26 21:49:30 +02:00
|
|
|
g.credential_path = "/app/MsRewards-Reborn/user_data/login.csv"
|
2023-06-17 16:52:47 +02:00
|
|
|
|
2022-10-24 20:08:33 +02:00
|
|
|
|
2023-06-17 16:52:47 +02:00
|
|
|
discord_conf = config[args.config]["discord"]
|
2022-10-24 20:08:33 +02:00
|
|
|
|
|
|
|
# discord configuration
|
2023-06-17 16:52:47 +02:00
|
|
|
g.discord_success_link = discord[discord_conf]["successL"]
|
|
|
|
g.discord_error_link = discord[discord_conf]["errorsL"]
|
|
|
|
g.discord_enabled_error = discord[discord_conf]["errorsT"] == "True"
|
|
|
|
g.discord_enabled_success = discord[discord_conf]["successT"] == "True"
|
|
|
|
|
|
|
|
g.avatar_url = settings["avatarlink"]
|
|
|
|
|
2023-09-30 17:23:37 +02:00
|
|
|
if not very_custom :
|
|
|
|
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())
|
|
|
|
else :
|
|
|
|
webhookFailure = FakeWebHook()
|
|
|
|
webhookSuccess = FakeWebHook()
|
2022-10-24 20:08:33 +02:00
|
|
|
# base settings
|
2023-06-17 16:52:47 +02:00
|
|
|
g.discord_embed = False # send new point value in an embed, fixed for now
|
|
|
|
g.headless = False
|
2022-10-24 20:08:33 +02:00
|
|
|
|
|
|
|
# proxy settings
|
2023-06-17 16:52:47 +02:00
|
|
|
g.proxy_enabled = config[args.config]["proxy"] != "-1"
|
|
|
|
if g.proxy_enabled :
|
|
|
|
g.proxy_address = proxy[config[args.config]["proxy"]]["address"]
|
|
|
|
g.proxy_port = proxy[config[args.config]["proxy"]]["port"]
|
2022-10-24 20:08:33 +02:00
|
|
|
|
2023-05-07 23:26:27 +02:00
|
|
|
|
2023-06-17 16:52:47 +02:00
|
|
|
g.fast = False
|
|
|
|
|
|
|
|
# list of words
|
2023-04-15 11:03:47 +02:00
|
|
|
h = open(g.mot_path, "r", encoding="utf-8")
|
|
|
|
lines = h.readlines()
|
2022-10-24 20:08:33 +02:00
|
|
|
if len(lines) < 3 :
|
|
|
|
Liste_de_mot = list(lines[0].split(","))
|
|
|
|
else :
|
|
|
|
Liste_de_mot = [x.replace('\n', "") for x in lines]
|
2023-04-15 11:03:47 +02:00
|
|
|
h.close()
|
2022-10-24 20:08:33 +02:00
|
|
|
|
|
|
|
|
2023-06-17 16:52:47 +02:00
|
|
|
Credentials = [ (config[args.config]['accounts'][x]["mail"],config[args.config]['accounts'][x]["pwd"],config[args.config]['accounts'][x]["2fa"]) for x in config[args.config]['accounts']]
|
2023-04-15 11:03:47 +02:00
|
|
|
g._cred = Credentials
|
|
|
|
|
|
|
|
if g.proxy_enabled :
|
|
|
|
setup_proxy(g.proxy_address,g.proxy_port)
|