Taking some goodies from Pull request #284

This commit is contained in:
Miroslav Stampar 2012-12-06 10:21:53 +01:00
parent 6b39e661a7
commit 0f191f624c
18 changed files with 49 additions and 55 deletions

View File

@ -168,7 +168,6 @@ class XMLDump:
lstElem = self.__doc.createElement(LST_ELEM_NAME) lstElem = self.__doc.createElement(LST_ELEM_NAME)
lstElem.setAttributeNode(self.__createAttribute(TYPE_ATTR, header)) lstElem.setAttributeNode(self.__createAttribute(TYPE_ATTR, header))
if elements: if elements:
if sort: if sort:
try: try:
elements = set(elements) elements = set(elements)
@ -525,6 +524,7 @@ class XMLDump:
self.__write(prettyprint.formatXML(self.__doc, encoding=UNICODE_ENCODING)) self.__write(prettyprint.formatXML(self.__doc, encoding=UNICODE_ENCODING))
self.__outputFP.close() self.__outputFP.close()
def closeDumper(status, msg=""): def closeDumper(status, msg=""):
""" """
Closes the dumper of the session Closes the dumper of the session

View File

@ -18,7 +18,7 @@ class HTTPRangeHandler(urllib2.BaseHandler):
This was extremely simple. The Range header is a HTTP feature to This was extremely simple. The Range header is a HTTP feature to
begin with so all this class does is tell urllib2 that the begin with so all this class does is tell urllib2 that the
"206 Partial Content" reponse from the HTTP server is what we "206 Partial Content" response from the HTTP server is what we
expected. expected.
Example: Example:

View File

@ -39,7 +39,7 @@ def checkDependencies():
import pyodbc import pyodbc
elif dbmsName == DBMS.FIREBIRD: elif dbmsName == DBMS.FIREBIRD:
import kinterbasdb import kinterbasdb
except ImportError, _: except ImportError:
warnMsg = "sqlmap requires '%s' third-party library " % data[1] warnMsg = "sqlmap requires '%s' third-party library " % data[1]
warnMsg += "in order to directly connect to the database " warnMsg += "in order to directly connect to the database "
warnMsg += "%s. Download from %s" % (dbmsName, data[2]) warnMsg += "%s. Download from %s" % (dbmsName, data[2])
@ -55,7 +55,7 @@ def checkDependencies():
import impacket import impacket
debugMsg = "'python-impacket' third-party library is found" debugMsg = "'python-impacket' third-party library is found"
logger.debug(debugMsg) logger.debug(debugMsg)
except ImportError, _: except ImportError:
warnMsg = "sqlmap requires 'python-impacket' third-party library for " warnMsg = "sqlmap requires 'python-impacket' third-party library for "
warnMsg += "out-of-band takeover feature. Download from " warnMsg += "out-of-band takeover feature. Download from "
warnMsg += "http://code.google.com/p/impacket/" warnMsg += "http://code.google.com/p/impacket/"
@ -66,7 +66,7 @@ def checkDependencies():
import ntlm import ntlm
debugMsg = "'python-ntlm' third-party library is found" debugMsg = "'python-ntlm' third-party library is found"
logger.debug(debugMsg) logger.debug(debugMsg)
except ImportError, _: except ImportError:
warnMsg = "sqlmap requires 'python-ntlm' third-party library for " warnMsg = "sqlmap requires 'python-ntlm' third-party library for "
warnMsg += "if you plan to attack a web application behind NTLM " warnMsg += "if you plan to attack a web application behind NTLM "
warnMsg += "authentication. Download from http://code.google.com/p/python-ntlm/" warnMsg += "authentication. Download from http://code.google.com/p/python-ntlm/"
@ -78,7 +78,7 @@ def checkDependencies():
import pyreadline import pyreadline
debugMsg = "'python-pyreadline' third-party library is found" debugMsg = "'python-pyreadline' third-party library is found"
logger.debug(debugMsg) logger.debug(debugMsg)
except ImportError, _: except ImportError:
warnMsg = "sqlmap requires 'pyreadline' third-party library to " warnMsg = "sqlmap requires 'pyreadline' third-party library to "
warnMsg += "be able to take advantage of the sqlmap TAB " warnMsg += "be able to take advantage of the sqlmap TAB "
warnMsg += "completion and history support features in the SQL " warnMsg += "completion and history support features in the SQL "

View File

@ -7,7 +7,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
from crypt import crypt from crypt import crypt
except ImportError, _: except ImportError:
from thirdparty.fcrypt.fcrypt import crypt from thirdparty.fcrypt.fcrypt import crypt
_multiprocessing = None _multiprocessing = None

View File

@ -7,7 +7,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
import pyodbc import pyodbc
except ImportError, _: except ImportError:
pass pass
import logging import logging

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
$Id$
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/) 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
""" """

View File

@ -7,7 +7,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
import ibm_db_dbi import ibm_db_dbi
except ImportError, _: except ImportError:
pass pass
import logging import logging

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
$Id$
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/) 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
""" """

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
$Id$
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/) 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
""" """

View File

@ -7,7 +7,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
import kinterbasdb import kinterbasdb
except ImportError, _: except ImportError:
pass pass
import logging import logging

View File

@ -8,7 +8,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
import _mssql import _mssql
import pymssql import pymssql
except ImportError, _: except ImportError:
pass pass
import logging import logging

View File

@ -7,7 +7,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
import pymysql import pymysql
except ImportError, _: except ImportError:
pass pass
import logging import logging

View File

@ -7,7 +7,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
import cx_Oracle import cx_Oracle
except ImportError, _: except ImportError:
pass pass
import logging import logging

View File

@ -164,4 +164,4 @@ class Enumeration(GenericEnumeration):
errMsg += "for the database users" errMsg += "for the database users"
raise sqlmapNoneDataException, errMsg raise sqlmapNoneDataException, errMsg
return ( kb.data.cachedUsersRoles, areAdmins ) return kb.data.cachedUsersRoles, areAdmins

View File

@ -10,7 +10,7 @@ try:
import psycopg2.extensions import psycopg2.extensions
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY) psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
except ImportError, _: except ImportError:
pass pass
from lib.core.data import logger from lib.core.data import logger

View File

@ -7,7 +7,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
import sqlite3 import sqlite3
except ImportError, _: except ImportError:
pass pass
import logging import logging
@ -53,7 +53,7 @@ class Connector(GenericConnector):
try: try:
try: try:
import sqlite import sqlite
except ImportError, _: except ImportError:
errMsg = "sqlmap requires 'python-sqlite2' third-party library " errMsg = "sqlmap requires 'python-sqlite2' third-party library "
errMsg += "in order to directly connect to the database '%s'" % self.db errMsg += "in order to directly connect to the database '%s'" % self.db
raise sqlmapMissingDependence, errMsg raise sqlmapMissingDependence, errMsg

View File

@ -8,7 +8,7 @@ See the file 'doc/COPYING' for copying permission
try: try:
import _mssql import _mssql
import pymssql import pymssql
except ImportError, _: except ImportError:
pass pass
import logging import logging

View File

@ -129,7 +129,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
try: try:
from impacket import ImpactDecoder from impacket import ImpactDecoder
from impacket import ImpactPacket from impacket import ImpactPacket
except ImportError, _: except ImportError:
errMsg = "sqlmap requires 'impacket' third-party library " errMsg = "sqlmap requires 'impacket' third-party library "
errMsg += "in order to run icmpsh master. Download from " errMsg += "in order to run icmpsh master. Download from "
errMsg += "http://oss.coresecurity.com/projects/impacket.html" errMsg += "http://oss.coresecurity.com/projects/impacket.html"