sqlmap/tamper/schemasplit.py

32 lines
753 B
Python
Raw Permalink Normal View History

2020-07-27 14:49:48 +03:00
#!/usr/bin/env python
"""
2022-01-03 13:30:34 +03:00
Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)
2020-07-27 14:49:48 +03:00
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.HIGHEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
2020-09-21 18:04:44 +03:00
Splits FROM schema identifiers (e.g. 'testdb.users') with whitespace (e.g. 'testdb 9.e.users')
2020-07-27 14:49:48 +03:00
Requirement:
* MySQL
Notes:
* Reference: https://media.blackhat.com/us-13/US-13-Salgado-SQLi-Optimization-and-Obfuscation-Techniques-Slides.pdf
>>> tamper('SELECT id FROM testdb.users')
'SELECT id FROM testdb 9.e.users'
"""
2020-11-10 01:02:48 +03:00
return re.sub(r"(?i)( FROM \w+)\.(\w+)", r"\g<1> 9.e.\g<2>", payload) if payload else payload