mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 13:03:50 +03:00
Merge branch 'master' of github.com:sqlmapproject/sqlmap
This commit is contained in:
commit
cfbed43066
|
@ -138,7 +138,7 @@ DBMS_DICT = {
|
||||||
DBMS.MAXDB: (MAXDB_ALIASES, None, None, "maxdb"),
|
DBMS.MAXDB: (MAXDB_ALIASES, None, None, "maxdb"),
|
||||||
DBMS.SYBASE: (SYBASE_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/", "sybase"),
|
DBMS.SYBASE: (SYBASE_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/", "sybase"),
|
||||||
DBMS.DB2: (DB2_ALIASES, "python ibm-db", "http://code.google.com/p/ibm-db/", "ibm_db_sa"),
|
DBMS.DB2: (DB2_ALIASES, "python ibm-db", "http://code.google.com/p/ibm-db/", "ibm_db_sa"),
|
||||||
DBMS.HSQLDB: (HSQLDB_ALIASES, "python jaydebeapi", "https://pypi.python.org/pypi/JayDeBeApi/", None),
|
DBMS.HSQLDB: (HSQLDB_ALIASES, "python jaydebeapi & python jpype", "https://pypi.python.org/pypi/JayDeBeApi/ & http://jpype.sourceforge.net/", None),
|
||||||
}
|
}
|
||||||
|
|
||||||
FROM_DUMMY_TABLE = {
|
FROM_DUMMY_TABLE = {
|
||||||
|
|
|
@ -41,6 +41,9 @@ def checkDependencies():
|
||||||
import kinterbasdb
|
import kinterbasdb
|
||||||
elif dbmsName == DBMS.DB2:
|
elif dbmsName == DBMS.DB2:
|
||||||
import ibm_db_dbi
|
import ibm_db_dbi
|
||||||
|
elif dbmsName == DBMS.HSQLDB:
|
||||||
|
import jaydebeapi
|
||||||
|
import jpype
|
||||||
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 "
|
||||||
|
|
|
@ -6,13 +6,15 @@ See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from thirdparty import jaydebeapi
|
import jaydebeapi
|
||||||
import jpype
|
import jpype
|
||||||
except ImportError, msg:
|
except ImportError, msg:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from lib.core.common import checkFile
|
||||||
|
from lib.core.common import readInput
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
from lib.core.exception import SqlmapConnectionException
|
from lib.core.exception import SqlmapConnectionException
|
||||||
|
@ -20,11 +22,11 @@ from plugins.generic.connector import Connector as GenericConnector
|
||||||
|
|
||||||
class Connector(GenericConnector):
|
class Connector(GenericConnector):
|
||||||
"""
|
"""
|
||||||
Homepage: http://jpype.sourceforge.net/
|
Homepage: https://pypi.python.org/pypi/JayDeBeApi/ & http://jpype.sourceforge.net/
|
||||||
User guide: http://jpype.sourceforge.net/doc/user-guide/userguide.html
|
User guide: https://pypi.python.org/pypi/JayDeBeApi/#usage & http://jpype.sourceforge.net/doc/user-guide/userguide.html
|
||||||
API: http://code.google.com/p/pymysql/
|
API: -
|
||||||
Debian package: <none>
|
Debian package: -
|
||||||
License: Apache License V2.0
|
License: LGPL & Apache License 2.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -33,12 +35,15 @@ class Connector(GenericConnector):
|
||||||
def connect(self):
|
def connect(self):
|
||||||
self.initConnection()
|
self.initConnection()
|
||||||
try:
|
try:
|
||||||
jar = './thirdparty/hsqldb/hsqldb.jar'
|
msg = "what's the location of 'hsqldb.jar'? "
|
||||||
args='-Djava.class.path=%s' % jar
|
jar = readInput(msg)
|
||||||
|
checkFile(jar)
|
||||||
|
args = "-Djava.class.path=%s" % jar
|
||||||
jvm_path = jpype.getDefaultJVMPath()
|
jvm_path = jpype.getDefaultJVMPath()
|
||||||
jpype.startJVM(jvm_path, args)
|
jpype.startJVM(jvm_path, args)
|
||||||
except (Exception), msg: #todo fix with specific error
|
except Exception, msg:
|
||||||
raise SqlmapConnectionException(msg[0])
|
raise SqlmapConnectionException(msg[0])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
driver = 'org.hsqldb.jdbc.JDBCDriver'
|
driver = 'org.hsqldb.jdbc.JDBCDriver'
|
||||||
connection_string = 'jdbc:hsqldb:mem:.' #'jdbc:hsqldb:hsql://%s/%s' % (self.hostname, self.db)
|
connection_string = 'jdbc:hsqldb:mem:.' #'jdbc:hsqldb:hsql://%s/%s' % (self.hostname, self.db)
|
||||||
|
@ -46,7 +51,7 @@ class Connector(GenericConnector):
|
||||||
connection_string,
|
connection_string,
|
||||||
str(self.user),
|
str(self.user),
|
||||||
str(self.password))
|
str(self.password))
|
||||||
except (Exception), msg: #todo what kind of error is this?!
|
except Exception, msg:
|
||||||
raise SqlmapConnectionException(msg[0])
|
raise SqlmapConnectionException(msg[0])
|
||||||
|
|
||||||
self.initCursor()
|
self.initCursor()
|
||||||
|
@ -55,7 +60,7 @@ class Connector(GenericConnector):
|
||||||
def fetchall(self):
|
def fetchall(self):
|
||||||
try:
|
try:
|
||||||
return self.cursor.fetchall()
|
return self.cursor.fetchall()
|
||||||
except (Exception), msg:
|
except Exception, msg:
|
||||||
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
|
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -65,10 +70,8 @@ class Connector(GenericConnector):
|
||||||
try:
|
try:
|
||||||
self.cursor.execute(query)
|
self.cursor.execute(query)
|
||||||
retVal = True
|
retVal = True
|
||||||
except (Exception), msg: #todo fix with specific error
|
|
||||||
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
|
|
||||||
except Exception, msg: #todo fix with specific error
|
except Exception, msg: #todo fix with specific error
|
||||||
raise SqlmapConnectionException(msg[1])
|
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
|
||||||
|
|
||||||
self.connector.commit()
|
self.connector.commit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user