mirror of https://github.com/CIRCL/lookyloo
new: Locate node with url or hostname on tree when pivotting
parent
1e59faf24d
commit
8f2361427c
|
@ -427,7 +427,7 @@ class Indexing():
|
||||||
if md5_url not in already_indexed_global:
|
if md5_url not in already_indexed_global:
|
||||||
# The URL hasn't been indexed in that run yet
|
# The URL hasn't been indexed in that run yet
|
||||||
already_indexed_global.add(md5_url)
|
already_indexed_global.add(md5_url)
|
||||||
pipeline.sadd(f'{internal_index}|urls', urlnode.name) # Only used to delete index
|
pipeline.sadd(f'{internal_index}|urls', md5_url) # Only used to delete index
|
||||||
pipeline.sadd(f'{internal_index}|hostnames', urlnode.hostname) # Only used to delete index
|
pipeline.sadd(f'{internal_index}|hostnames', urlnode.hostname) # Only used to delete index
|
||||||
pipeline.sadd('urls', urlnode.name)
|
pipeline.sadd('urls', urlnode.name)
|
||||||
pipeline.sadd('hostnames', urlnode.hostname)
|
pipeline.sadd('hostnames', urlnode.hostname)
|
||||||
|
|
|
@ -435,20 +435,24 @@ def get_all_urls(capture_uuid: str, /) -> dict[str, dict[str, int | list[URLNode
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
|
|
||||||
def get_hostname_investigator(hostname: str) -> list[tuple[str, str, str, datetime]]:
|
def get_hostname_investigator(hostname: str) -> list[tuple[str, str, str, datetime, set[str]]]:
|
||||||
'''Returns all the captures loading content from that hostname, used in the web interface.'''
|
'''Returns all the captures loading content from that hostname, used in the web interface.'''
|
||||||
cached_captures = lookyloo.sorted_capture_cache(
|
cached_captures = lookyloo.sorted_capture_cache(
|
||||||
[uuid for uuid, _ in get_indexing(flask_login.current_user).get_captures_hostname(hostname=hostname)],
|
[uuid for uuid, _ in get_indexing(flask_login.current_user).get_captures_hostname(hostname=hostname)],
|
||||||
cached_captures_only=True)
|
cached_captures_only=True)
|
||||||
return [(cache.uuid, cache.title, cache.redirects[-1], cache.timestamp) for cache in cached_captures]
|
return [(cache.uuid, cache.title, cache.redirects[-1], cache.timestamp,
|
||||||
|
get_indexing(flask_login.current_user).get_capture_hostname_nodes(cache.uuid, hostname)
|
||||||
|
) for cache in cached_captures]
|
||||||
|
|
||||||
|
|
||||||
def get_url_investigator(url: str) -> list[tuple[str, str, str, datetime]]:
|
def get_url_investigator(url: str) -> list[tuple[str, str, str, datetime, set[str]]]:
|
||||||
'''Returns all the captures loading content from that url, used in the web interface.'''
|
'''Returns all the captures loading content from that url, used in the web interface.'''
|
||||||
cached_captures = lookyloo.sorted_capture_cache(
|
cached_captures = lookyloo.sorted_capture_cache(
|
||||||
[uuid for uuid, _ in get_indexing(flask_login.current_user).get_captures_url(url=url)],
|
[uuid for uuid, _ in get_indexing(flask_login.current_user).get_captures_url(url=url)],
|
||||||
cached_captures_only=True)
|
cached_captures_only=True)
|
||||||
return [(cache.uuid, cache.title, cache.redirects[-1], cache.timestamp) for cache in cached_captures]
|
return [(cache.uuid, cache.title, cache.redirects[-1], cache.timestamp,
|
||||||
|
get_indexing(flask_login.current_user).get_capture_url_nodes(cache.uuid, url)
|
||||||
|
) for cache in cached_captures]
|
||||||
|
|
||||||
|
|
||||||
def get_cookie_name_investigator(cookie_name: str, /) -> tuple[list[tuple[str, str]], list[tuple[str, float, list[tuple[str, float]]]]]:
|
def get_cookie_name_investigator(cookie_name: str, /) -> tuple[list[tuple[str, str]], list[tuple[str, float, list[tuple[str, float]]]]]:
|
||||||
|
@ -1245,7 +1249,6 @@ def tree(tree_uuid: str, node_uuid: str | None=None) -> Response | str | Werkzeu
|
||||||
hostnode_to_highlight = hostnode.uuid
|
hostnode_to_highlight = hostnode.uuid
|
||||||
except IndexError as e:
|
except IndexError as e:
|
||||||
logging.info(f'Invalid uuid ({e}): {node_uuid}')
|
logging.info(f'Invalid uuid ({e}): {node_uuid}')
|
||||||
pass
|
|
||||||
if cache.error:
|
if cache.error:
|
||||||
flash(cache.error, 'warning')
|
flash(cache.error, 'warning')
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for capture_uuid, title, landing_page, capture_time in captures %}
|
{% for capture_uuid, title, landing_page, capture_time, nodes in captures %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{{capture_time}}
|
{{capture_time}}
|
||||||
|
@ -39,6 +39,17 @@
|
||||||
<a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">
|
<a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</a>
|
</a>
|
||||||
|
<br>
|
||||||
|
The capture contains this hostname in {{ nodes|length }} nodes, click below to see them on the tree:
|
||||||
|
<ul>
|
||||||
|
{% for node in nodes %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ url_for('tree', tree_uuid=capture_uuid, node_uuid=node) }}">
|
||||||
|
{{ shorten_string(node, 50) }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="d-inline-block text-break" style="max-width: 400px;">
|
<span class="d-inline-block text-break" style="max-width: 400px;">
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for capture_uuid, title, landing_page, capture_time in captures %}
|
{% for capture_uuid, title, landing_page, capture_time, nodes in captures %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{{capture_time}}
|
{{capture_time}}
|
||||||
|
@ -39,6 +39,17 @@
|
||||||
<a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">
|
<a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</a>
|
</a>
|
||||||
|
<br>
|
||||||
|
The capture contains this URL in {{ nodes|length }} nodes, click below to see them on the tree:
|
||||||
|
<ul>
|
||||||
|
{% for node in nodes %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ url_for('tree', tree_uuid=capture_uuid, node_uuid=node) }}">
|
||||||
|
{{ shorten_string(node, 50) }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="d-inline-block text-break" style="max-width: 400px;">
|
<span class="d-inline-block text-break" style="max-width: 400px;">
|
||||||
|
|
Loading…
Reference in New Issue