From e3130c1ba1c8e250726f5918217c2417a58c717a Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 26 Mar 2015 11:57:51 +0100 Subject: [PATCH] Implements #1207 --- tamper/informationschemacomment.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tamper/informationschemacomment.py diff --git a/tamper/informationschemacomment.py b/tamper/informationschemacomment.py new file mode 100644 index 000000000..7c146a30e --- /dev/null +++ b/tamper/informationschemacomment.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +""" +Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/) +See the file 'doc/COPYING' for copying permission +""" + +import re + +from lib.core.enums import PRIORITY + +__priority__ = PRIORITY.LOW + +def tamper(payload, **kwargs): + """ + Add a comment to the end of all occurrences of (blacklisted) "information_schema" identifier + + >>> tamper('SELECT table_name FROM INFORMATION_SCHEMA.TABLES') + 'SELECT table_name FROM INFORMATION_SCHEMA/**/.TABLES' + """ + + retVal = payload + + if payload: + retVal = re.sub(r"(?i)(information_schema)\.", "\g<1>/**/.", payload) + + return retVal