2010-10-18 15:39:28 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
"""
|
2010-10-18 15:43:00 +04:00
|
|
|
$Id$
|
2010-10-18 15:39:28 +04:00
|
|
|
|
|
|
|
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
|
|
|
See the file 'doc/COPYING' for copying permission
|
|
|
|
"""
|
|
|
|
|
2010-10-29 20:11:50 +04:00
|
|
|
def tamper(value):
|
2010-10-18 15:39:28 +04:00
|
|
|
"""
|
2010-11-04 11:03:59 +03:00
|
|
|
Replaces ' ' with '+'
|
2010-10-18 15:41:17 +04:00
|
|
|
Example: 'SELECT id FROM users' becomes 'SELECT+id+FROM+users'
|
2010-10-18 15:39:28 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
retVal = value
|
|
|
|
|
|
|
|
if value:
|
|
|
|
retVal = ""
|
|
|
|
quote, doublequote, firstspace = False, False, False
|
|
|
|
|
|
|
|
for i in xrange(len(value)):
|
|
|
|
if not firstspace:
|
|
|
|
if value[i].isspace():
|
|
|
|
firstspace = True
|
|
|
|
retVal += "+"
|
|
|
|
continue
|
|
|
|
|
|
|
|
elif value[i] == '\'':
|
|
|
|
quote = not quote
|
|
|
|
|
|
|
|
elif value[i] == '"':
|
|
|
|
doublequote = not doublequote
|
|
|
|
|
|
|
|
elif value[i]==" " and not doublequote and not quote:
|
|
|
|
retVal += "+"
|
|
|
|
continue
|
|
|
|
|
|
|
|
retVal += value[i]
|
|
|
|
|
|
|
|
return retVal
|
|
|
|
|