mirror of https://github.com/CIRCL/lookyloo
fix: properly ignore resources if only hostname matches
parent
386aa6e91b
commit
f8acca5e51
|
@ -3,7 +3,7 @@
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from typing import Dict, Any, Union, List, Optional, TypedDict, Set, Tuple
|
from typing import Dict, Any, Union, List, Optional, TypedDict, Tuple
|
||||||
|
|
||||||
from har2tree import URLNode
|
from har2tree import URLNode
|
||||||
|
|
||||||
|
@ -166,12 +166,12 @@ class Comparator():
|
||||||
_settings = None
|
_settings = None
|
||||||
ressources_left = {url for url, hostname in left['ressources']
|
ressources_left = {url for url, hostname in left['ressources']
|
||||||
if not _settings
|
if not _settings
|
||||||
or not hostname.endswith(_settings['ressources_ignore_domains'])
|
or (not hostname.endswith(_settings['ressources_ignore_domains'])
|
||||||
or not any(fnmatch.fnmatch(url, regex) for regex in _settings['ressources_ignore_regexes'])}
|
and not any(fnmatch.fnmatch(url, regex) for regex in _settings['ressources_ignore_regexes']))}
|
||||||
ressources_right = {url for url, hostname in right['ressources']
|
ressources_right = {url for url, hostname in right['ressources']
|
||||||
if not _settings
|
if not _settings
|
||||||
or not hostname.endswith(_settings['ressources_ignore_domains'])
|
or (not hostname.endswith(_settings['ressources_ignore_domains'])
|
||||||
or not any(fnmatch.fnmatch(url, regex) for regex in _settings['ressources_ignore_regexes'])}
|
and not any(fnmatch.fnmatch(url, regex) for regex in _settings['ressources_ignore_regexes']))}
|
||||||
if present_in_both := ressources_left & ressources_right:
|
if present_in_both := ressources_left & ressources_right:
|
||||||
to_return['ressources']['both'] = sorted(present_in_both)
|
to_return['ressources']['both'] = sorted(present_in_both)
|
||||||
if present_left := ressources_left - ressources_right:
|
if present_left := ressources_left - ressources_right:
|
||||||
|
|
Loading…
Reference in New Issue