Merge branch 'FafnerKeyZee-main' into main

pull/134/head
Raphaël Vinot 2020-11-25 15:27:56 +01:00
commit 19976adeda
3 changed files with 90 additions and 2 deletions

View File

@ -1043,10 +1043,10 @@ class Lookyloo():
for month in sorted(data.keys()):
_stats = data[month]
mstats = {}
mstats['analysys'] = _stats['analysis']
mstats['analysis'] = _stats['analysis']
mstats['analysis_with_redirects'] = _stats['analysis_with_redirects']
mstats['redirects'] = _stats['redirects']
mstats['uniq_url'] = len(_stats['uniq_urls'])
mstats['uniq_urls'] = len(_stats['uniq_urls'])
mstats['uniq_domains'] = len(uniq_domains(_stats['uniq_urls']))
yearly_analysis += _stats['analysis']
yearly_redirects += _stats['redirects']

View File

@ -9,6 +9,7 @@ from pathlib import Path
from datetime import datetime, timedelta
import json
import http
import calendar
from flask import Flask, render_template, request, send_file, redirect, url_for, Response, flash, jsonify
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)
def month_name(month: int):
return calendar.month_name[month]
app.jinja_env.globals.update(month_name=month_name)
# ##### Generic/configuration methods #####
@app.after_request
@ -509,6 +517,12 @@ def body_hash_details(body_hash: str):
return render_template('body_hash.html', body_hash=body_hash, domains=domains, captures=captures)
@app.route('/stats', methods=['GET'])
def statsfull():
stats = lookyloo.get_stats()
return render_template('stats.html', stats=stats)
# ##### Methods related to a specific URLNode #####
@app.route('/tree/<string:tree_uuid>/url/<string:node_uuid>/request_cookies', methods=['GET'])

View File

@ -0,0 +1,74 @@
{% extends "main.html" %}
{% block title %}Statistics{% endblock %}
{% block content %}
<div>
{% for weeks in stats['weeks'] %}
<h2> Week: {{ weeks['week'] }}</h2>
<div class="table-responsive">
<table id="table" class="table" style="width:96%">
<thead>
<tr>
<th>Submissions</th>
<th>Submissions with redirects</th>
<th>Redirects</th>
<th>Uniq urls</th>
<th>Uniq domains</th>
</tr>
</thead>
<tbody>
<tr>
<td> {{ weeks['analysis'] }} </td>
<td> {{ weeks['analysis_with_redirects'] }} </td>
<td> {{ weeks['redirects'] }} </td>
<td> {{ weeks['uniq_urls'] }} </td>
<td> {{ weeks['uniq_domains'] }} </td>
</tr>
</tbody>
</table>
</div>
{% endfor %}
</div>
<div>
{% for name, dict_ in stats['years'].items() %}
<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>
{% for monthnumber, month in dict_.items() %}
{% if monthnumber is number %}
<h4>{{ month_name(monthnumber) }}</h4>
<div class="table-responsive">
<table id="table" class="table" style="width:96%">
<thead>
<tr>
<th>Submissions</th>
<th>Submissions with redirects</th>
<th>Redirects</th>
<th>Uniq urls</th>
<th>Uniq domains</th>
</tr>
</thead>
<tbody>
<tr>
<td> {{ month['analysis'] }} </td>
<td> {{ month['analysis_with_redirects'] }} </td>
<td> {{ month['redirects'] }} </td>
<td> {{ month['uniq_urls'] }} </td>
<td> {{ month['uniq_domains'] }} </td>
</tr>
</tbody>
</table>
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
{% endblock %}