Merge branch 'master' of github.com:sqlmapproject/sqlmap

This commit is contained in:
Miroslav Stampar 2013-01-13 16:23:09 +01:00
commit 92ea8841f8
4 changed files with 23 additions and 16 deletions

View File

@ -37,6 +37,8 @@ from lib.core.settings import TRIM_STDOUT_DUMP_SIZE
from lib.core.settings import UNICODE_ENCODING from lib.core.settings import UNICODE_ENCODING
from thirdparty.magic import magic from thirdparty.magic import magic
from extra.safe2bin.safe2bin import safechardecode
class Dump(object): class Dump(object):
""" """
This class defines methods used to parse and output the results This class defines methods used to parse and output the results
@ -478,13 +480,11 @@ class Dump(object):
self._write("| %s%s" % (value, blank), newline=False, console=console) self._write("| %s%s" % (value, blank), newline=False, console=console)
#if len(value) > 10 and r'\x' in value: #if len(value) > 10 and r'\x' in value:
#mimetype = magic.from_buffer(value, mime=True) # mimetype = magic.from_buffer(value, mime=True)
#if mimetype.startswith("application") or mimetype.startswith("image"): # if mimetype.startswith("application") or mimetype.startswith("image"):
#with open("%s%s%s" % (dumpDbPath, os.sep, "%s-%d.bin" % (column, randomInt(8))), "wb") as f: # with codecs.open("%s%s%s" % (dumpDbPath, os.sep, "%s-%d.bin" % (column, randomInt(8))), "wb", UNICODE_ENCODING) as f:
#from extra.safe2bin.safe2bin import safechardecode # _ = safechardecode(value)
#_ = _.encode(UNICODE_ENCODING) # f.write(_)
#_ = safechardecode(value)
#f.write(_)
if conf.dumpFormat == DUMP_FORMAT.CSV: if conf.dumpFormat == DUMP_FORMAT.CSV:
if field == fields: if field == fields:

View File

@ -51,24 +51,31 @@ class Connector(GenericConnector):
try: try:
return self.cursor.fetchall() return self.cursor.fetchall()
except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg: except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg) logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
return None return None
def execute(self, query): def execute(self, query):
retVal = False
try: try:
self.cursor.execute(utf8encode(query)) self.cursor.execute(utf8encode(query))
retVal = True
except (pymssql.OperationalError, pymssql.ProgrammingError), msg: except (pymssql.OperationalError, pymssql.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg) logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
except pymssql.InternalError, msg: except pymssql.InternalError, msg:
raise SqlmapConnectionException(msg) raise SqlmapConnectionException(msg)
return retVal
def select(self, query): def select(self, query):
self.execute(query) retVal = None
value = self.fetchall()
try: if self.execute(query):
self.connector.commit() retVal = self.fetchall()
except pymssql.OperationalError:
pass
return value try:
self.connector.commit()
except pymssql.OperationalError:
pass
return retVal

0
sqlmap.py Normal file → Executable file
View File

0
sqlmapapi.py Normal file → Executable file
View File