Skip to content

Commit a4cf25c

Browse files
authored
add ord2ascii tamper script (sqlmapproject#4992)
Changes occurrences of ORD() function to equivalent ASCII() ones.
1 parent 796173f commit a4cf25c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tamper/ord2ascii.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
import re
9+
10+
from lib.core.enums import PRIORITY
11+
12+
__priority__ = PRIORITY.LOWEST
13+
14+
def dependencies():
15+
pass
16+
17+
def tamper(payload, **kwargs):
18+
"""
19+
Replaces ORD() occurences with equivalent ASCII() calls
20+
21+
>>> tamper("ORD('42')")
22+
"ASCII('42')"
23+
"""
24+
25+
retVal = payload
26+
27+
if payload:
28+
retVal = re.sub(r"(?i)\bORD\(\b", "ASCII(", payload)
29+
30+
return retVal

0 commit comments

Comments
 (0)