-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…hes the found firewall into memory, incase we run across it again we don't waste our time trying to discover it, fixes #175 and #176 if there are unicode chars in the value it will not be saved
- Loading branch information
ekultek
committed
Nov 28, 2017
1 parent
4c496b2
commit 97187c0
Showing
8 changed files
with
90 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from functools import wraps | ||
|
||
import lib.core.settings | ||
|
||
|
||
def cache(func): | ||
""" | ||
if we come across the same URL more then once, it will be cached into memory | ||
so that we don't have to test it again | ||
""" | ||
__cache = {} | ||
|
||
@wraps(func) | ||
def func_wrapper(*args, **kwargs): | ||
if args in __cache: | ||
lib.core.settings.logger.warning(lib.core.settings.set_color( | ||
"cached detection has shown that the target URL WAF/IPS/IDS is '{}'...".format( | ||
__cache[args] | ||
), level=35 | ||
)) | ||
return __cache[args] | ||
else: | ||
__to_cache = func(*args, **kwargs) | ||
__cache[args] = __to_cache | ||
return __to_cache | ||
|
||
return func_wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import re | ||
|
||
from lib.core.common import HTTP_HEADER | ||
|
||
|
||
__item__ = "BIG-IP Application Security Manager (F5 Networks)" | ||
|
||
|
||
def detect(content, **kwargs): | ||
headers = kwargs.get("headers", None) | ||
detection_schema = ( | ||
re.compile(r"\ATS\w{4,}=", re.I), re.compile(r"BIGip|BipServer", re.I), | ||
re.compile(r"\AF5\Z", re.I) | ||
) | ||
for detection in detection_schema: | ||
if detection.search(headers.get(HTTP_HEADER.SERVER, "")) is not None: | ||
return True | ||
if detection.search(headers.get(HTTP_HEADER.SET_COOKIE, "")) is not None: | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters