Skip to content

Commit 2f4ff0d

Browse files
committed
Minor patches to tamper scripts
1 parent 2c356ed commit 2f4ff0d

5 files changed

Lines changed: 56 additions & 44 deletions

File tree

data/txt/sha256sums.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ c65ce3cd38ee85c443c6619cfea84920390bad171f2999b95149485c0d1bc4a2 lib/core/patch
188188
48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py
189189
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
190190
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
191-
fd9252af9bb49e13cd9be15fe4d9668224b422827b8549a76e9d99c2ec4eb68c lib/core/settings.py
191+
1190bfd8052d2acb7216451e015da54fb482e24478499a447ae756140fdcbed8 lib/core/settings.py
192192
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
193193
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
194194
70ea3768f1b3062b22d20644df41c86238157ec80dd43da40545c620714273c6 lib/core/target.py
@@ -519,9 +519,9 @@ d528e74ae7c9fc0cd45369046d835a8f1e6f9252eeef6d84d9978d7e329ab35f tamper/escapeq
519519
f0a7b635061385a3bf399cc51faf4d5e10694266aaa21fba557ca655c00a09bc tamper/hex2char.py
520520
9096cbf2283137d592408325347f46866fd139966c946f8ba1ea61826472d0bb tamper/hexentities.py
521521
3e518ace6940d54e8844c83781756e85d5670c53dfac0a092c4ee36cd5111885 tamper/htmlencode.py
522-
04028ea55034ef5c82167db35cb1276d3d5c717f6b22507b791342ccf82722ad tamper/if2case.py
523-
365085e79d296791464ec3f041a26554b19ba4865c4a727e258e9586b0bcfbe7 tamper/ifnull2casewhenisnull.py
524-
e73e3723d4b61515d7ad2c0fe6e9a9dcaeeac6a93ed6149f44d59e4e41543226 tamper/ifnull2ifisnull.py
522+
d05dafb86e82807e75bb8f54dcd6afbb4a08ba3b83b35562fee7f7022a75dbd7 tamper/if2case.py
523+
55092820a856f583cf1b661001b60216886d172cb7d0008920bf4ab3df88aff0 tamper/ifnull2casewhenisnull.py
524+
eeda2b2fd54a4aa5fcf5630f8bfae43e0a38a840ae908e2f6b0878959067413c tamper/ifnull2ifisnull.py
525525
94fe273bee7df27c9b4f1ee043779d06e4553169d9aec30c301d469275883dd1 tamper/informationschemacomment.py
526526
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 tamper/__init__.py
527527
017c91ba64c669382aa88ce627f925b00101a81c1a37a23dba09bfa2bfaf42ae tamper/least.py

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

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

tamper/if2case.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,30 @@ def tamper(payload, **kwargs):
3636
'SELECT CASE WHEN (1=1) THEN (SELECT "foo") ELSE (NULL) END'
3737
"""
3838

39-
if payload and payload.find("IF") > -1:
39+
if payload and payload.find("IF(") > -1:
4040
payload = payload.replace("()", REPLACEMENT_MARKER)
4141
while payload.find("IF(") > -1:
4242
index = payload.find("IF(")
4343
depth = 1
4444
commas, end = [], None
45+
quote, doublequote = False, False
4546

4647
for i in xrange(index + len("IF("), len(payload)):
47-
if depth == 1 and payload[i] == ',':
48-
commas.append(i)
49-
50-
elif depth == 1 and payload[i] == ')':
51-
end = i
52-
break
53-
54-
elif payload[i] == '(':
55-
depth += 1
56-
57-
elif payload[i] == ')':
58-
depth -= 1
48+
if payload[i] == '\'' and (i == 0 or payload[i - 1] != '\\'):
49+
quote = not quote
50+
elif payload[i] == '"' and (i == 0 or payload[i - 1] != '\\'):
51+
doublequote = not doublequote
52+
53+
if not quote and not doublequote:
54+
if depth == 1 and payload[i] == ',':
55+
commas.append(i)
56+
elif depth == 1 and payload[i] == ')':
57+
end = i
58+
break
59+
elif payload[i] == '(':
60+
depth += 1
61+
elif payload[i] == ')':
62+
depth -= 1
5963

6064
if len(commas) == 2 and end:
6165
a = payload[index + len("IF("):commas[0]].strip("()")

tamper/ifnull2casewhenisnull.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,29 @@ def tamper(payload, **kwargs):
3333
'CASE WHEN ISNULL(1) THEN (2) ELSE (1) END'
3434
"""
3535

36-
if payload and payload.find("IFNULL") > -1:
36+
if payload and payload.find("IFNULL(") > -1:
3737
while payload.find("IFNULL(") > -1:
3838
index = payload.find("IFNULL(")
3939
depth = 1
4040
comma, end = None, None
41+
quote, doublequote = False, False
4142

4243
for i in xrange(index + len("IFNULL("), len(payload)):
43-
if depth == 1 and payload[i] == ',':
44-
comma = i
45-
46-
elif depth == 1 and payload[i] == ')':
47-
end = i
48-
break
49-
50-
elif payload[i] == '(':
51-
depth += 1
52-
53-
elif payload[i] == ')':
54-
depth -= 1
44+
if payload[i] == '\'' and (i == 0 or payload[i - 1] != '\\'):
45+
quote = not quote
46+
elif payload[i] == '"' and (i == 0 or payload[i - 1] != '\\'):
47+
doublequote = not doublequote
48+
49+
if not quote and not doublequote:
50+
if depth == 1 and payload[i] == ',':
51+
comma = i
52+
elif depth == 1 and payload[i] == ')':
53+
end = i
54+
break
55+
elif payload[i] == '(':
56+
depth += 1
57+
elif payload[i] == ')':
58+
depth -= 1
5559

5660
if comma and end:
5761
_ = payload[index + len("IFNULL("):comma]

tamper/ifnull2ifisnull.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,29 @@ def tamper(payload, **kwargs):
3333
'IF(ISNULL(1),2,1)'
3434
"""
3535

36-
if payload and payload.find("IFNULL") > -1:
36+
if payload and payload.find("IFNULL(") > -1:
3737
while payload.find("IFNULL(") > -1:
3838
index = payload.find("IFNULL(")
3939
depth = 1
4040
comma, end = None, None
41+
quote, doublequote = False, False
4142

4243
for i in xrange(index + len("IFNULL("), len(payload)):
43-
if depth == 1 and payload[i] == ',':
44-
comma = i
45-
46-
elif depth == 1 and payload[i] == ')':
47-
end = i
48-
break
49-
50-
elif payload[i] == '(':
51-
depth += 1
52-
53-
elif payload[i] == ')':
54-
depth -= 1
44+
if payload[i] == '\'' and (i == 0 or payload[i - 1] != '\\'):
45+
quote = not quote
46+
elif payload[i] == '"' and (i == 0 or payload[i - 1] != '\\'):
47+
doublequote = not doublequote
48+
49+
if not quote and not doublequote:
50+
if depth == 1 and payload[i] == ',':
51+
comma = i
52+
elif depth == 1 and payload[i] == ')':
53+
end = i
54+
break
55+
elif payload[i] == '(':
56+
depth += 1
57+
elif payload[i] == ')':
58+
depth -= 1
5559

5660
if comma and end:
5761
_ = payload[index + len("IFNULL("):comma]

0 commit comments

Comments
 (0)