From 7578795c96335bbaabc99b7082036a541d6295f9 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 28 May 2011 16:02:14 +0000 Subject: [PATCH] adding one more tamper script --- tamper/equaltolike.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tamper/equaltolike.py diff --git a/tamper/equaltolike.py b/tamper/equaltolike.py new file mode 100644 index 000000000..f8b6b7188 --- /dev/null +++ b/tamper/equaltolike.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" +$Id$ + +Copyright (c) 2006-2011 sqlmap developers (http://sqlmap.sourceforge.net/) +See the file 'doc/COPYING' for copying permission +""" + +import re + +from lib.core.enums import PRIORITY + +__priority__ = PRIORITY.LOW + +def tamper(payload): + """ + Replaces all occurances of operator = with operator LIKE + Example: 'SELECT * FROM users WHERE id=1' becomes 'SELECT * FROM users WHERE id LIKE 1' + """ + + def process(match): + word = match.group() + word = "%sLIKE%s" % (" " if word[0]!=" " else "", " " if word[-1]!=" " else "") + return word + + retVal = payload + + if payload: + retVal = re.sub(r"\s*=\s*", lambda match: process(match), retVal) + + return retVal