database.cursor.execute("SELECT software, AVG(total_peers) AS average FROM instances WHERE software IS NOT NULL GROUP BY software HAVING average>0 ORDER BY average DESC LIMIT ?", [amount])
elif mode == "obsfucator":
database.cursor.execute("SELECT software, COUNT(domain) AS cnt FROM instances WHERE has_obsfucation = 1 GROUP BY software ORDER BY cnt DESC LIMIT ?", [amount])
+ elif mode == "obsfucation":
+ database.cursor.execute("SELECT has_obsfucation, COUNT(domain) AS cnt FROM instances WHERE software IN ('pleroma', 'mastodon') GROUP BY has_obsfucation ORDER BY cnt DESC LIMIT ?", [amount])
else:
raise HTTPException(status_code=400, detail="No filter specified")
response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=avg_peers&amount={amount}")
elif mode == "obsfucator" and amount > 0:
response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=obsfucator&amount={amount}")
+ elif mode == "obsfucation" and amount > 0:
+ response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=obsfucation&amount={amount}")
else:
raise HTTPException(status_code=400, detail="No filter specified")
<a href="{{base_url}}/scoreboard?mode=command&amount=10">commands</a> /
<a href="{{base_url}}/scoreboard?mode=error_code&amount=30">error codes</a> /
<a href="{{base_url}}/scoreboard?mode=avg_peers&amount=30">average peers</a> /
- <a href="{{base_url}}/scoreboard?mode=obsfucator&amount=30">obsfucating software</a>
+ <a href="{{base_url}}/scoreboard?mode=obsfucator&amount=30">obsfucating software</a> /
+ <a href="{{base_url}}/scoreboard?mode=obsfucation&amount=10">obsfucation metrics</a>
</p>
{% endblock %}
{% block footer %}
{% extends "base.html" %}
-{% block title %}Scoreboard - {% if mode == 'software' %}TOP {{amount}} used software{% elif mode == 'obsfucator' %}TOP {{amount}} obsfucating software{% elif mode == 'avg_peers' %}TOP {{amount}} average peer count{% elif mode == 'command' %}TOP {{amount}} commands{% elif mode == 'error_code' %}TOP {{amount}} error codes{% elif mode == 'reference' %}TOP {{amount}} referencing instances{% elif mode == 'blocked' %}TOP {{amount}} deferated instances{% elif mode == 'blocker' %}TOP {{amount}} deferating instances{% endif %}{% endblock %}
+{% block title %}Scoreboard - {% if mode == 'software' %}TOP {{amount}} used software{% elif mode == 'obsfucation' %}Obsfucation metrics{% elif mode == 'obsfucator' %}TOP {{amount}} obsfucating software{% elif mode == 'avg_peers' %}TOP {{amount}} average peer count{% elif mode == 'command' %}TOP {{amount}} commands{% elif mode == 'error_code' %}TOP {{amount}} error codes{% elif mode == 'reference' %}TOP {{amount}} referencing instances{% elif mode == 'blocked' %}TOP {{amount}} deferated instances{% elif mode == 'blocker' %}TOP {{amount}} deferating instances{% endif %}{% endblock %}
{% block header %}
{% if mode == 'blocker' %}
<h1>TOP {{amount}} average peer count</h1>
{% elif mode == 'obsfucator' %}
<h1>TOP {{amount}} obsfucating software</h1>
+ {% elif mode == 'obsfucator' %}
+ <h1>Obsfucation metrics</h1>
{% endif %}
{% endblock %}
<table>
<thead>
<th>№</th>
- <th>{% if mode in ('software', 'avg_peers', 'obsfucator') %}Software{% elif mode == 'error_code' %}Error code{% else %}Instance{% endif %}</th>
- <th>{% if mode == 'reference' %}References{% elif mode == 'avg_peers' %}Average{% elif mode in('software', 'error_code', 'obsfucator') %}Total{% else %}Blocks{% endif %}</th>
+ <th>{% if mode in ('software', 'avg_peers', 'obsfucator') %}Software{% elif mode == 'obsfucation' %}Obsfucation status{% elif mode == 'error_code' %}Error code{% else %}Instance{% endif %}</th>
+ <th>{% if mode == 'reference' %}References{% elif mode == 'avg_peers' %}Average{% elif mode in('software', 'error_code', 'obsfucator', 'obsfucation') %}Total{% else %}Blocks{% endif %}</th>
</thead>
<tbody>
<tr>
<td>{{loop.index}}</td>
<td>
- {% if mode in ('software', 'command', 'error_code', 'avg_peers', 'obsfucator') %}
+ {% if mode in ('software', 'command', 'error_code', 'avg_peers', 'obsfucator', 'obsfucation') %}
{{entry['domain']}}
{% elif entry['domain'] == None %}
-
<ul>
<li>Error code 999 is fake and covers a lot of reasons why the domain/instance is not reachable. Mostly that the domain is not resolvable or the server refused connection.</li>
</ul>
+ {% elif mode == 'obsfucation' %}
+ <h2>Please note to obsfucation status:</h2>
+ <ul>
+ <li>Only supported networks are listed here.</li>
+ <li><em>None</em> means not determined yet.</li>
+ </ul>
{% endif %}
<a href="{{base_url}}/">Index</a> /
{{ super() }}