new: Add tooltips on every icons in the popup

pull/145/head
Raphaël Vinot 2021-01-01 22:47:34 +01:00
parent 2fbf5d520f
commit c492674194
2 changed files with 42 additions and 30 deletions

View File

@ -67,7 +67,7 @@ def sizeof_fmt(num, suffix='B'):
if abs(num) < 1024.0: if abs(num) < 1024.0:
return "%3.1f%s%s" % (num, unit, suffix) return "%3.1f%s%s" % (num, unit, suffix)
num /= 1024.0 num /= 1024.0
return "%.1f%s%s" % (num, 'Yi', suffix) return ("%.1f%s%s" % (num, 'Yi', suffix)).strip()
app.jinja_env.globals.update(sizeof_fmt=sizeof_fmt) app.jinja_env.globals.update(sizeof_fmt=sizeof_fmt)
@ -129,27 +129,27 @@ def urls_hostnode(tree_uuid: str, node_uuid: str):
@app.route('/tree/<string:tree_uuid>/host/<string:node_uuid>', methods=['GET']) @app.route('/tree/<string:tree_uuid>/host/<string:node_uuid>', methods=['GET'])
def hostnode_popup(tree_uuid: str, node_uuid: str): def hostnode_popup(tree_uuid: str, node_uuid: str):
keys_response = { keys_response = {
'js': "/static/javascript.png", 'js': {'icon': "javascript.png", 'tooltip': 'The content of the response is a javascript'},
'exe': "/static/exe.png", 'exe': {'icon': "exe.png", 'tooltip': 'The content of the response is an executable'},
'css': "/static/css.png", 'css': {'icon': "css.png", 'tooltip': 'The content of the response is a CSS'},
'font': "/static/font.png", 'font': {'icon': "font.png", 'tooltip': 'The content of the response is a font'},
'html': "/static/html.png", 'html': {'icon': "html.png", 'tooltip': 'The content of the response is a HTML document'},
'json': "/static/json.png", 'json': {'icon': "json.png", 'tooltip': 'The content of the response is a Json'},
'text': "/static/json.png", # FIXME: Need new icon 'text': {'icon': "json.png", 'tooltip': 'The content of the response is a text'}, # FIXME: Need new icon
'iframe': "/static/ifr.png", 'iframe': {'icon': "ifr.png", 'tooltip': 'This content is loaded from an Iframe'},
'image': "/static/img.png", 'image': {'icon': "img.png", 'tooltip': 'The content of the response is an image'},
'unset_mimetype': "/static/wtf.png", 'unset_mimetype': {'icon': "wtf.png", 'tooltip': 'The type of content of the response is not set'},
'octet-stream': "/static/wtf.png", 'octet-stream': {'icon': "wtf.png", 'tooltip': 'The type of content of the response is a binary blob'},
'unknown_mimetype': "/static/wtf.png", 'unknown_mimetype': {'icon': "wtf.png", 'tooltip': 'The type of content of the response is of an unknown type'},
'video': "/static/video.png", 'video': {'icon': "video.png", 'tooltip': 'The content of the response is a video'},
'livestream': "/static/video.png", 'livestream': {'icon': "video.png", 'tooltip': 'The content of the response is a livestream'},
'response_cookie': "/static/cookie_received.png", 'response_cookie': {'icon': "cookie_received.png", 'tooltip': 'There are cookies in the response'},
# redirect has to be last # redirect has to be last
'redirect': "/static/redirect.png", 'redirect': {'icon': "redirect.png", 'tooltip': 'The request is redirected'},
'redirect_to_nothing': "/static/cookie_in_url.png" 'redirect_to_nothing': {'icon': "cookie_in_url.png", 'tooltip': 'The request is redirected to an URL we do not have in the capture'}
} }
keys_request = { keys_request = {
'request_cookie': "/static/cookie_read.png", 'request_cookie': {'icon': "cookie_read.png", 'tooltip': 'There are cookies in the request'}
} }
hostnode, urls = lookyloo.get_hostnode_investigator(tree_uuid, node_uuid) hostnode, urls = lookyloo.get_hostnode_investigator(tree_uuid, node_uuid)

View File

