new: Improve hostnode popup, center tree on node

pull/78/head
Raphaël Vinot 2020-06-21 03:07:50 +02:00
parent 29c78d3485
commit a4bc2b2818
3 changed files with 7 additions and 8 deletions

View File

@ -133,7 +133,7 @@ class Indexing():
# set of all captures with this hash
pipeline.sadd(f'bh|{urlnode.body_hash}|captures', crawled_tree.uuid)
# ZSet of all urlnode_UUIDs|full_url
pipeline.zincrby(f'bh|{urlnode.body_hash}|captures|{crawled_tree.uuid}', 1, f'{urlnode.uuid}|{urlnode.name}')
pipeline.zincrby(f'bh|{urlnode.body_hash}|captures|{crawled_tree.uuid}', 1, f'{urlnode.uuid}|{urlnode.hostnode_uuid}|{urlnode.name}')
pipeline.execute()
@ -141,9 +141,9 @@ class Indexing():
to_return = []
for capture_uuid in self.redis.smembers(f'bh|{body_hash}|captures'):
for entry in self.redis.zrevrange(f'bh|{body_hash}|captures|{capture_uuid}', 0, -1):
url_uuid, url = entry.split('|', 1)
url_uuid, hostnode_uuid, url = entry.split('|', 2)
if filter_url is None or url != filter_url:
to_return.append((capture_uuid, url_uuid, urlsplit(url).hostname))
to_return.append((capture_uuid, hostnode_uuid, urlsplit(url).hostname))
return to_return
def get_body_hash_domains(self, body_hash: str) -> List[Tuple[str, float]]:
@ -748,7 +748,7 @@ class Lookyloo():
for capture_uuid, url_uuid, url_hostname in indexing.get_body_hash_captures(url.body_hash, url.name):
cache = self.get_capture_cache(capture_uuid)
if cache:
captures_list.append((capture_uuid, cache['title'], url_hostname))
captures_list.append((capture_uuid, url_uuid, cache['title'], url_hostname))
to_append['body_hash_details']['other_captures'] = captures_list

View File

@ -373,7 +373,6 @@ def tree(tree_uuid: str, urlnode_uuid: Optional[str]=None):
user_agent=user_agent, root_url=root_url, tree_uuid=tree_uuid,
meta=meta, enable_mail_notification=enable_mail_notification,
urlnode_uuid=urlnode_uuid)
except NoValidHarFile as e:
return render_template('error.html', error_message=e)

View File

@ -124,7 +124,7 @@
</br>
{% if url['body_hash_details']['other_captures'] %}
<p>
The same file was seen in <b>{{ url['body_hash_details']['other_captures']|length }}</b> other captures.
The same file was seen in <b>{{ url['body_hash_details']['other_captures']|length }}</b> other captures <b>on a different URL</b>.
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#captureslist_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
Toggle list.
</button>
@ -132,8 +132,8 @@
<div class="collapse" id="captureslist_{{ url['url_object'].uuid }}">
<div class="card card-body">
<ul>
{% for capture_uuid, title, hostname in url['body_hash_details']['other_captures'] %}
<li><a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">{{ title }}</a> - {{ hostname }} </li>
{% for capture_uuid, urlnode_uuid, title, hostname in url['body_hash_details']['other_captures'] %}
<li><a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }} </li>
{% endfor %}
</ul>
</div>