Ejemplo n.º 1
0
 def GetRecordConfig(self):
     record_config = {}
     record_config['ROOT_DIR'] = self.config.RootDir
     #record_config['OUTPUT_DIR'] = os.path.join(record_config['ROOT_DIR'], self.config.GetOutputDirForTargets())
     #record_config['TARGET_DB'] = os.path.join(record_config['ROOT_DIR'], self.config.FrameworkConfigGetDBPath('TCONFIG_DB_PATH'))
     record_config['CREATE_SCRIPT_PATH'] = os.path.join(record_config['ROOT_DIR'], "zest", "zest_create.sh")
     record_config['RUNNER_SCRIPT_PATH'] = os.path.join(record_config['ROOT_DIR'], "zest", "zest_runner.sh")
     record_config['ZEST_DIR'] = os.path.join(record_config['ROOT_DIR'], self.config.FrameworkConfigGet("OUTPUT_PATH"), "misc", "recorded_scripts")
     FileOperations.create_missing_dirs(record_config['ZEST_DIR'])
     return record_config
Ejemplo n.º 2
0
 def create_dirs(self):
     """
     Any directory which needs to be created at the start of owtf
     needs to be placed inside here. No hardcoding of paths please
     """
     # Logs folder creation
     if not os.path.exists(self.config.FrameworkConfigGetLogsDir()):
         FileOperations.create_missing_dirs(self.config.FrameworkConfigGetLogsDir())
     # Temporary storage directories creation
     self.create_temp_storage_dirs()
Ejemplo n.º 3
0
 def GetTargetConfig(self, target_id):
     target_config = {}
     self.target.SetTarget(target_id)
     target_config['ROOT_DIR'] = self.config.RootDir
     target_config['OUTPUT_DIR'] = os.path.join(target_config['ROOT_DIR'], self.target.PathConfig['url_output'])
     #target_config['TARGET_DB'] = self.config.FrameworkConfigGet('TCONFIG_DB_PATH')
     target_config['ZEST_DIR'] = os.path.join(target_config['OUTPUT_DIR'], "zest")
     target_config['CREATE_SCRIPT_PATH'] = os.path.join(target_config['ROOT_DIR'], "zest", "zest_create.sh")
     target_config['RUNNER_SCRIPT_PATH'] = os.path.join(target_config['ROOT_DIR'], "zest","zest_runner.sh")
     target_config['HOST_AND_PORT'] = ((self.target.GetTargetConfigForID(target_id))['host_name'] 
                                           + ":" + (self.target.GetTargetConfigForID(target_id))['port_number'])
     FileOperations.create_missing_dirs(target_config['ZEST_DIR'])
     return target_config
Ejemplo n.º 4
0
 def GetRecordConfig(self):
     record_config = {}
     record_config['ROOT_DIR'] = self.config.RootDir
     record_config['CREATE_SCRIPT_PATH'] = os.path.join(
         record_config['ROOT_DIR'], "zest", "zest_create.sh")
     record_config['RUNNER_SCRIPT_PATH'] = os.path.join(
         record_config['ROOT_DIR'], "zest", "zest_runner.sh")
     record_config['ZEST_DIR'] = os.path.join(
         record_config['ROOT_DIR'],
         self.config.FrameworkConfigGet("OUTPUT_PATH"), "misc",
         "recorded_scripts")
     FileOperations.create_missing_dirs(record_config['ZEST_DIR'])
     return record_config
Ejemplo n.º 5
0
 def GetRecordConfig(self):
     record_config = {}
     record_config['ROOT_DIR'] = self.config.RootDir
     #record_config['OUTPUT_DIR'] = os.path.join(record_config['ROOT_DIR'], self.config.GetOutputDirForTargets())
     #record_config['TARGET_DB'] = os.path.join(record_config['ROOT_DIR'], self.config.FrameworkConfigGetDBPath('TCONFIG_DB_PATH'))
     record_config['CREATE_SCRIPT_PATH'] = os.path.join(
         record_config['ROOT_DIR'], "zest", "zest_create.sh")
     record_config['RUNNER_SCRIPT_PATH'] = os.path.join(
         record_config['ROOT_DIR'], "zest", "zest_runner.sh")
     record_config['ZEST_DIR'] = os.path.join(
         record_config['ROOT_DIR'],
         self.config.FrameworkConfigGet("OUTPUT_PATH"), "misc",
         "recorded_scripts")
     FileOperations.create_missing_dirs(record_config['ZEST_DIR'])
     return record_config
Ejemplo n.º 6
0
 def GetTargetConfig(self, target_id):
     target_config = {}
     self.target.SetTarget(target_id)
     target_config['ROOT_DIR'] = self.config.RootDir
     target_config['OUTPUT_DIR'] = os.path.join(
         target_config['ROOT_DIR'], self.target.PathConfig['url_output'])
     target_config['ZEST_DIR'] = os.path.join(target_config['OUTPUT_DIR'],
                                              "zest")
     target_config['CREATE_SCRIPT_PATH'] = os.path.join(
         target_config['ROOT_DIR'], "zest", "zest_create.sh")
     target_config['RUNNER_SCRIPT_PATH'] = os.path.join(
         target_config['ROOT_DIR'], "zest", "zest_runner.sh")
     target_config['HOST_AND_PORT'] = (
         "%s:%s" %
         (self.target.GetTargetConfigForID(target_id)['host_name'],
          self.target.GetTargetConfigForID(target_id)['port_number']))
     FileOperations.create_missing_dirs(target_config['ZEST_DIR'])
     return target_config
