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