mirror of https://github.com/CIRCL/lookyloo
new: Improve index
parent
eb7b8232e5
commit
89edef68ab
|
@ -75,9 +75,14 @@ class Lookyloo():
|
||||||
with har_files[0].open() as f:
|
with har_files[0].open() as f:
|
||||||
j = json.load(f)
|
j = json.load(f)
|
||||||
title = j['log']['pages'][0]['title']
|
title = j['log']['pages'][0]['title']
|
||||||
|
timestamp = j['log']['pages'][0]['startedDateTime']
|
||||||
|
if j['log']['entries']:
|
||||||
|
first_url = j['log']['entries'][0]['request']['url']
|
||||||
|
else:
|
||||||
|
first_url = '-'
|
||||||
if not title:
|
if not title:
|
||||||
title = '!! No title found !! '
|
title = '!! No title found !! '
|
||||||
cache = {'uuid': uuid, 'title': title}
|
cache = {'uuid': uuid, 'title': title, 'timestamp': timestamp, 'url': first_url}
|
||||||
if (report_dir / 'no_index').exists(): # If the folders claims anonymity
|
if (report_dir / 'no_index').exists(): # If the folders claims anonymity
|
||||||
cache['no_index'] = 1
|
cache['no_index'] = 1
|
||||||
if uuid and not self.redis.exists(str(report_dir)):
|
if uuid and not self.redis.exists(str(report_dir)):
|
||||||
|
|
|
@ -10,3 +10,8 @@ wget -q https://d3js.org/d3.v5.min.js -O web/static/d3.v5.min.js
|
||||||
FileSaver="v2.0.2"
|
FileSaver="v2.0.2"
|
||||||
|
|
||||||
wget -q https://raw.githubusercontent.com/eligrey/FileSaver.js/${FileSaver}/src/FileSaver.js -O web/static/FileSaver.js
|
wget -q https://raw.githubusercontent.com/eligrey/FileSaver.js/${FileSaver}/src/FileSaver.js -O web/static/FileSaver.js
|
||||||
|
|
||||||
|
bootstrap_table="1.15.5"
|
||||||
|
|
||||||
|
wget -q https://unpkg.com/bootstrap-table@${bootstrap_table}/dist/bootstrap-table.min.css -O web/static/bootstrap-table.min.css
|
||||||
|
wget -q https://unpkg.com/bootstrap-table@${bootstrap_table}/dist/bootstrap-table.min.js -O web/static/bootstrap-table.min.js
|
||||||
|
|
|
@ -173,5 +173,8 @@ def index():
|
||||||
cached = lookyloo.report_cache(report_dir)
|
cached = lookyloo.report_cache(report_dir)
|
||||||
if not cached or 'no_index' in cached:
|
if not cached or 'no_index' in cached:
|
||||||
continue
|
continue
|
||||||
titles.append((cached['uuid'], cached['title']))
|
date, time = cached['timestamp'].split('T')
|
||||||
|
time, _ = time.split('.', 1)
|
||||||
|
titles.append((cached['uuid'], cached['title'], date, time, cached['url']))
|
||||||
|
titles = sorted(titles, key=lambda x: (x[2], x[3]), reverse=True)
|
||||||
return render_template('index.html', titles=titles)
|
return render_template('index.html', titles=titles)
|
||||||
|
|
|
@ -111,3 +111,9 @@ hr {
|
||||||
border-style: inset;
|
border-style: inset;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#timestamp {
|
||||||
|
text-align: right;
|
||||||
|
color: gray;
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
|
|
@ -1,16 +1,30 @@
|
||||||
{% extends "main.html" %}
|
{% extends "main.html" %}
|
||||||
|
|
||||||
{% block title %}Tree{% endblock %}
|
{% block title %}Lookyloo{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<center>
|
<center>
|
||||||
<h2><a href="{{ url_for('scrape_web') }}">Scrape a page</a></h2>
|
<h2><a href="{{ url_for('scrape_web') }}">Use Lookyloo to scrape a page</a></h2>
|
||||||
</br></br>
|
</br></br>
|
||||||
</center>
|
</center>
|
||||||
<center>
|
|
||||||
{% for uuid, page_title in titles %}
|
<table class="table table-hover" data-toggle="table" data-search="true">
|
||||||
<a href="{{ url_for('tree', tree_uuid=uuid) }}">{{ page_title }}</a>
|
<thead>
|
||||||
</br></br>
|
<tr>
|
||||||
{% endfor %}
|
<th scope="col">Page title</th>
|
||||||
</center>
|
<th scope="col">Initial URL</th>
|
||||||
|
<tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for uuid, page_title, date, time, url in titles %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="{{ url_for('tree', tree_uuid=uuid) }}">{{ page_title }}</a>
|
||||||
|
<div id="timestamp"> <b>{{ date }}</b> {{ time }}</div>
|
||||||
|
</td>
|
||||||
|
<td>{{ url }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -10,21 +10,27 @@
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
{{ bootstrap.load_css() }}
|
{{ bootstrap.load_css() }}
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='tree.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap-table.min.css') }}">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='tree.css') }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<title>Lookyloo</title>
|
<title>
|
||||||
|
{% block title %}{% endblock%}
|
||||||
|
</title>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Your page contont -->
|
<!-- Your page contont -->
|
||||||
{% block content %}{% endblock%}
|
<div class="container">
|
||||||
|
{% block content %}{% endblock%}
|
||||||
|
</div>
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<!-- Optional JavaScript -->
|
<!-- Optional JavaScript -->
|
||||||
{{ bootstrap.load_js() }}
|
{{ bootstrap.load_js() }}
|
||||||
<script src='{{ url_for('static', filename='FileSaver.js') }}'></script>
|
|
||||||
<script src='{{ url_for('static', filename='d3.v5.min.js') }}'></script>
|
<script src='{{ url_for('static', filename='d3.v5.min.js') }}'></script>
|
||||||
|
<script src='{{ url_for('static', filename='FileSaver.js') }}'></script>
|
||||||
|
<script src='{{ url_for('static', filename='bootstrap-table.min.js') }}'></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue