''' miscSettings.py Copyright 2006 Andres Riancho This file is part of w3af, w3af.sourceforge.net . w3af is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License. w3af is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with w3af; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ''' from core.controllers.configurable import configurable import core.data.kb.config as cf from core.controllers.misc.parseOptions import parseOptions class miscSettings(configurable): ''' A class that acts as an interface for the user interfaces, so they can configure w3af settings using getOptionsXML and SetOptions. ''' def __init__( self ): # User configured variables self._fuzzCookie = False self._fuzzFileContent = True self._fuzzFileContentExtension = 'txt' self._autoDependencies = True self._maxDepth = 10 self._maxThreads = 0 self._fuzzableHeaders = [] self._maxDiscoveryLoops = 500 cf.cf.save('fuzzableCookie', self._fuzzCookie ) cf.cf.save('fuzzFileContent', self._fuzzFileContent ) cf.cf.save('fuzzFCExt', self._fuzzFileContentExtension ) cf.cf.save('autoDependencies', self._autoDependencies ) cf.cf.save('maxDepth', self._maxDepth ) cf.cf.save('maxThreads', self._maxThreads ) cf.cf.save('fuzzableHeaders', self._fuzzableHeaders ) cf.cf.save('maxDiscoveryLoops', self._maxDiscoveryLoops ) def getOptionsXML(self): ''' This method returns a XML containing the Options that the plugin has. Using this XML the framework will build a window, a menu, or some other input method to retrieve the info from the user. The XML has to validate against the xml schema file located at : w3af/core/ui/userInterface.dtd @return: XML with the plugin options. ''' return '\ \ \ \ \ \ \ \ \ \ \ ' def setOptions( self, OptionMap ): ''' This method sets all the options that are configured using the user interface generated by the framework using the result of getOptionsXML(). @parameter OptionMap: A dictionary with the options for the plugin. @return: No value is returned. ''' f00, OptionMap = parseOptions( 'misc-settings', OptionMap ) cf.cf.save('fuzzableCookie', OptionMap['fuzzCookie'] ) cf.cf.save('fuzzFileContent', OptionMap['fuzzFileContent'] ) cf.cf.save('fuzzFCExt', OptionMap['fuzzFCExt'] ) cf.cf.save('autoDependencies', OptionMap['autoDependencies'] ) cf.cf.save('maxDepth', OptionMap['maxDepth'] ) cf.cf.save('maxThreads', OptionMap['maxThreads'] ) cf.cf.save('fuzzableHeaders', OptionMap['fuzzableHeaders'] ) cf.cf.save('maxDiscoveryLoops', OptionMap['maxDiscoveryLoops'] ) # This is an undercover call to __init__ :) , so I can set all default parameters. miscSettings()