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

Skip to content

Commit 90daef0

Browse files
committed
Update of a doc/THANKS
1 parent adfb862 commit 90daef0

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

doc/THANKS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ Carey Evans, <[email protected]>
116116
* for his fcrypt module that allows crypt(3) support
117117
on Windows platforms
118118

119+
Shawn Evans, <[email protected]>
120+
* for suggesting an idea for one tamper script, greatest.py
121+
119122
Adam Faheem, <[email protected]>
120123
* for reporting a few bugs
121124

@@ -294,7 +297,7 @@ Michael Majchrowicz, <[email protected]>
294297
* for suggesting a lot of ideas and features
295298

296299
Ahmad Maulana, <[email protected]>
297-
* for contributing one tamper scripts, halfversionedmorekeywords.py
300+
* for contributing one tamper script, halfversionedmorekeywords.py
298301

299302
Ferruh Mavituna, <[email protected]>
300303
* for exchanging ideas on the implementation of a couple of features

tamper/greatest.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
import re
9+
10+
from lib.core.enums import PRIORITY
11+
12+
__priority__ = PRIORITY.HIGHEST
13+
14+
def dependencies():
15+
pass
16+
17+
def tamper(payload, **kwargs):
18+
"""
19+
Replaces greater than operator ('>') with 'GREATEST' counterpart
20+
21+
Example:
22+
* Input: 'A > B'
23+
* Output: 'GREATEST(A, B + 1) = A'
24+
25+
Tested against:
26+
* MySQL 4, 5.0 and 5.5
27+
* Oracle 10g
28+
* PostgreSQL 8.3, 8.4, 9.0
29+
30+
Notes:
31+
* Useful to bypass weak and bespoke web application firewalls that
32+
filter the greater than character
33+
* The GREATEST clause is a widespread SQL command. Hence, this
34+
tamper script should work against majority of databases
35+
"""
36+
37+
retVal = payload
38+
39+
if payload:
40+
match = re.search(r"(?i)(\b(AND|OR)\b\s+)(?!.*\b(AND|OR)\b)([^>]+?)\s*>\s*([\d(+\-*/)]+)\s*\Z", payload)
41+
42+
if match:
43+
_ = "%sGREATEST(%s,%s+1)=%s" % (match.group(1), match.group(4), match.group(5), match.group(4))
44+
retVal = retVal.replace(match.group(0), _)
45+
46+
return retVal

0 commit comments

Comments
 (0)