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

Skip to content

Commit 90e381a

Browse files
committed
Another update related to the #3356
1 parent e99e991 commit 90e381a

6 files changed

Lines changed: 34 additions & 22 deletions

File tree

lib/controller/handler.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from lib.core.data import kb
1111
from lib.core.dicts import DBMS_DICT
1212
from lib.core.enums import DBMS
13+
from lib.core.exception import SqlmapConnectionException
1314
from lib.core.settings import MSSQL_ALIASES
1415
from lib.core.settings import MYSQL_ALIASES
1516
from lib.core.settings import ORACLE_ALIASES
@@ -94,21 +95,32 @@ def setHandler():
9495
conf.dbmsConnector = Connector()
9596

9697
if conf.direct:
98+
exception = None
9799
dialect = DBMS_DICT[dbms][3]
98100

99101
if dialect:
100-
sqlalchemy = SQLAlchemy(dialect=dialect)
101-
sqlalchemy.connect()
102-
103-
if sqlalchemy.connector:
104-
conf.dbmsConnector = sqlalchemy
105-
else:
106-
try:
107-
conf.dbmsConnector.connect()
108-
except NameError:
109-
pass
110-
else:
111-
conf.dbmsConnector.connect()
102+
try:
103+
sqlalchemy = SQLAlchemy(dialect=dialect)
104+
sqlalchemy.connect()
105+
106+
if sqlalchemy.connector:
107+
conf.dbmsConnector = sqlalchemy
108+
except Exception, ex:
109+
exception = ex
110+
111+
if not dialect or exception:
112+
try:
113+
conf.dbmsConnector.connect()
114+
except Exception, ex:
115+
if exception:
116+
raise exception
117+
else:
118+
if not isinstance(ex, NameError):
119+
raise
120+
else:
121+
msg = "support for direct connection to '%s' is not available. " % dbms
122+
msg += "Please rerun with '--dependencies'"
123+
raise SqlmapConnectionException(msg)
112124

113125
if conf.forceDbms == dbms or handler.checkDbms():
114126
if kb.resolutionDbms:

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ def parseTargetDirect():
14101410
except (SqlmapSyntaxException, SqlmapMissingDependence):
14111411
raise
14121412
except:
1413-
if _sqlalchemy and data[3] in _sqlalchemy.dialects.__all__:
1413+
if _sqlalchemy and data[3] and any(_ in _sqlalchemy.dialects.__all__ for _ in (data[3], data[3].split('+')[0])):
14141414
pass
14151415
else:
14161416
errMsg = "sqlmap requires '%s' third-party library " % data[1]

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.2.11.3"
22+
VERSION = "1.2.11.4"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/utils/hashdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def retrieve(self, key, unserialize=False):
9191
raise
9292
except sqlite3.DatabaseError, ex:
9393
errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex))
94-
errMsg += "If the problem persists please rerun with `--flush-session`"
94+
errMsg += "If the problem persists please rerun with '--flush-session'"
9595
raise SqlmapConnectionException(errMsg)
9696
else:
9797
break
@@ -104,7 +104,7 @@ def retrieve(self, key, unserialize=False):
104104
except:
105105
retVal = None
106106
warnMsg = "error occurred while unserializing value for session key '%s'. " % key
107-
warnMsg += "If the problem persists please rerun with `--flush-session`"
107+
warnMsg += "If the problem persists please rerun with '--flush-session'"
108108
logger.warn(warnMsg)
109109

110110
return retVal

plugins/dbms/mssqlserver/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def connect(self):
4141

4242
try:
4343
self.connector = pymssql.connect(host="%s:%d" % (self.hostname, self.port), user=self.user, password=self.password, database=self.db, login_timeout=conf.timeout, timeout=conf.timeout)
44-
except (pymssql.Error, _mssql.MssqlDatabaseException), msg:
44+
except (pymssql2.Error, _mssql.MssqlDatabaseException), msg:
4545
raise SqlmapConnectionException(msg)
4646
except ValueError:
4747
raise SqlmapConnectionException

txt/checksum.md5

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ c1bccc94522d3425a372dcd57f78418e extra/wafdetectify/wafdetectify.py
2525
3459c562a6abb9b4bdcc36925f751f3e lib/controller/action.py
2626
71334197c7ed28167cd66c17b2c21844 lib/controller/checks.py
2727
dd42ef140ffc0bd517128e6df369ab01 lib/controller/controller.py
28-
97a0f363bfc33a5ee4853cdf91515423 lib/controller/handler.py
28+
ba2717a410b21285d781ab42c4a797d0 lib/controller/handler.py
2929
1e5532ede194ac9c083891c2f02bca93 lib/controller/__init__.py
3030
cb865cf6eff60118bc97a0f106af5e4d lib/core/agent.py
3131
c347f085bd561adfa26d3a9512e5f3b9 lib/core/bigarray.py
32-
b2a70451b0e5abe914aff2130015664f lib/core/common.py
32+
eb4e54c194d50d9dc8caa1a3ea69cba6 lib/core/common.py
3333
0d082da16c388b3445e656e0760fb582 lib/core/convert.py
3434
9f87391b6a3395f7f50830b391264f27 lib/core/data.py
3535
72016ea5c994a711a262fd64572a0fcd lib/core/datatype.py
@@ -49,7 +49,7 @@ c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
4949
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
5050
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
5151
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
52-
8f0fae6a47aed35b82f320edfec67ce2 lib/core/settings.py
52+
46698dfe7954891919d27a2f250d8f42 lib/core/settings.py
5353
a971ce157d04de96ba6e710d3d38a9a8 lib/core/shell.py
5454
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
5555
721198b5be72c8015a02acb116532a1f lib/core/target.py
@@ -107,7 +107,7 @@ f7813cdee00df8f98d6f811475e520a1 lib/techniques/union/test.py
107107
f9867bbfcd6d31916ca73e72e95fd881 lib/utils/deps.py
108108
f7af65aa47329d021e2b2cc8521b42a4 lib/utils/getch.py
109109
7af29f61302c8693cd6436d4b69e22d3 lib/utils/har.py
110-
062e4e8fc43ac54305a75ddd0d482f81 lib/utils/hashdb.py
110+
1205648d55649accafae2cc77d647aa0 lib/utils/hashdb.py
111111
d0f4d56c5d6a09a4635035e233d4a782 lib/utils/hash.py
112112
011d2dbf589e0faa0deca61a651239cc lib/utils/htmlentities.py
113113
1e5532ede194ac9c083891c2f02bca93 lib/utils/__init__.py
@@ -169,7 +169,7 @@ ffd26f64142226d0b1ed1d70f7f294c0 plugins/dbms/maxdb/filesystem.py
169169
4321d7018f5121343460ebfd83bb69be plugins/dbms/maxdb/__init__.py
170170
e7d44671ae26c0bcd5fe8448be070bbd plugins/dbms/maxdb/syntax.py
171171
bf7842bb291e2297c3c8d1023eb3e550 plugins/dbms/maxdb/takeover.py
172-
decc645344bb93aca504a71ba2e4cad4 plugins/dbms/mssqlserver/connector.py
172+
5e1c7e578d07f3670bba5d88d856715d plugins/dbms/mssqlserver/connector.py
173173
f1f1541a54faf67440179fa521f99849 plugins/dbms/mssqlserver/enumeration.py
174174
65911fdc86fa6322e72319e6488a0bb8 plugins/dbms/mssqlserver/filesystem.py
175175
6cf74341fc84588205e02b70b2f0f5b6 plugins/dbms/mssqlserver/fingerprint.py

0 commit comments

Comments
 (0)