import json from discord import Webhook, RequestsWebhookAdapter from modules.Classes.DiscordConfig import DiscordConfig, FakeWebHook from modules.Classes.Driver import Driver from modules.Classes.Proxy import Proxy from modules.Classes.UserCredentials import UserCredentials from modules.Classes.WordList import WordList class Config: def __init__(self, args): """ open config file """ with open("/app/MsRewards-Reborn/user_data/discord.json", "r") as inFile: discord = json.load(inFile) with open("/app/MsRewards-Reborn/user_data/settings.json", "r") as inFile: settings = json.load(inFile) with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile: proxy = json.load(inFile) with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: config = json.load(inFile) """ setup standalone stuff """ self.args = args self.start = "json" if args.json else "default" self.json_entry = args.json.replace("'", "\"") self.wordlist = WordList("/usr/share/dict/french") self.vnc = args.vnc self.version = args.update_version self.WebDriver = Driver() self.display = None """ setup UserCredential """ self.UserCredentials = UserCredentials() with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: configs = json.load(inFile) for i in configs[str(args.config)]["accounts"]: d = configs[str(args.config)]["accounts"][i] self.UserCredentials.add(d["mail"], d["pwd"], d["2fa"]) """ Setup discord """ self.discord = DiscordConfig() self.discord.avatar_url = settings["avatarlink"] self.discord.wh_link = discord[config[args.config]["discord"]]["errorsL"] if self.discord.wh_link != "": self.discord.wh = Webhook.from_url(self.discord.wh_link, adapter=RequestsWebhookAdapter()) else: self.discord.wh = FakeWebHook() """ setup proxy """ proxy_conf = config[args.config]["proxy"] if proxy_conf != -1: proxy_address = proxy[config[args.config]["proxy"]]["address"] proxy_port = proxy[config[args.config]["proxy"]]["port"] else: proxy_address = "" proxy_port = "" self.proxy = Proxy(proxy_conf, proxy_address, proxy_port) def vnc_enabled(self): return self.vnc != "None" def set_display(self, display): self.display = display def has_been_updated(self): return self.version != "None"