import src.tools as tools import src.monitor as monitor import src.proxy as proxy import os import glob import json from dotenv import load_dotenv from colorama import Style, Fore, init def initialize(): # Init Environment load_dotenv() # Init Colorama init(autoreset=True) def readsites(sitepath=None): print(f"Checking Sitedata...\n{tools.spacer}") dod = {} if sitepath: sitedir = sitepath else: rootdir = os.path.dirname(os.path.abspath(__file__)) sitedir = rootdir + r"\sites" for sitefile in glob.glob(sitedir + r"\*.json"): sfn = os.path.basename(sitefile) site, ext = os.path.splitext(sfn) print(f"Parsing {sfn}") with open(sitefile, 'r') as f: data = json.load(f) dod[site] = data # print(f"DEBUG: {dod}") print(tools.spacer) def proxytest(): print(f"Creating Proxys...\n{tools.spacer}") one = proxy.Proxy one.name = "TEST PROXY" one.usr = os.getenv("PROXYUSR") one.pwd = os.getenv("PROXYPW") one.url = os.getenv("PROXYURL") one.port = os.getenv("PROXYPORT") proxy.test(one) # proxy.testurl(one, "http://www.whatismyproxy.com/") print(tools.spacer) def monitortest(n=1): print(f"Creating {tools.keyword(n)} new Monitor(s)...\n{tools.spacer}") for i in range(0, n): mon = monitor.Monitor() mon.name = f"Monitor {i}" mon.url = "test" print(f"{Fore.MAGENTA}{mon.name}{Style.RESET_ALL} |" f" {tools.keyword('URL')}({mon.url}) {tools.keyword('PROXY')}({mon.proxy})") print(tools.spacer) if __name__ == "__main__": tools.clear() initialize() readsites() proxytest() monitortest()