Skip to content

Commit b361f60

Browse files
committed
minor changes
1 parent f3013e4 commit b361f60

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

tamper/versionedkeywords.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,28 @@
1010
import re
1111

1212
from lib.core.common import randomRange
13-
from lib.core.common import singleTimeWarnMessage
1413
from lib.core.data import kb
1514
from lib.core.enums import PRIORITY
16-
from lib.core.settings import IGNORE_SPACE_AFFECTED_KEYWORDS
1715

18-
__priority__ = PRIORITY.NORMAL
16+
__priority__ = PRIORITY.HIGHER
1917

2018
def tamper(payload):
2119
"""
22-
Encloses each keyword with versioned MySQL comment (MySQL >= 5.1.13)
20+
Encloses each non-function keyword with versioned MySQL comment
2321
Example: 'INSERT' will become '/*!INSERT*/'
2422
"""
2523

2624
def process(match):
2725
word = match.group('word')
28-
if word.upper() in kb.keywords and word.upper() not in IGNORE_SPACE_AFFECTED_KEYWORDS:
26+
if word.upper() in kb.keywords:
2927
return match.group().replace(word, "/*!%s*/" % word)
3028
else:
3129
return match.group()
3230

33-
singleTimeWarnMessage("This tamper script is only meant to be run against MySQL >= 5.1.13")
34-
3531
retVal = payload
3632

3733
if payload:
38-
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", lambda match: process(match), retVal)
34+
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=[^\w(]|\Z)", lambda match: process(match), retVal)
3935
retVal = retVal.replace(" /*!", "/*!").replace("*/ ", "*/")
4036

4137
return retVal
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

33
"""
4-
$Id: versionedkeywords.py 3982 2011-05-28 17:34:43Z stamparm $
4+
$Id: versionedkeywords.py 4203 2011-06-30 06:39:32Z stamparm $
55
66
Copyright (c) 2006-2011 sqlmap developers (http://sqlmap.sourceforge.net/)
77
See the file 'doc/COPYING' for copying permission
@@ -10,28 +10,32 @@
1010
import re
1111

1212
from lib.core.common import randomRange
13+
from lib.core.common import singleTimeWarnMessage
1314
from lib.core.data import kb
1415
from lib.core.enums import PRIORITY
16+
from lib.core.settings import IGNORE_SPACE_AFFECTED_KEYWORDS
1517

16-
__priority__ = PRIORITY.NORMAL
18+
__priority__ = PRIORITY.HIGHER
1719

1820
def tamper(payload):
1921
"""
20-
Encloses each non-function keyword with versioned MySQL comment
22+
Encloses each keyword with versioned MySQL comment (MySQL >= 5.1.13)
2123
Example: 'INSERT' will become '/*!INSERT*/'
2224
"""
2325

2426
def process(match):
2527
word = match.group('word')
26-
if word.upper() in kb.keywords:
28+
if word.upper() in kb.keywords and word.upper() not in IGNORE_SPACE_AFFECTED_KEYWORDS:
2729
return match.group().replace(word, "/*!%s*/" % word)
2830
else:
2931
return match.group()
3032

33+
singleTimeWarnMessage("This tamper script is only meant to be run against MySQL >= 5.1.13")
34+
3135
retVal = payload
3236

3337
if payload:
34-
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=[^\w(]|\Z)", lambda match: process(match), retVal)
38+
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", lambda match: process(match), retVal)
3539
retVal = retVal.replace(" /*!", "/*!").replace("*/ ", "*/")
3640

3741
return retVal

0 commit comments

Comments
 (0)