sqlmap/tamper/ord2ascii.py

34 lines
559 B
Python
Raw Permalink Normal View History

#!/usr/bin/env python
"""
2023-01-03 01:24:59 +03:00
Copyright (c) 2006-2023 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