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

Skip to content

Commit aa9989f

Browse files
author
Daniel Almeida
committed
[add] new space 2 more comment bypass
1 parent 2a3014b commit aa9989f

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

tamper/space2morecomment.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
from lib.core.enums import PRIORITY
9+
10+
__priority__ = PRIORITY.LOW
11+
12+
def dependencies():
13+
pass
14+
15+
def tamper(payload, **kwargs):
16+
"""
17+
Replaces space character (' ') with comments '/**_**/'
18+
19+
Tested against:
20+
* MySQL 5.0 and 5.5
21+
22+
Notes:
23+
* Useful to bypass weak and bespoke web application firewalls
24+
25+
>>> tamper('SELECT id FROM users')
26+
'SELECT/**_**/id/**_**/FROM/**_**/users'
27+
"""
28+
29+
retVal = payload
30+
31+
if payload:
32+
retVal = ""
33+
quote, doublequote, firstspace = False, False, False
34+
35+
for i in xrange(len(payload)):
36+
if not firstspace:
37+
if payload[i].isspace():
38+
firstspace = True
39+
retVal += "/**_**/"
40+
continue
41+
42+
elif payload[i] == '\'':
43+
quote = not quote
44+
45+
elif payload[i] == '"':
46+
doublequote = not doublequote
47+
48+
elif payload[i] == " " and not doublequote and not quote:
49+
retVal += "/**_**/"
50+
continue
51+
52+
retVal += payload[i]
53+
54+
return retVal

0 commit comments

Comments
 (0)