2022-10-24 20:08:33 +02:00
|
|
|
#!/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
|
2022-11-01 11:09:12 +01:00
|
|
|
from random import shuffle
|
2022-10-24 20:08:33 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
Setup for option, like --override or --fulllog
|
|
|
|
"""
|
|
|
|
|
|
|
|
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"
|
|
|
|
)
|
|
|
|
|
2023-01-14 16:56:33 +01:00
|
|
|
parser.add_argument(
|
|
|
|
"--claim",
|
|
|
|
help="show claim",
|
|
|
|
dest="claim",
|
|
|
|
action="store_true"
|
|
|
|
)
|
2022-10-31 15:32:39 +01:00
|
|
|
|
2022-10-24 20:08:33 +02:00
|
|
|
parser.add_argument(
|
2022-10-31 15:32:39 +01:00
|
|
|
"-l",
|
|
|
|
"--log",
|
|
|
|
dest="log",
|
|
|
|
help="enable logging in terminal",
|
|
|
|
action="store_true"
|
2022-10-24 20:08:33 +02:00
|
|
|
)
|
2022-10-31 15:32:39 +01:00
|
|
|
|
2022-10-24 20:08:33 +02:00
|
|
|
parser.add_argument(
|
|
|
|
"-fl",
|
|
|
|
"--fulllog",
|
|
|
|
dest="fulllog",
|
|
|
|
help="enable full logging in discord",
|
|
|
|
action="store_true",
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
2022-10-31 15:32:39 +01:00
|
|
|
"-r",
|
|
|
|
"--risky",
|
|
|
|
help="make the program faster, probably better risk of ban",
|
|
|
|
dest="fast",
|
|
|
|
action="store_true"
|
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",
|
|
|
|
type=argparse.FileType('r')
|
2022-10-24 20:08:33 +02:00
|
|
|
)
|
|
|
|
|
2022-11-16 18:12:43 +01:00
|
|
|
parser.add_argument(
|
|
|
|
"-a",
|
|
|
|
"--add-points",
|
|
|
|
help="Add points to the database from a file and exit",
|
|
|
|
dest="points_file",
|
|
|
|
default=""
|
|
|
|
)
|
|
|
|
|
2023-02-25 19:05:47 +01:00
|
|
|
parser.add_argument(
|
|
|
|
"-v",
|
|
|
|
"--vnc",
|
|
|
|
help="enable VNC",
|
|
|
|
dest="vnc",
|
|
|
|
default="None"
|
|
|
|
)
|
|
|
|
|
2022-10-24 20:08:33 +02:00
|
|
|
args = parser.parse_args()
|
2023-01-14 16:56:33 +01:00
|
|
|
CLAIM = args.claim
|
2022-10-24 20:08:33 +02:00
|
|
|
CUSTOM_START = args.override
|
2022-10-31 15:32:39 +01:00
|
|
|
UNBAN = args.unban
|
2022-10-24 20:08:33 +02:00
|
|
|
LOG = args.log
|
|
|
|
FULL_LOG = args.fulllog
|
|
|
|
FAST = args.fast
|
|
|
|
if CUSTOM_START :
|
|
|
|
LOG = True
|
2023-02-25 19:05:47 +01:00
|
|
|
VNC_ENABLED = args.vnc != "None"
|
|
|
|
VNC_PORT = args.vnc
|
2022-11-16 18:12:43 +01:00
|
|
|
POINTS_FILE = args.points_file
|
|
|
|
|
|
|
|
# global variables used later in the code
|
2022-10-24 20:08:33 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
#reading configuration
|
|
|
|
|
2022-10-25 09:48:34 +02:00
|
|
|
config_path = f"{path.abspath(path.dirname(path.dirname( __file__ )))}/user_data/config.cfg"
|
2022-10-24 20:08:33 +02:00
|
|
|
if args.config :
|
|
|
|
config_path = path.abspath(args.config.name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config = configparser.ConfigParser()
|
|
|
|
config.read(config_path)
|
|
|
|
|
|
|
|
# path configurations
|
|
|
|
MotPath = config["PATH"]["motpath"]
|
|
|
|
CREDENTIALS_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())
|
|
|
|
|
|
|
|
# base settings
|
|
|
|
FidelityLink = config["SETTINGS"]["FidelityLink"]
|
|
|
|
DISCORD_EMBED = config["SETTINGS"]["embeds"] == "True" #print new point value in an embed
|
|
|
|
Headless = config["SETTINGS"]["headless"] == "True"
|
|
|
|
|
|
|
|
# proxy settings
|
|
|
|
proxy_enabled = config["PROXY"]["proxy_enabled"] == "True"
|
|
|
|
proxy_address = config["PROXY"]["url"]
|
|
|
|
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"]
|
2022-11-11 11:29:32 +01:00
|
|
|
CLAIM_AMAZON = config["OTHER"]["claim_amazon"] == "True"
|
2022-10-24 20:08:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
g = open(MotPath, "r", encoding="utf-8")
|
|
|
|
lines = g.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()
|
|
|
|
|
|
|
|
|
2022-10-31 15:32:39 +01:00
|
|
|
with open(CREDENTIALS_PATH) as f:
|
|
|
|
reader = reader(f)
|
|
|
|
Credentials = list(reader)
|
2022-11-16 18:12:43 +01:00
|
|
|
shuffle(Credentials)
|