chg: More UI fixes

pull/78/head
Raphaël Vinot 2020-07-17 18:39:50 +02:00
parent b4e5d1be08
commit 09d04e0835
9 changed files with 76 additions and 52 deletions

9
poetry.lock generated
View File

@ -296,7 +296,7 @@ description = "HTTP Archive (HAR) to ETE Toolkit generator"
name = "har2tree"
optional = false
python-versions = ">=3.6,<4.0"
version = "1.1.2"
version = "1.1.3"
[package.dependencies]
beautifulsoup4 = ">=4.8.2,<5.0.0"
@ -304,6 +304,7 @@ ete3 = ">=3.1.1,<4.0.0"
lxml = ">=4.4.2,<5.0.0"
publicsuffix2 = ">=2.20191221,<3.0"
six = ">=1.14.0,<2.0.0"
w3lib = ">=1.22.0,<2.0.0"
[[package]]
category = "main"
@ -1070,7 +1071,7 @@ test = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[metadata]
content-hash = "c9aa6060104496ed0b551c7cf561573af1f67bad2e5c8eec5c938feda7e578b0"
content-hash = "483b931ed59303511a2b23a8953ceb2486400de4ec5090c5cffdc2780f2d5143"
python-versions = "^3.7"
[metadata.files]
@ -1260,8 +1261,8 @@ gunicorn = [
{file = "gunicorn-20.0.4.tar.gz", hash = "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626"},
]
har2tree = [
{file = "har2tree-1.1.2-py3-none-any.whl", hash = "sha256:45fdd0fda073cc454975c64a8f6a4667734c8eb61ba2bc4497866ff7d142e01b"},
{file = "har2tree-1.1.2.tar.gz", hash = "sha256:29c95ea4d9f63db977bf6453421ddcf08c2326c6092d9454cde75b9b7c7d918f"},
{file = "har2tree-1.1.3-py3-none-any.whl", hash = "sha256:a587375f18f2f3933c6708c122d273d114fe435d946f7bc3297d33ce50c14439"},
{file = "har2tree-1.1.3.tar.gz", hash = "sha256:538ce736a6824db538d341b2624fa596ad4df1e850be42b9d7f09ff8c0c55df3"},
]
hyperlink = [
{file = "hyperlink-19.0.0-py2.py3-none-any.whl", hash = "sha256:ab4a308feb039b04f855a020a6eda3b18ca5a68e6d8f8c899cbe9e653721d04f"},

View File

@ -44,9 +44,9 @@ defang = "^0.5.3"
vt-py = "^0.5.2"
Flask-HTTPAuth = "^3.3.0"
pyeupi = "^1.0"
har2tree = "^1.1"
scrapysplashwrapper = "^1.1"
pysanejs = "^1.1"
har2tree = "^1.1.3"
[tool.poetry.dev-dependencies]
mypy = "^0.761"

View File

@ -344,7 +344,10 @@ def redirects(tree_uuid: str):
return Response('Not available.', mimetype='text/text')
if not cache['redirects']:
return Response('No redirects.', mimetype='text/text')
to_return = BytesIO('\n'.join(cache['redirects']).encode())
if cache['url'] == cache['redirects'][0]:
to_return = BytesIO('\n'.join(cache['redirects']).encode())
else:
to_return = BytesIO('\n'.join([cache['url']] + cache['redirects']).encode())
return send_file(to_return, mimetype='text/text',
as_attachment=True, attachment_filename='redirects.txt')

View File

@ -24,3 +24,7 @@ $('select[name="browser"]').change(function(){
$("[id='" + os_name + '_' + browser_name + "']").show();
$("[id='" + os_name + '_' + browser_name + "'] > div > select").removeAttr('disabled');
});
$('#btn-looking').click(function() {
$('#btn-looking').html('<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Looking...').addClass('disabled');
});

View File

@ -121,3 +121,10 @@ table td p {
text-overflow: ellipsis;
margin: 0;
}
[data-toggle="collapse"].collapsed .if-not-collapsed {
display: none;
}
[data-toggle="collapse"]:not(.collapsed) .if-collapsed {
display: none;
}

View File

@ -50,8 +50,8 @@
{# Headers #}
<center>
<h3>{{ hostname }}</h3>
<button type="button" class="btn btn-info" onclick="whereAmI('{{ hostname_uuid }}')">Locate node on tree</button>
<a href="{{ url_for('hostnode_details_text', tree_uuid=tree_uuid, node_uuid=hostname_uuid) }}" class="btn btn-info" role="button">Get URLs as text</a>
<button type="button" class="btn btn-info" onclick="whereAmI('{{ hostname_uuid }}')">Flag node on tree</button>
<a href="{{ url_for('hostnode_details_text', tree_uuid=tree_uuid, node_uuid=hostname_uuid) }}" class="btn btn-info" role="button">Download URLs as text</a>
</center>
{# Start list of URLs #}
<ul class="list-group-flush">
@ -81,6 +81,35 @@
... /{{ shorten_string(url['url_path'], 50)}}
</div>
<ul class="list-group">
<li class="list-group-item">
<p class="h4">Request</p>
{{ popup_icons(keys_request, url['url_object'], tree_uuid) }}
{% if url['url_object'].posted_data %}
<a href="{{ url_for('urlnode_post_request', tree_uuid=tree_uuid, node_uuid=url['url_object'].uuid) }}">
Download posted data
</a></br>
Posted data size: {{ sizeof_fmt(url['url_object'].posted_data|length) }}
{% endif %}
{% if url['cookies_sent'] %}
<div>
<p class="h5">This request contains cookies.
<button class="btn btn-primary collapsed" type="button" data-toggle="collapse" data-target="#request_cookies_full_list_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
<span class="if-collapsed">Show cookies sent.</span>
<span class="if-not-collapsed">Hide cookies sent.</span>
</button>
</p>
<div class="collapse" id="request_cookies_full_list_{{ url['url_object'].uuid }}">
<div class="card card-body">
{{ indexed_cookies("List of cookies sent in the request", "Flag node setting this cookie", url['cookies_sent']) }}
</div>
</div>
</div>
{% endif %}
</li>
<li class="list-group-item">
{# Details of the response #}
<p class="h4">Response <small>(Status code: {{ url['url_object'].response['status'] }})</small></p>
@ -119,10 +148,12 @@
{% if url['embedded_ressources'] %}
{# Details on embedded resources #}
<div><b>This response contains embedded ressources</b></div>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#embedded_full_list_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
Toggle list of embedded resources.
<div><b>This response contains embedded ressources</b>
<button class="btn btn-primary collapsed" type="button" data-toggle="collapse" data-target="#embedded_full_list_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
<span class="if-collapsed">Show embedded resources.</span>
<span class="if-not-collapsed">Hide embedded resources.</span>
</button>
</div>
<div class="collapse" id="embedded_full_list_{{ url['url_object'].uuid }}">
<div class="card card-body">
{% for hash, details in url['embedded_ressources'].items() %}
@ -153,47 +184,21 @@
{% if url['cookies_received'] %}
<div>
<p class="h5">This response contains cookies.
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#response_cookies_full_list_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
Show all cookies received.
<button class="btn btn-primary collapsed" type="button" data-toggle="collapse" data-target="#response_cookies_full_list_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
<span class="if-collapsed">Show cookies received.</span>
<span class="if-not-collapsed">Hide cookies received.</span>
</button>
</p>
<div class="collapse" id="response_cookies_full_list_{{ url['url_object'].uuid }}">
<div class="card card-body">
{{ indexed_cookies("This response contains 3rd party cookies:", "Show node sending this cookie", url['cookies_received']['3rd_party']) }}
{{ indexed_cookies("Cookies, sent somewhere in the capture", "Show node sending this cookie", url['cookies_received']['sent']) }}
{{ indexed_cookies("This response contains 3rd party cookies:", "Flag node sending this cookie", url['cookies_received']['3rd_party']) }}
{{ indexed_cookies("Cookies, sent somewhere in the capture", "Flag node sending this cookie", url['cookies_received']['sent']) }}
{{ indexed_cookies("Cookies, never sent", "", url['cookies_received']['not_sent']) }}
</div>
</div>
</div>
{% endif %}
</li>
<li class="list-group-item">
<p class="h4">Request</p>
{{ popup_icons(keys_request, url['url_object'], tree_uuid) }}
{% if url['url_object'].posted_data %}
<a href="{{ url_for('urlnode_post_request', tree_uuid=tree_uuid, node_uuid=url['url_object'].uuid) }}">
Download posted data
</a></br>
Posted data size: {{ sizeof_fmt(url['url_object'].posted_data|length) }}
{% endif %}
{% if url['cookies_sent'] %}
<div>
<p class="h5">This request contains cookies.
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#request_cookies_full_list_{{ url['url_object'].uuid }}" aria-expanded="false" aria-controls="collapseExample">
Show all cookies sent.
</button>
</p>
<div class="collapse" id="request_cookies_full_list_{{ url['url_object'].uuid }}">
<div class="card card-body">
{{ indexed_cookies("List of cookies sent in the request", "Show on tree node setting this cookie", url['cookies_sent']) }}
</div>
</div>
</div>
{% endif %}
</li>
</ul>
</li>
{% endfor %}

View File

@ -1,6 +1,7 @@
{% extends "main.html" %}
{% from 'bootstrap/utils.html' import render_messages %}
{% from "macros.html" import shorten_string %}
{% block title %}Lookyloo{% endblock %}
@ -63,7 +64,7 @@ $(document).ready(function () {
<tr>
<td>
<p title="{{ page_title }}"><a href="{{ url_for('tree', tree_uuid=uuid) }}">{{ page_title }}</a></p>
<p title="{{ url }}">{{ url }}</p>
<p title="{{ url }}">{{ shorten_string(url, 150) }}</p>
</td>
<td>{{ datetime }}</td>
<td>
@ -71,9 +72,9 @@ $(document).ready(function () {
{% for r in redirects %}
<p title="{{ r }}">
{% if loop.previtem %}
{{ ("&nbsp;" * (loop.index *2) )|safe }}↪ {{ r }}
{{ ("&nbsp;" * (loop.index *2) )|safe }}↪ {{ shorten_string(r, 50) }}
{%else%}
{{ r }}
{{ shorten_string(r, 50) }}
{%endif%}
</p>
{% endfor %}

View File

@ -18,8 +18,9 @@
{% if total_captures > 0 %}
<p>
The same file was seen in <b>{{ total_captures }}</b> other captures.
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#captureslist_{{ identifier_for_toggle }}" aria-expanded="false" aria-controls="collapseExample">
Toggle list.
<button class="btn btn-primary collapsed" type="button" data-toggle="collapse" data-target="#captureslist_{{ identifier_for_toggle }}" aria-expanded="false" aria-controls="collapseExample">
<span class="if-collapsed">Show other captures</span>
<span class="if-not-collapsed">Hide other captures</span>
</button>
</p>
{# Lists of other captures loading the same content... #}
@ -69,12 +70,12 @@
{% if detail|length == 1 %}
<li>
{{ detail[0] }}: <a href="{{ url_for('cookies_name_detail', cookie_name=cookie_name_value[0]) }}">
{{ cookie_name_value[0] }}</a>={{ cookie_name_value[1] }}
{{ cookie_name_value[0] }}</a>={{ shorten_string(cookie_name_value[1], 200) }}
</li>
{% else %}
<li>
{{ detail[0] }}: <a href="{{ url_for('cookies_name_detail', cookie_name=cookie_name_value[0]) }}">
{{ cookie_name_value[0] }}</a>={{ cookie_name_value[1] }} -
{{ cookie_name_value[0] }}</a>={{ shorten_string(cookie_name_value[1], 200) }} -
<button type="button" class="btn btn-info" onclick="whereAmI('{{ detail[1] }}')">{{ button_text }}</button>
</li>
{% endif %}

View File

@ -42,9 +42,9 @@
</div>
<div class="form-group row">
<label for="referer" class="col-sm-2 col-form-label">Referer:</label>
<label for="referer" class="col-sm-2 col-form-label">Referer (Optional):</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="referer" id=referer placeholder="Referer of the URL to capture">
<input type="text" class="form-control" name="referer" id=referer placeholder="Pass referer of the URL">
</div>
</div>
@ -96,7 +96,9 @@
{% endfor%}
{% endfor%}
<div class="dropdown-divider"></div>
<center><button type="submit" class="btn btn-primary">Start looking!</button></center>
<center>
<button type="submit" class="btn btn-primary" id="btn-looking">Start looking!</button>
</center>
</form>
</div>
{% endblock %}