2020-04-10 22:41:42 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
# Python imports
|
|
|
|
import sys, os, json
|
|
|
|
|
|
|
|
|
|
|
|
# Application imports
|
|
|
|
from core import Context
|
|
|
|
|
|
|
|
|
|
|
|
class Main(Context):
|
2020-04-11 20:00:22 +00:00
|
|
|
"""
|
|
|
|
This is the start that pulls the Context in and its mixins.
|
|
|
|
Load a command file from here or another class then call
|
|
|
|
respective method names and pass data as needed.
|
|
|
|
"""
|
2020-04-10 22:41:42 +00:00
|
|
|
def __init__(self, args):
|
2020-04-11 20:00:22 +00:00
|
|
|
"""
|
|
|
|
Initialize it all...
|
|
|
|
"""
|
2020-04-10 22:41:42 +00:00
|
|
|
super().__init__(args)
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
with open(args.file) as f:
|
|
|
|
self.logger.debug("Opened command file...")
|
|
|
|
# Fill out your logic for parsing a command file...
|
|
|
|
# Then call the "call_method" methid to run a command against that logic.
|
|
|
|
pass
|
|
|
|
|
|
|
|
if "true" in args.persist.lower():
|
|
|
|
input("Press 'Enter' key to close the browser...")
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
self.logger.debug(e, exec_info=True)
|
|
|
|
|
|
|
|
self.driver.quit()
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
def call_method(self, method_name, data = None):
|
|
|
|
mName = str(method_name)
|
|
|
|
method = getattr(self, mName, lambda data: "No valid key passed...\nkey= " + mName + "\nargs= " + data)
|
|
|
|
return method(data) if data else method()
|