Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfbed43

Browse files
committed
Merge branch 'master' of github.com:sqlmapproject/sqlmap
2 parents 6468211 + 5ff09af commit cfbed43

3 files changed

Lines changed: 21 additions & 15 deletions

File tree

lib/core/dicts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
DBMS.MAXDB: (MAXDB_ALIASES, None, None, "maxdb"),
139139
DBMS.SYBASE: (SYBASE_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/", "sybase"),
140140
DBMS.DB2: (DB2_ALIASES, "python ibm-db", "http://code.google.com/p/ibm-db/", "ibm_db_sa"),
141-
DBMS.HSQLDB: (HSQLDB_ALIASES, "python jaydebeapi", "https://pypi.python.org/pypi/JayDeBeApi/", None),
141+
DBMS.HSQLDB: (HSQLDB_ALIASES, "python jaydebeapi & python jpype", "https://pypi.python.org/pypi/JayDeBeApi/ & http://jpype.sourceforge.net/", None),
142142
}
143143

144144
FROM_DUMMY_TABLE = {

lib/utils/deps.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def checkDependencies():
4141
import kinterbasdb
4242
elif dbmsName == DBMS.DB2:
4343
import ibm_db_dbi
44+
elif dbmsName == DBMS.HSQLDB:
45+
import jaydebeapi
46+
import jpype
4447
except ImportError:
4548
warnMsg = "sqlmap requires '%s' third-party library " % data[1]
4649
warnMsg += "in order to directly connect to the database "

plugins/dbms/hsqldb/connector.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,27 @@
66
"""
77

88
try:
9-
from thirdparty import jaydebeapi
9+
import jaydebeapi
1010
import jpype
1111
except ImportError, msg:
1212
pass
1313

1414
import logging
1515

16+
from lib.core.common import checkFile
17+
from lib.core.common import readInput
1618
from lib.core.data import conf
1719
from lib.core.data import logger
1820
from lib.core.exception import SqlmapConnectionException
1921
from plugins.generic.connector import Connector as GenericConnector
2022

2123
class Connector(GenericConnector):
2224
"""
23-
Homepage: http://jpype.sourceforge.net/
24-
User guide: http://jpype.sourceforge.net/doc/user-guide/userguide.html
25-
API: http://code.google.com/p/pymysql/
26-
Debian package: <none>
27-
License: Apache License V2.0
25+
Homepage: https://pypi.python.org/pypi/JayDeBeApi/ & http://jpype.sourceforge.net/
26+
User guide: https://pypi.python.org/pypi/JayDeBeApi/#usage & http://jpype.sourceforge.net/doc/user-guide/userguide.html
27+
API: -
28+
Debian package: -
29+
License: LGPL & Apache License 2.0
2830
"""
2931

3032
def __init__(self):
@@ -33,20 +35,23 @@ def __init__(self):
3335
def connect(self):
3436
self.initConnection()
3537
try:
36-
jar = './thirdparty/hsqldb/hsqldb.jar'
37-
args='-Djava.class.path=%s' % jar
38+
msg = "what's the location of 'hsqldb.jar'? "
39+
jar = readInput(msg)
40+
checkFile(jar)
41+
args = "-Djava.class.path=%s" % jar
3842
jvm_path = jpype.getDefaultJVMPath()
3943
jpype.startJVM(jvm_path, args)
40-
except (Exception), msg: #todo fix with specific error
44+
except Exception, msg:
4145
raise SqlmapConnectionException(msg[0])
46+
4247
try:
4348
driver = 'org.hsqldb.jdbc.JDBCDriver'
4449
connection_string = 'jdbc:hsqldb:mem:.' #'jdbc:hsqldb:hsql://%s/%s' % (self.hostname, self.db)
4550
self.connector = jaydebeapi.connect(driver,
4651
connection_string,
4752
str(self.user),
4853
str(self.password))
49-
except (Exception), msg: #todo what kind of error is this?!
54+
except Exception, msg:
5055
raise SqlmapConnectionException(msg[0])
5156

5257
self.initCursor()
@@ -55,7 +60,7 @@ def connect(self):
5560
def fetchall(self):
5661
try:
5762
return self.cursor.fetchall()
58-
except (Exception), msg:
63+
except Exception, msg:
5964
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
6065
return None
6166

@@ -65,10 +70,8 @@ def execute(self, query):
6570
try:
6671
self.cursor.execute(query)
6772
retVal = True
68-
except (Exception), msg: #todo fix with specific error
69-
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
7073
except Exception, msg: #todo fix with specific error
71-
raise SqlmapConnectionException(msg[1])
74+
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
7275

7376
self.connector.commit()
7477

0 commit comments

Comments
 (0)