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:
|
||||
j = json.load(f)
|
||||
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:
|
||||
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
|
||||
cache['no_index'] = 1
|
||||
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"
|
||||
|
||||
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)
|
||||
if not cached or 'no_index' in cached:
|
||||
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)
|
||||
|
|
|
@ -111,3 +111,9 @@ hr {
|
|||
border-style: inset;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
#timestamp {
|
||||
text-align: right;
|
||||
color: gray;
|
||||
font-size: small;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,30 @@
|
|||
{% extends "main.html" %}
|
||||
|
||||
{% block title %}Tree{% endblock %}
|
||||
{% block title %}Lookyloo{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<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>
|
||||
</center>
|
||||
<center>
|
||||
{% for uuid, page_title in titles %}
|
||||
<a href="{{ url_for('tree', tree_uuid=uuid) }}">{{ page_title }}</a>
|
||||
</br></br>
|
||||
{% endfor %}
|
||||
</center>
|
||||
|
||||
<table class="table table-hover" data-toggle="table" data-search="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Page title</th>
|
||||
<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 %}
|
||||
|
|
|
@ -10,21 +10,27 @@
|
|||
{% block styles %}
|
||||
<!-- Bootstrap 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 %}
|
||||
|
||||
<title>Lookyloo</title>
|
||||
<title>
|
||||
{% block title %}{% endblock%}
|
||||
</title>
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<!-- Your page contont -->
|
||||
{% block content %}{% endblock%}
|
||||
<div class="container">
|
||||
{% block content %}{% endblock%}
|
||||
</div>
|
||||
|
||||
{% block scripts %}
|
||||
<!-- Optional JavaScript -->
|
||||
{{ 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='FileSaver.js') }}'></script>
|
||||
<script src='{{ url_for('static', filename='bootstrap-table.min.js') }}'></script>
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue