mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-10-31 16:07:55 +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 PAYLOAD | ||||
| from lib.core.enums import PLACE | ||||
| from lib.core.enums import REDIRECTION | ||||
| from lib.core.exception import SqlmapConnectionException | ||||
| from lib.core.exception import SqlmapNoneDataException | ||||
| from lib.core.exception import SqlmapSilentQuitException | ||||
|  | @ -1163,6 +1164,8 @@ def identifyWaf(): | |||
|     def _(*args, **kwargs): | ||||
|         page, headers, code = None, None, None | ||||
|         try: | ||||
|             pushValue(kb.redirectChoice) | ||||
|             kb.redirectChoice = REDIRECTION.NO | ||||
|             if kwargs.get("get"): | ||||
|                 kwargs["get"] = urlencode(kwargs["get"]) | ||||
|             kwargs["raise404"] = False | ||||
|  | @ -1170,6 +1173,8 @@ def identifyWaf(): | |||
|             page, headers, code = Request.getPage(*args, **kwargs) | ||||
|         except Exception: | ||||
|             pass | ||||
|         finally: | ||||
|             kb.redirectChoice = popValue() | ||||
|         return page or "", headers or {}, code | ||||
| 
 | ||||
|     retVal = False | ||||
|  |  | |||
|  | @ -166,6 +166,7 @@ class HTTP_HEADER: | |||
|     COOKIE = "Cookie" | ||||
|     SET_COOKIE = "Set-Cookie" | ||||
|     HOST = "Host" | ||||
|     LOCATION = "Location" | ||||
|     PRAGMA = "Pragma" | ||||
|     PROXY_AUTHORIZATION = "Proxy-Authorization" | ||||
|     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