Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b32e69

Browse files
committed
Adding new WAF script (UrlScan)
1 parent a3507d6 commit 9b32e69

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

lib/controller/checks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
from lib.core.enums import NULLCONNECTION
5555
from lib.core.enums import PAYLOAD
5656
from lib.core.enums import PLACE
57+
from lib.core.enums import REDIRECTION
5758
from lib.core.exception import SqlmapConnectionException
5859
from lib.core.exception import SqlmapNoneDataException
5960
from lib.core.exception import SqlmapSilentQuitException
@@ -1163,13 +1164,17 @@ def identifyWaf():
11631164
def _(*args, **kwargs):
11641165
page, headers, code = None, None, None
11651166
try:
1167+
pushValue(kb.redirectChoice)
1168+
kb.redirectChoice = REDIRECTION.NO
11661169
if kwargs.get("get"):
11671170
kwargs["get"] = urlencode(kwargs["get"])
11681171
kwargs["raise404"] = False
11691172
kwargs["silent"] = True
11701173
page, headers, code = Request.getPage(*args, **kwargs)
11711174
except Exception:
11721175
pass
1176+
finally:
1177+
kb.redirectChoice = popValue()
11731178
return page or "", headers or {}, code
11741179

11751180
retVal = False

lib/core/enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class HTTP_HEADER:
166166
COOKIE = "Cookie"
167167
SET_COOKIE = "Set-Cookie"
168168
HOST = "Host"
169+
LOCATION = "Location"
169170
PRAGMA = "Pragma"
170171
PROXY_AUTHORIZATION = "Proxy-Authorization"
171172
PROXY_CONNECTION = "Proxy-Connection"

waf/urlscan.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
import re
9+
10+
from lib.core.enums import HTTP_HEADER
11+
from lib.core.settings import WAF_ATTACK_VECTORS
12+
13+
__product__ = "UrlScan (Microsoft)"
14+
15+
def detect(get_page):
16+
retval = False
17+
18+
for vector in WAF_ATTACK_VECTORS:
19+
page, headers, code = get_page(get=vector)
20+
retval = re.search(r"Rejected-By-UrlScan", headers.get(HTTP_HEADER.LOCATION, ""), re.I) is not None
21+
if retval:
22+
break
23+
24+
return retval

0 commit comments

Comments
 (0)