Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/tamper/lowercase.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 re
9
10
from lib.core.data import kb
11
from lib.core.enums import PRIORITY
12
13
__priority__ = PRIORITY.NORMAL
14
15
def dependencies():
16
pass
17
18
def tamper(payload, **kwargs):
19
"""
20
Replaces each keyword character with lower case value (e.g. SELECT -> select)
21
22
Tested against:
23
* Microsoft SQL Server 2005
24
* MySQL 4, 5.0 and 5.5
25
* Oracle 10g
26
* PostgreSQL 8.3, 8.4, 9.0
27
28
Notes:
29
* Useful to bypass very weak and bespoke web application firewalls
30
that has poorly written permissive regular expressions
31
32
>>> tamper('INSERT')
33
'insert'
34
"""
35
36
retVal = payload
37
38
if payload:
39
for match in re.finditer(r"\b[A-Za-z_]+\b", retVal):
40
word = match.group()
41
42
if word.upper() in kb.keywords:
43
retVal = retVal.replace(word, word.lower())
44
45
return retVal
46
47