49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
import src.tools as tools
|
|
import src.monitor as monitor
|
|
import src.proxy as proxy
|
|
|
|
import os
|
|
import glob
|
|
import json
|
|
from colorama import Style, Fore, init
|
|
|
|
|
|
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)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
num_monitors = 10
|
|
|
|
# Initialize Colorama
|
|
init(autoreset=True)
|
|
|
|
readsites()
|
|
|
|
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)
|