mirror of https://github.com/CIRCL/lookyloo
chg: Cleanup on stats page
parent
0e3d007bf5
commit
d2bd113ab8
|
@ -9,6 +9,7 @@ from pathlib import Path
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import json
|
import json
|
||||||
import http
|
import http
|
||||||
|
import calendar
|
||||||
|
|
||||||
from flask import Flask, render_template, request, send_file, redirect, url_for, Response, flash, jsonify
|
from flask import Flask, render_template, request, send_file, redirect, url_for, Response, flash, jsonify
|
||||||
from flask_bootstrap import Bootstrap # type: ignore
|
from flask_bootstrap import Bootstrap # type: ignore
|
||||||
|
@ -80,6 +81,13 @@ def http_status_description(code: int):
|
||||||
app.jinja_env.globals.update(http_status_description=http_status_description)
|
app.jinja_env.globals.update(http_status_description=http_status_description)
|
||||||
|
|
||||||
|
|
||||||
|
def month_name(month: int):
|
||||||
|
return calendar.month_name[month]
|
||||||
|
|
||||||
|
|
||||||
|
app.jinja_env.globals.update(month_name=month_name)
|
||||||
|
|
||||||
|
|
||||||
# ##### Generic/configuration methods #####
|
# ##### Generic/configuration methods #####
|
||||||
|
|
||||||
@app.after_request
|
@app.after_request
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
<div>
|
<div>
|
||||||
{% for weeks in stats['weeks'] %}
|
{% for weeks in stats['weeks'] %}
|
||||||
<h2> Week: {{ weeks['week'] }}</h2>
|
<h2> Week: {{ weeks['week'] }}</h2>
|
||||||
|
<div class="table-responsive">
|
||||||
<table id="table" class="table" style="width:96%">
|
<table id="table" class="table" style="width:96%">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Submissions</th>
|
<th>Submissions</th>
|
||||||
<th>Submissions with redirects</th>
|
<th>Submissions with redirects</th>
|
||||||
|
@ -15,26 +17,35 @@
|
||||||
<th>Uniq urls</th>
|
<th>Uniq urls</th>
|
||||||
<th>Uniq domains</th>
|
<th>Uniq domains</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th> {{ weeks['analysis'] }} </th>
|
<td> {{ weeks['analysis'] }} </td>
|
||||||
<th> {{ weeks['analysis_with_redirects'] }} </th>
|
<td> {{ weeks['analysis_with_redirects'] }} </td>
|
||||||
<th> {{ weeks['redirects'] }} </th>
|
<td> {{ weeks['redirects'] }} </td>
|
||||||
<th> {{ weeks['uniq_urls'] }} </th>
|
<td> {{ weeks['uniq_urls'] }} </td>
|
||||||
<th> {{ weeks['uniq_domains'] }} </th>
|
<td> {{ weeks['uniq_domains'] }} </td>
|
||||||
</tr>
|
</tr>
|
||||||
<table>
|
</tbody>
|
||||||
</br>
|
</table>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{% for name, dict_ in stats['years'].items() %}
|
{% for name, dict_ in stats['years'].items() %}
|
||||||
<h2>Year : {{ name }} - Analysis : {{ dict_['yearly_analysis']}} - Redirects : {{ dict_['yearly_redirects'] }}</h2>
|
<h2>Year: {{ name }}</h2>
|
||||||
|
<ul>
|
||||||
|
<li><b>Total analysis</b>: {{ dict_['yearly_analysis'] }}</li>
|
||||||
|
<li><b>Total redirects</b>: {{ dict_['yearly_redirects'] }}</li>
|
||||||
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
{% for monthnumber, month in dict_.items() %}
|
{% for monthnumber, month in dict_.items() %}
|
||||||
{% if monthnumber is number %}
|
{% if monthnumber is number %}
|
||||||
<h3>{{ monthnumber }}</h3>
|
<h4>{{ month_name(monthnumber) }}</h4>
|
||||||
|
<div class="table-responsive">
|
||||||
<table id="table" class="table" style="width:96%">
|
<table id="table" class="table" style="width:96%">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Submissions</th>
|
<th>Submissions</th>
|
||||||
<th>Submissions with redirects</th>
|
<th>Submissions with redirects</th>
|
||||||
|
@ -42,14 +53,18 @@
|
||||||
<th>Uniq urls</th>
|
<th>Uniq urls</th>
|
||||||
<th>Uniq domains</th>
|
<th>Uniq domains</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th> {{ month['analysis'] }} </th>
|
<td> {{ month['analysis'] }} </td>
|
||||||
<th> {{ month['analysis_with_redirects'] }} </th>
|
<td> {{ month['analysis_with_redirects'] }} </td>
|
||||||
<th> {{ month['redirects'] }} </th>
|
<td> {{ month['redirects'] }} </td>
|
||||||
<th> {{ month['uniq_urls'] }} </th>
|
<td> {{ month['uniq_urls'] }} </td>
|
||||||
<th> {{ month['uniq_domains'] }} </th>
|
<td> {{ month['uniq_domains'] }} </td>
|
||||||
</tr>
|
</tr>
|
||||||
<table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue