diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 2b1e3a28..75c639f4 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -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'] diff --git a/website/web/__init__.py b/website/web/__init__.py index 94a605c1..8a139266 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -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//url//request_cookies', methods=['GET']) diff --git a/website/web/templates/stats.html b/website/web/templates/stats.html new file mode 100644 index 00000000..550d3472 --- /dev/null +++ b/website/web/templates/stats.html @@ -0,0 +1,74 @@ +{% extends "main.html" %} + +{% block title %}Statistics{% endblock %} + + +{% block content %} +
+{% for weeks in stats['weeks'] %} +

Week: {{ weeks['week'] }}

+
+ + + + + + + + + + + + + + + + + + + +
SubmissionsSubmissions with redirectsRedirectsUniq urlsUniq domains
{{ weeks['analysis'] }} {{ weeks['analysis_with_redirects'] }} {{ weeks['redirects'] }} {{ weeks['uniq_urls'] }} {{ weeks['uniq_domains'] }}
+
+{% endfor %} +
+ +
+{% for name, dict_ in stats['years'].items() %} +

Year: {{ name }}

+
    +
  • Total analysis: {{ dict_['yearly_analysis'] }}
  • +
  • Total redirects: {{ dict_['yearly_redirects'] }}
  • +
+
+ {% for monthnumber, month in dict_.items() %} + {% if monthnumber is number %} +

{{ month_name(monthnumber) }}

+
+ + + + + + + + + + + + + + + + + + + +
SubmissionsSubmissions with redirectsRedirectsUniq urlsUniq domains
{{ month['analysis'] }} {{ month['analysis_with_redirects'] }} {{ month['redirects'] }} {{ month['uniq_urls'] }} {{ month['uniq_domains'] }}
+
+ {% endif %} + {% endfor %} +
+{% endfor %} +
+ +{% endblock %}