mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 13:11:29 +00:00
Some more adjustments (Issue #475)
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user