''' vuln.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.w3afException import w3afException from core.data.kb.info import info as info from core.data.fuzzer.mutant import mutant as mutant class vuln(info): ''' This class represents a web vulnerability. @author: Andres Riancho ( andres.riancho@gmail.com ) ''' def __init__( self, dataObj=None ): info.__init__( self ) if isinstance( dataObj, mutant ): self.setMethod( dataObj.getMethod() ) # mutants dont have an ID, and sometimes I want to # create an instance of a vuln based on a mutant #self.setId( response.getId() ) self.setDc( dataObj.getDc() ) self.setVar( dataObj.getVar() ) self.setURI( dataObj.getURI() ) self.setMutant( dataObj ) else: self._method = None self._id = None self._dc = None self._severity = None self._variable = None self._mutant = None def setMutant( self, mutant ): ''' Sets the mutant that created this vuln. ''' self._mutant = mutant def getMutant( self ): return self._mutant def setMethod( self, method ): self._method = method.upper() def setVar( self, variable ): self._variable = variable def setDc( self, dc ): self._dc = dc def setSeverity( self, severity ): self._severity = severity def getMethod( self ): if self._mutant: return self._mutant.getMethod() else: return self._method def getVar( self ): if self._mutant: return self._mutant.getVar() else: return self._variable def getDc( self ): if self._mutant: return self._mutant.getDc() else: return self._dc def getSeverity( self ): return self._severity def getId( self ): ''' This is is the one from the response object that uniquely identifies all requests and responses. ''' return self._id def getDesc( self ): if self._id != None and self._id != 0: return self._desc + ' The vulnerability was found in the request with id ' + str(self._id) + '.' else: return self._desc