Ejemplo n.º 7
0
    def DeriveOutputSettingsFromURL(self, target_URL):
        # Set the output directory.
        self.Set(
            'host_output',
            self.Get('OUTPUT_PATH') + "/" + self.Get('host_ip'))
        # Set the output directory.
        self.Set(
            'port_output',
            self.Get('host_output') + "/" + self.Get('port_number'))
        URL_info_ID = target_URL.replace('/','_').replace(':','')
        # Set the URL output directory (plugins will save their data here).
        self.Set(
            'url_output',
            self.Get('port_output') + "/" + URL_info_ID + "/")
        # Set the partial results path.
        self.Set('partial_url_output_path', self.Get('url_output')+'partial')
        self.Set(
            'PARTIAL_REPORT_REGISTER',
            self.Get('partial_url_output_path') + "/partial_report_register.txt")

        # Tested in FF 8: Different directory = Different localStorage!! -> All
        # localStorage-dependent reports must be on the same directory.
        # IMPORTANT: For localStorage to work Url reports must be on the same
        # directory.
        self.Set(
            'HTML_DETAILED_REPORT_PATH',
            self.Get('OUTPUT_PATH') + "/" + URL_info_ID + ".html")
        # IMPORTANT: For localStorage to work Url reports must be on the same
        # directory.
        self.Set(
            'URL_REPORT_LINK_PATH',
            self.Get('OUTPUT_PATH') + "/index.html")

        if not self.Get('SIMULATION'):
            FileOperations.create_missing_dirs(self.Get('host_output'))

        # URL Analysis DBs
        # URL DBs: Distintion between vetted, confirmed-to-exist, in
        # transaction DB URLs and potential URLs.
        self.InitHTTPDBs(self.Get('url_output'))
Ejemplo n.º 8
0
    def DeriveOutputSettingsFromURL(self, target_URL):
        # Set the output directory.
        self.Set('host_output',
                 self.Get('OUTPUT_PATH') + "/" + self.Get('host_ip'))
        # Set the output directory.
        self.Set('port_output',
                 self.Get('host_output') + "/" + self.Get('port_number'))
        URL_info_ID = target_URL.replace('/', '_').replace(':', '')
        # Set the URL output directory (plugins will save their data here).
        self.Set('url_output',
                 self.Get('port_output') + "/" + URL_info_ID + "/")
        # Set the partial results path.
        self.Set('partial_url_output_path', self.Get('url_output') + 'partial')
        self.Set(
            'PARTIAL_REPORT_REGISTER',
            self.Get('partial_url_output_path') +
            "/partial_report_register.txt")

        # Tested in FF 8: Different directory = Different localStorage!! -> All
        # localStorage-dependent reports must be on the same directory.
        # IMPORTANT: For localStorage to work Url reports must be on the same
        # directory.
        self.Set('HTML_DETAILED_REPORT_PATH',
                 self.Get('OUTPUT_PATH') + "/" + URL_info_ID + ".html")
        # IMPORTANT: For localStorage to work Url reports must be on the same
        # directory.
        self.Set('URL_REPORT_LINK_PATH',
                 self.Get('OUTPUT_PATH') + "/index.html")

        if not self.Get('SIMULATION'):
            FileOperations.create_missing_dirs(self.Get('host_output'))

        # URL Analysis DBs
        # URL DBs: Distintion between vetted, confirmed-to-exist, in
        # transaction DB URLs and potential URLs.
        self.InitHTTPDBs(self.Get('url_output'))
Ejemplo n.º 9
0
 def CreateOutputDirForTarget(self, target_URL):
     FileOperations.create_missing_dirs(
         self.GetOutputDirForTarget(target_URL))
Ejemplo n.º 10
0
 def CreateOutputDirForTarget(self, target_URL):
     FileOperations.create_missing_dirs(self.GetOutputDirForTarget(target_URL))
Ejemplo n.º 11
0
 def InitPluginOutputDir(self, PluginInfo):
     PluginOutputDir = self.SetConfigPluginOutputDir(PluginInfo)
     FileOperations.create_missing_dirs(
         PluginOutputDir
     )  # Create output dir so that scripts can cd to it :)
     return PluginOutputDir
Ejemplo n.º 12
0
 def InitPluginOutputDir(self, PluginInfo):
     PluginOutputDir = self.SetConfigPluginOutputDir(PluginInfo)
     FileOperations.create_missing_dirs(PluginOutputDir)  # Create output dir so that scripts can cd to it :)
     return PluginOutputDir