Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/tamper/dunion.py
2983 views
1
#!/usr/bin/env python
2
3
"""
4
Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org)
5
See the file 'LICENSE' for copying permission
6
"""
7
8
import os
9
import re
10
11
from lib.core.common import singleTimeWarnMessage
12
from lib.core.enums import DBMS
13
from lib.core.enums import PRIORITY
14
15
__priority__ = PRIORITY.HIGHEST
16
17
def dependencies():
18
singleTimeWarnMessage("tamper script '%s' is only meant to be run against %s" % (os.path.basename(__file__).split(".")[0], DBMS.ORACLE))
19
20
def tamper(payload, **kwargs):
21
"""
22
Replaces instances of <int> UNION with <int>DUNION
23
24
Requirement:
25
* Oracle
26
27
Notes:
28
* Reference: https://media.blackhat.com/us-13/US-13-Salgado-SQLi-Optimization-and-Obfuscation-Techniques-Slides.pdf
29
30
>>> tamper('1 UNION ALL SELECT')
31
'1DUNION ALL SELECT'
32
"""
33
34
return re.sub(r"(?i)(\d+)\s+(UNION )", r"\g<1>D\g<2>", payload) if payload else payload
35
36