@@ -50,20 +50,16 @@ def run(self, saved_state):
50
50
51
51
if self .exclude is not None :
52
52
# Regex input via config.yml
53
- # Example: security|threat|malware
54
- xml_exclude = re .compile (r"{0}" .format (self .exclude )).findall (str (self .exclude .split ('|' )))
53
+ xml_exclude = re .sub (re .compile (fr"{ self .exclude } " , re .IGNORECASE ), "" , str (loc ))
54
+
55
+ if xml_exclude :
56
+ if self .path is None and "http" in xml_exclude :
57
+ text = soup .get_text (separator = ' ' ).split ('Indicators of Compromise' )[- 1 ]
58
+ artifacts += self .process_element (content = text , reference_link = str (loc ), include_nonobfuscated = True )
55
59
56
- # Iterates over the regex output to locate all provided keywords
57
- for xe in xml_exclude :
58
60
# Uses a path instead of a keyword
59
61
if self .path is not None :
60
- if self .path in loc :
61
- text = soup .get_text (separator = ' ' ).split ('Indicators of Compromise' )[- 1 ]
62
- artifacts += self .process_element (content = text , reference_link = str (loc ), include_nonobfuscated = True )
63
-
64
- # Only filters using a keyword
65
- if self .path is None :
66
- if xe not in loc :
62
+ if self .path in xml_exclude :
67
63
text = soup .get_text (separator = ' ' ).split ('Indicators of Compromise' )[- 1 ]
68
64
artifacts += self .process_element (content = text , reference_link = str (loc ), include_nonobfuscated = True )
69
65
@@ -86,15 +82,15 @@ def run(self, saved_state):
86
82
text = soup .get_text (separator = ' ' ).split ('Indicators of Compromise' )[- 1 ]
87
83
artifacts += self .process_element (content = text , reference_link = str (loc ), include_nonobfuscated = True )
88
84
89
- if self .include is None or self .exclude is None and self .path is not None :
85
+ if self .include is None and self .exclude is None and self .path is not None :
90
86
# Filters only by path in XML loc, no set include
91
87
# Default: /path/name/*
92
88
93
89
if self .path in loc :
94
90
text = soup .get_text (separator = ' ' ).split ('Indicators of Compromise' )[- 1 ]
95
91
artifacts += self .process_element (content = text , reference_link = str (loc ), include_nonobfuscated = True )
96
92
97
- if self .include is None and self .path is None and self .exclude is None :
93
+ if self .include is None and self .exclude is None and self .path is None :
98
94
# Locates all blog links within the sitemap
99
95
if "blog" in loc :
100
96
text = soup .get_text (separator = ' ' ).split ('Indicators of Compromise' )[- 1 ]
0 commit comments