MSSWY/main.py

69 lines
1.4 KiB
Python

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(p=None):
dod = {}
if p:
sitedir = p
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(dod)
def proxytest():
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)
if __name__ == "__main__":
num_monitors = 10
initialize()
readsites()
proxytest()
tools.clear()
print(f"Creating {num_monitors} new Monitors...\n{tools.spacer}")
for i in range(0, num_monitors):
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)