code refactoring

This commit is contained in:
Bernardo Damele 2013-01-14 10:22:38 +00:00
parent 4acb281414
commit 8125fe90a7
3 changed files with 25 additions and 42 deletions

View File

@ -27,7 +27,7 @@ from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger
from lib.core.data import paths from lib.core.data import paths
from lib.core.common import unhandledExceptionMessage from lib.core.common import unhandledExceptionMessage
from lib.core.exception import exceptionsTuple from lib.core.exception import SqlmapBaseException
from lib.core.exception import SqlmapSilentQuitException from lib.core.exception import SqlmapSilentQuitException
from lib.core.exception import SqlmapUserQuitException from lib.core.exception import SqlmapUserQuitException
from lib.core.option import init from lib.core.option import init
@ -79,7 +79,7 @@ def main():
except (SqlmapSilentQuitException, bdb.BdbQuit): except (SqlmapSilentQuitException, bdb.BdbQuit):
pass pass
except exceptionsTuple, e: except SqlmapBaseException, e:
e = getUnicode(e) e = getUnicode(e)
logger.critical(e) logger.critical(e)
sys.exit(1) sys.exit(1)

View File

@ -41,7 +41,7 @@ from lib.core.enums import HEURISTIC_TEST
from lib.core.enums import HTTPMETHOD from lib.core.enums import HTTPMETHOD
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import PLACE from lib.core.enums import PLACE
from lib.core.exception import exceptionsTuple from lib.core.exception import SqlmapBaseException
from lib.core.exception import SqlmapNoneDataException from lib.core.exception import SqlmapNoneDataException
from lib.core.exception import SqlmapNotVulnerableException from lib.core.exception import SqlmapNotVulnerableException
from lib.core.exception import SqlmapSilentQuitException from lib.core.exception import SqlmapSilentQuitException
@ -591,7 +591,7 @@ def start():
except SqlmapSilentQuitException: except SqlmapSilentQuitException:
raise raise
except exceptionsTuple, e: except SqlmapBaseException, e:
e = getUnicode(e) e = getUnicode(e)
if conf.multipleTargets: if conf.multipleTargets:

View File

@ -5,79 +5,62 @@ Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission See the file 'doc/COPYING' for copying permission
""" """
class SqlmapCompressionException(Exception): class SqlmapBaseException(Exception):
pass pass
class SqlmapConnectionException(Exception): class SqlmapCompressionException(SqlmapBaseException):
pass pass
class SqlmapDataException(Exception): class SqlmapConnectionException(SqlmapBaseException):
pass pass
class SqlmapFilePathException(Exception): class SqlmapDataException(SqlmapBaseException):
pass pass
class SqlmapGenericException(Exception): class SqlmapFilePathException(SqlmapBaseException):
pass pass
class SqlmapMissingDependence(Exception): class SqlmapGenericException(SqlmapBaseException):
pass pass
class SqlmapMissingMandatoryOptionException(Exception): class SqlmapMissingDependence(SqlmapBaseException):
pass pass
class SqlmapMissingPrivileges(Exception): class SqlmapMissingMandatoryOptionException(SqlmapBaseException):
pass pass
class SqlmapNoneDataException(Exception): class SqlmapMissingPrivileges(SqlmapBaseException):
pass pass
class SqlmapNotVulnerableException(Exception): class SqlmapNoneDataException(SqlmapBaseException):
pass pass
class SqlmapSilentQuitException(Exception): class SqlmapNotVulnerableException(SqlmapBaseException):
pass pass
class SqlmapUserQuitException(Exception): class SqlmapSilentQuitException(SqlmapBaseException):
pass pass
class SqlmapRegExprException(Exception): class SqlmapUserQuitException(SqlmapBaseException):
pass pass
class SqlmapSyntaxException(Exception): class SqlmapRegExprException(SqlmapBaseException):
pass pass
class SqlmapThreadException(Exception): class SqlmapSyntaxException(SqlmapBaseException):
pass pass
class SqlmapUndefinedMethod(Exception): class SqlmapThreadException(SqlmapBaseException):
pass pass
class SqlmapUnsupportedDBMSException(Exception): class SqlmapUndefinedMethod(SqlmapBaseException):
pass pass
class SqlmapUnsupportedFeatureException(Exception): class SqlmapUnsupportedDBMSException(SqlmapBaseException):
pass pass
class SqlmapValueException(Exception): class SqlmapUnsupportedFeatureException(SqlmapBaseException):
pass pass
exceptionsTuple = ( class SqlmapValueException(SqlmapBaseException):
SqlmapCompressionException, pass
SqlmapConnectionException,
SqlmapDataException,
SqlmapFilePathException,
SqlmapGenericException,
SqlmapMissingDependence,
SqlmapMissingMandatoryOptionException,
SqlmapNoneDataException,
SqlmapRegExprException,
SqlmapSyntaxException,
SqlmapUndefinedMethod,
SqlmapMissingPrivileges,
SqlmapNotVulnerableException,
SqlmapThreadException,
SqlmapUnsupportedDBMSException,
SqlmapUnsupportedFeatureException,
SqlmapValueException,
)