@ -244,26 +244,36 @@
{% macro popup_icons(lookup_dict, urlnode, tree_uuid) %} {% macro popup_icons(lookup_dict, urlnode, tree_uuid) %}
<div> <div>
{% for key, path in lookup_dict.items() %} {% for key, icon_info in lookup_dict.items() %}
{% if urlnode[key] %} {% if urlnode[key] %}
{% if key == "request_cookie" %} {% if key == "request_cookie" %}
<a href="{{ url_for('urlnode_request_cookies', tree_uuid=tree_uuid, node_uuid=urlnode.uuid) }}" title="Download all the cookies in the request to the server"> <a href="{{ url_for('urlnode_request_cookies', tree_uuid=tree_uuid, node_uuid=urlnode.uuid) }}"
<img src="{{ path }}" alt="{{ key }}" width="21" height="21"/> title="Download all the cookies in the request to the server">
<img src="{{ url_for('static', filename=icon_info['icon']) }}" alt="{{ icon_info['tooltip'] }}"
width="21" height="21"/>
</a> </a>
{% elif key == "response_cookie"%} {% elif key == "response_cookie"%}
<a href="{{ url_for('urlnode_response_cookies', tree_uuid=tree_uuid, node_uuid=urlnode.uuid) }}" title="Download all the cookies in the response from the server"> <a href="{{ url_for('urlnode_response_cookies', tree_uuid=tree_uuid, node_uuid=urlnode.uuid) }}"
<img src="{{ path }}" alt="{{ key }}" width="21" height="21"/> title="Download all the cookies in the response from the server">
<img src="{{ url_for('static', filename=icon_info['icon']) }}" alt="{{ icon_info['tooltip'] }}"
width="21" height="21"/>
</a> </a>
{% elif key in ["js", "exe", "css", "font", "html", "json", "image", "video", "unknown_mimetype", "text", "unset_mimetype", "octet-stream", "livestream"] and not urlnode.empty_response %} {% elif key in ["js", "exe", "css", "font", "html", "json", "image", "video",
"unknown_mimetype", "text", "unset_mimetype", "octet-stream", "livestream"]
and not urlnode.empty_response %}
<a href="{{ url_for('get_ressource', tree_uuid=tree_uuid, node_uuid=urlnode.uuid) }}"> <a href="{{ url_for('get_ressource', tree_uuid=tree_uuid, node_uuid=urlnode.uuid) }}">
<img src="{{ path }}" alt="{{ key }}" width="21" height="21" <img src="{{ url_for('static', filename=icon_info['icon']) }}" alt="{{ icon_info['tooltip'] }}"
width="21" height="21"
{% if key == "image" %} {% if key == "image" %}
data-toggle="tooltip" data-placement="bottom" data-html="true" title='<img src="{{ url_for('get_ressource_preview', tree_uuid=tree_uuid, node_uuid=urlnode.uuid) }}"/> </br>Click to download the content of the response in a zip file' data-toggle="tooltip" data-placement="bottom" data-html="true" title='<img src="{{ url_for('get_ressource_preview', tree_uuid=tree_uuid, node_uuid=urlnode.uuid) }}"/> </br>Click to download the content of the response in a zip file'
{% else %}
data-toggle="tooltip" data-placement="bottom" data-html="true" title="{{icon_info['tooltip']}} <br/>Click to download."
{% endif %} {% endif %}
/> />
</a> </a>
{% elif key != "redirect" %} {% elif key != "redirect" %}
<img src="{{ path }}" alt="{{ key }}" width="21" height="21"/> <img src="{{ url_for('static', filename=icon_info['icon']) }}"
alt="{{ icon_info['tooltip'] }}" title="{{ icon_info['tooltip'] }}" width="21" height="21"/>
{%endif%} {%endif%}
{%endif%} {%endif%}
{% endfor %} {% endfor %}
@ -275,11 +285,13 @@
<div title='{{ urlnode.redirect_url }}'> <div title='{{ urlnode.redirect_url }}'>
<b>Redirect to</b>: {{ shorten_string(urlnode.redirect_url, 50) }} <b>Redirect to</b>: {{ shorten_string(urlnode.redirect_url, 50) }}
<a href="#/" role="button" onclick="whereAmI('{{ child.hostnode_uuid }}')" title="See the node the URL redirects to."> <a href="#/" role="button" onclick="whereAmI('{{ child.hostnode_uuid }}')" title="See the node the URL redirects to.">
<img src="{{ lookup_dict['redirect'] }}" alt="{{ key }}" width="21" height="21"/> <img src="{{ url_for('static', filename=lookup_dict['redirect']['icon']) }}" alt="{{ lookup_dict['redirect']['tooltip'] }}" width="21" height="21"/>
</a> </a>
</div> </div>
{% else %} {% else %}
<img src="{{ lookup_dict['redirect'] }}" alt="redirect" width="21" height="21"/> <img src="{{ url_for('static', filename=lookup_dict['redirect']['icon']) }}"
alt="{{ lookup_dict['redirect']['tooltip'] }}" title="{{ lookup_dict['redirect']['tooltip'] }}"
width="21" height="21"/>
{% endfor %} {% endfor %}
{%endif%} {%endif%}
</div> </div>