def getTarget( self ): ''' @return: The profile target with the options (targetOS, targetFramework, etc.) ''' # Get the plugin defaults with their types targetInstance = factory('core.controllers.targetSettings') options = targetInstance.getOptions() for section in self._config.sections(): # Section is something like audit.xss or discovery.webSpider # or [profile] or [target] if section == 'target': for option in self._config.options(section): options[option].setValue( self._config.get(section, option) ) return options
def getPluginOptions( self, pluginType, pluginName ): ''' @return: A dict with the options for a plugin. For example: { 'LICENSE_KEY':'AAAA' } ''' # Get the plugin defaults with their types pluginInstance = factory('plugins.' + pluginType + '.' + pluginName ) optionsMap = pluginInstance.getOptions() for section in self._config.sections(): # Section is something like audit.xss or discovery.webSpider try: type, name = section.split('.') except: pass else: if type == pluginType and name == pluginName: for option in self._config.options(section): try: value = self._config.get(section, option) except KeyError,k: # We should never get here... raise w3afException('The option "' + option + '" is unknown for the "'+ pluginName + '" plugin.') else: optionsMap[option].setValue(value)