mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-02 20:54:13 +03:00
Adding new WAF script (UrlScan)
This commit is contained in:
parent
a3507d65fd
commit
9b32e69f26
|
@ -54,6 +54,7 @@ from lib.core.enums import HTTPMETHOD
|
||||||
from lib.core.enums import NULLCONNECTION
|
from lib.core.enums import NULLCONNECTION
|
||||||
from lib.core.enums import PAYLOAD
|
from lib.core.enums import PAYLOAD
|
||||||
from lib.core.enums import PLACE
|
from lib.core.enums import PLACE
|
||||||
|
from lib.core.enums import REDIRECTION
|
||||||
from lib.core.exception import SqlmapConnectionException
|
from lib.core.exception import SqlmapConnectionException
|
||||||
from lib.core.exception import SqlmapNoneDataException
|
from lib.core.exception import SqlmapNoneDataException
|
||||||
from lib.core.exception import SqlmapSilentQuitException
|
from lib.core.exception import SqlmapSilentQuitException
|
||||||
|
@ -1163,6 +1164,8 @@ def identifyWaf():
|
||||||
def _(*args, **kwargs):
|
def _(*args, **kwargs):
|
||||||
page, headers, code = None, None, None
|
page, headers, code = None, None, None
|
||||||
try:
|
try:
|
||||||
|
pushValue(kb.redirectChoice)
|
||||||
|
kb.redirectChoice = REDIRECTION.NO
|
||||||
if kwargs.get("get"):
|
if kwargs.get("get"):
|
||||||
kwargs["get"] = urlencode(kwargs["get"])
|
kwargs["get"] = urlencode(kwargs["get"])
|
||||||
kwargs["raise404"] = False
|
kwargs["raise404"] = False
|
||||||
|
@ -1170,6 +1173,8 @@ def identifyWaf():
|
||||||
page, headers, code = Request.getPage(*args, **kwargs)
|
page, headers, code = Request.getPage(*args, **kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
finally:
|
||||||
|
kb.redirectChoice = popValue()
|
||||||
return page or "", headers or {}, code
|
return page or "", headers or {}, code
|
||||||
|
|
||||||
retVal = False
|
retVal = False
|
||||||
|
|
|
@ -166,6 +166,7 @@ class HTTP_HEADER:
|
||||||
COOKIE = "Cookie"
|
COOKIE = "Cookie"
|
||||||
SET_COOKIE = "Set-Cookie"
|
SET_COOKIE = "Set-Cookie"
|
||||||
HOST = "Host"
|
HOST = "Host"
|
||||||
|
LOCATION = "Location"
|
||||||
PRAGMA = "Pragma"
|
PRAGMA = "Pragma"
|
||||||
PROXY_AUTHORIZATION = "Proxy-Authorization"
|
PROXY_AUTHORIZATION = "Proxy-Authorization"
|
||||||
PROXY_CONNECTION = "Proxy-Connection"
|
PROXY_CONNECTION = "Proxy-Connection"
|
||||||
|
|
24
waf/urlscan.py
Normal file
24
waf/urlscan.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
"""
|
||||||
|
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
|
||||||
|
See the file 'doc/COPYING' for copying permission
|
||||||
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from lib.core.enums import HTTP_HEADER
|
||||||
|
from lib.core.settings import WAF_ATTACK_VECTORS
|
||||||
|
|
||||||
|
__product__ = "UrlScan (Microsoft)"
|
||||||
|
|
||||||
|
def detect(get_page):
|
||||||
|
retval = False
|
||||||
|
|
||||||
|
for vector in WAF_ATTACK_VECTORS:
|
||||||
|
page, headers, code = get_page(get=vector)
|
||||||
|
retval = re.search(r"Rejected-By-UrlScan", headers.get(HTTP_HEADER.LOCATION, ""), re.I) is not None
|
||||||
|
if retval:
|
||||||
|
break
|
||||||
|
|
||||||
|
return retval
|
Loading…
Reference in New Issue
Block a user