Skip to content

Commit dde1178

Browse files
committed
Fixes (old) Informix escaping
1 parent 638dbf2 commit dde1178

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

lib/core/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import contextlib
1010
import cookielib
1111
import copy
12+
import distutils
1213
import getpass
1314
import hashlib
1415
import httplib
@@ -2908,7 +2909,7 @@ def isDBMSVersionAtLeast(version):
29082909
elif value.startswith(">"):
29092910
value = float(value.replace("<", "")) - 0.01
29102911

2911-
retVal = getUnicode(value) >= getUnicode(version)
2912+
retVal = distutils.version.LooseVersion(getUnicode(value)) < distutils.version.LooseVersion(getUnicode(version))
29122913

29132914
return retVal
29142915

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.1.12.7"
22+
VERSION = "1.1.12.8"
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)

plugins/dbms/informix/fingerprint.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ def checkDbms(self):
8080

8181
return False
8282

83+
# Determine if it is Informix >= 11.70
84+
if inject.checkBooleanExpression("CHR(32)=' '"):
85+
Backend.setVersion(">= 11.70")
86+
8387
setDbms(DBMS.INFORMIX)
8488

8589
self.getBanner()

plugins/dbms/informix/syntax.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import re
99

10+
from lib.core.common import isDBMSVersionAtLeast
1011
from lib.core.common import randomStr
1112
from plugins.generic.syntax import Syntax as GenericSyntax
1213

@@ -24,14 +25,17 @@ def escape(expression, quote=True):
2425
def escaper(value):
2526
return "||".join("CHR(%d)" % ord(_) for _ in value)
2627

27-
excluded = {}
28-
for _ in re.findall(r"DBINFO\([^)]+\)", expression):
29-
excluded[_] = randomStr()
30-
expression = expression.replace(_, excluded[_])
28+
retVal = expression
3129

32-
retVal = Syntax._escape(expression, quote, escaper)
30+
if isDBMSVersionAtLeast("11.70"):
31+
excluded = {}
32+
for _ in re.findall(r"DBINFO\([^)]+\)", expression):
33+
excluded[_] = randomStr()
34+
expression = expression.replace(_, excluded[_])
3335

34-
for _ in excluded.items():
35-
retVal = retVal.replace(_[1], _[0])
36+
retVal = Syntax._escape(expression, quote, escaper)
37+
38+
for _ in excluded.items():
39+
retVal = retVal.replace(_[1], _[0])
3640

3741
return retVal

txt/checksum.md5

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ d2cdb9e832e18a81e936ca3348144b16 lib/controller/handler.py
2727
5fb9aaf874daa47ea2b672a22740e56b lib/controller/__init__.py
2828
f8a7165253874a9ce0c6e0d089e5fb8c lib/core/agent.py
2929
8d9d771f7e67582c56a96a8d0ccbe4fc lib/core/bigarray.py
30-
b17569e569c6ca695e6a5c063875b322 lib/core/common.py
30+
e623cc771c75bcf6afdf4e54d935114e lib/core/common.py
3131
54326d3a690f8b26fe5a5da1a589b369 lib/core/convert.py
3232
90b1b08368ac8a859300e6fa6a8c796e lib/core/data.py
3333
1c14bdbf47b8dba31f73da9ad731a54a lib/core/datatype.py
@@ -46,7 +46,7 @@ f872699e948d0692ce11b54781da814c lib/core/log.py
4646
760d9df2a27ded29109b390ab202e72d lib/core/replication.py
4747
a2466b62e67f8b31736bac4dac590e51 lib/core/revision.py
4848
02d4762140a72fd44668d3dab5eabda9 lib/core/session.py
49-
337545ac8dad16abc298b71b1d1c4364 lib/core/settings.py
49+
d111e43fa67fa4eeb8db57aa291eee47 lib/core/settings.py
5050
35bffbad762eb9e03db9e93b1c991103 lib/core/shell.py
5151
a59ec28371ae067a6fdd8f810edbee3d lib/core/subprocessng.py
5252
d93501771b41315f9fb949305b6ed257 lib/core/target.py
@@ -147,9 +147,9 @@ ce832d87eadbe42fc03248e254c2a7aa plugins/dbms/hsqldb/syntax.py
147147
d8b4a18a79528b01ff6cda31ad3ad057 plugins/dbms/informix/connector.py
148148
066af83abb12298abb289353e5c00831 plugins/dbms/informix/enumeration.py
149149
6fe7d6928c98e66571e2ba674363ca9e plugins/dbms/informix/filesystem.py
150-
581194b06baef15726fcc18d53f74131 plugins/dbms/informix/fingerprint.py
150+
14705fe9c3b253ab5232582af182da53 plugins/dbms/informix/fingerprint.py
151151
9351f8d93ddb7d18902a78792138eba7 plugins/dbms/informix/__init__.py
152-
de5b094e9094c20ea185516f680c2e11 plugins/dbms/informix/syntax.py
152+
6fe5ff4a3678d1cf2bee5695cb4b335a plugins/dbms/informix/syntax.py
153153
ad8a1007d23c2f63950d820297a40131 plugins/dbms/informix/takeover.py
154154
5fb9aaf874daa47ea2b672a22740e56b plugins/dbms/__init__.py
155155
5ad8280cdfb7f09b008f3ed79ae5b4bf plugins/dbms/maxdb/connector.py

0 commit comments

Comments
 (0)