diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 33c44e7d..67da7d9a 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -757,9 +757,9 @@ class Lookyloo(): return captures[0] return None - def get_url_occurrences(self, url: str, /, limit: int=20) -> List[Dict]: + def get_url_occurrences(self, url: str, /, limit: int=20, cached_captures_only: bool=True) -> List[Dict]: '''Get the most recent captures and URL nodes where the URL has been seen.''' - captures = self.sorted_capture_cache(self.indexing.get_captures_url(url)) + captures = self.sorted_capture_cache(self.indexing.get_captures_url(url), cached_captures_only=cached_captures_only) to_return: List[Dict] = [] for capture in captures[:limit]: @@ -777,9 +777,9 @@ class Lookyloo(): to_return.append(to_append) return to_return - def get_hostname_occurrences(self, hostname: str, /, with_urls_occurrences: bool=False, limit: int=20) -> List[Dict]: + def get_hostname_occurrences(self, hostname: str, /, with_urls_occurrences: bool=False, limit: int=20, cached_captures_only: bool=True) -> List[Dict]: '''Get the most recent captures and URL nodes where the hostname has been seen.''' - captures = self.sorted_capture_cache(self.indexing.get_captures_hostname(hostname)) + captures = self.sorted_capture_cache(self.indexing.get_captures_hostname(hostname), cached_captures_only=cached_captures_only) to_return: List[Dict] = [] for capture in captures[:limit]: diff --git a/website/web/genericapi.py b/website/web/genericapi.py index 56f5fcac..18fd9bd6 100644 --- a/website/web/genericapi.py +++ b/website/web/genericapi.py @@ -280,6 +280,7 @@ class HashInfo(Resource): url_info_fields = api.model('URLInfoFields', { 'url': fields.String(description="The URL to search", required=True), 'limit': fields.Integer(description="The maximal amount of captures to return", example=20), + 'cached_captures_only': fields.Boolean(description="If false, re-cache the missing captures (can take a while)", default=True), }) @@ -297,6 +298,7 @@ class URLInfo(Resource): hostname_info_fields = api.model('HostnameInfoFields', { 'hostname': fields.String(description="The hostname to search", required=True), 'limit': fields.Integer(description="The maximal amount of captures to return", example=20), + 'cached_captures_only': fields.Boolean(description="If false, re-cache the missing captures (can take a while)", default=True), })