示例#1
0
文件: core.py 项目: ovnicraft/owtf
 def __init__(self, RootDir, OwtfPid):
     self.CreateTempStorageDirs(OwtfPid)
     # Tightly coupled, cohesive framework components:
     self.Error = error_handler.ErrorHandler(self)
     self.Shell = blocking_shell.Shell(
         self
     )  # Config needs to find plugins via shell = instantiate shell first
     self.Config = config.Config(RootDir, OwtfPid, self)
     self.Config.Init(
     )  # Now the the config is hooked to the core, init config sub-components
     self.PluginHelper = plugin_helper.PluginHelper(
         self)  # Plugin Helper needs access to automate Plugin tasks
     self.Random = random.Random()
     self.Reporter = reporter.Reporter(
         self)  # Reporter needs access to Core to access Config, etc
     self.Selenium = selenium_handler.Selenium(self)
     self.InteractiveShell = interactive_shell.InteractiveShell(self)
     self.SET = set_handler.SETHandler(self)
     self.SMTP = smtp.SMTP(self)
     self.SMB = smb.SMB(self)
     self.messaging_admin = messaging_admin.message_admin(self)
     self.showOutput = True
     self.TOR_process = None
     # Create internal IPv4 regex following rfc1918
     self.re_ipv4_internal = re.compile(
         r"(^128\.\d{1,3}\.\d{1,3}\.\d{1,3}$)|"
         r"(^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$)|"
         r"(^192\.168\.\d{1,3}\.\d{1,3}$)|"
         r"(^172\.(1[6-9]|2[0-9]|3[0-1])\.[0-9]{1,3}\.[0-9]{1,3})$")
示例#2
0
    def __init__(self, root_dir, owtf_pid):
        """
        [*] Tightly coupled, cohesive framework components
        [*] Order is important

        + IO decorated so as to abort on any permission errors
        + Attach error handler and config
        + Required folders created
        + All other components are attached to core: shell, db etc...
        + Required booleans and attributes are initialised
        + If modules have Init calls, they are run
          Init procedures can exist only if the component can do some
          initialisation only after addition of all components
        """
        # ------------------------ IO decoration ------------------------ #
        self.decorate_io()

        # ------------------------ Error & Config ------------------------ #
        self.Error = error_handler.ErrorHandler(self)
        self.Config = config.Config(root_dir, owtf_pid, self)

        # ----------------------- Directory creation ----------------------- #
        self.create_dirs()
        self.pnh_log_file()  # <-- This is not supposed to be here

        # -------------------- Component attachment -------------------- #
        # (Order is important, if there is a dependency on some other
        # other component please mention in a comment)
        # Shell might be needed in some places
        self.Shell = blocking_shell.Shell(self)
        # As soon as you have config create logger for MainProcess
        self.enable_logging()
        # Plugin Helper needs access to automate Plugin tasks
        self.PluginHelper = plugin_helper.PluginHelper(self)
        # Reporter needs access to Core to access Config, etc
        self.Reporter = reporter.Reporter(self)
        self.Selenium = selenium_handler.Selenium(self)
        self.InteractiveShell = interactive_shell.InteractiveShell(self)
        self.SET = set_handler.SETHandler(self)
        self.SMTP = smtp.SMTP(self)
        self.SMB = smb.SMB(self)
        # DB needs Config for some settings
        self.DB = db.DB(self)
        self.DB.Init()  # Seperate Init because of self reference
        # Timer requires DB
        self.Timer = timer.Timer(self.DB.Config.Get('DATE_TIME_FORMAT'))
        # Zest related components
        self.zest = zest.Zest(self)
        self.zap_api_handler = zap.ZAP_API(self)

        # -------------------- Booleans and attributes -------------------- #
        self.IsIPInternalRegexp = re.compile(
            "^127.\d{123}.\d{123}.\d{123}$|^10.\d{123}.\d{123}.\d{123}$|"
            "^192.168.\d{123}$|^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{123}.[0-9]{123}$"
        )
        self.TOR_process = None

        # --------------------------- Init calls --------------------------- #
        # Nothing as of now
        self.health_check()
示例#3
0
 def __init__(self, RootDir):
     cprint("Loading framework please wait..")
     # Tightly coupled, cohesive framework components:
     self.Error = error_handler.ErrorHandler(self)
     self.Shell = shell.Shell(
         self
     )  # Config needs to find plugins via shell = instantiate shell first
     self.Config = config.Config(RootDir, self)
     self.Config.Init(
     )  # Now the the config is hooked to the core, init config sub-components
     self.PluginHelper = plugin_helper.PluginHelper(
         self)  # Plugin Helper needs access to automate Plugin tasks
     self.Random = random.Random()
     self.IsIPInternalRegexp = re.compile(
         "^127.\d{123}.\d{123}.\d{123}$|^10.\d{123}.\d{123}.\d{123}$|^192.168.\d{123}$|^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{123}.[0-9]{123}$"
     )
     self.Reporter = reporter.Reporter(
         self)  # Reporter needs access to Core to access Config, etc
     self.Selenium = selenium_handler.Selenium(self)
示例#4
0
 def __init__(self, RootDir):
     # Tightly coupled, cohesive framework components:
     self.Error = error_handler.ErrorHandler(self)
     self.Shell = blocking_shell.Shell(
         self
     )  # Config needs to find plugins via shell = instantiate shell first
     self.Config = config.Config(RootDir, self)
     self.Config.Init(
     )  # Now the the config is hooked to the core, init config sub-components
     self.PluginHelper = plugin_helper.PluginHelper(
         self)  # Plugin Helper needs access to automate Plugin tasks
     self.Random = random.Random()
     self.IsIPInternalRegexp = re.compile(
         "^127.\d{123}.\d{123}.\d{123}$|^10.\d{123}.\d{123}.\d{123}$|^192.168.\d{123}$|^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{123}.[0-9]{123}$"
     )
     self.Reporter = reporter.Reporter(
         self)  # Reporter needs access to Core to access Config, etc
     self.Selenium = selenium_handler.Selenium(self)
     self.InteractiveShell = interactive_shell.InteractiveShell(self)
     self.SET = set_handler.SETHandler(self)
     self.SMTP = smtp.SMTP(self)
     self.SMB = smb.SMB(self)
     self.messaging_admin = messaging_admin.message_admin(self)
     self.showOutput = True