sqlmap/tamper/ord2ascii.py

34 lines
559 B
Python
Raw Normal View History

#!/usr/bin/env python
"""
2024-01-04 01:11:52 +03:00
Copyright (c) 2006-2024 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.enums import PRIORITY
2022-02-23 14:13:30 +03:00
__priority__ = PRIORITY.HIGHEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces ORD() occurences with equivalent ASCII() calls
2022-02-23 14:13:30 +03:00
Requirement:
* MySQL
>>> tamper("ORD('42')")
"ASCII('42')"
"""
retVal = payload
if payload:
2022-02-23 14:13:30 +03:00
retVal = re.sub(r"(?i)\bORD\(", "ASCII(", payload)
return retVal