database.cursor.execute("SELECT command, COUNT(domain) AS score FROM instances WHERE command IS NOT NULL GROUP BY command ORDER BY score DESC, command ASC LIMIT ?", [amount])
elif mode == "error_code":
database.cursor.execute("SELECT last_status_code, COUNT(domain) AS score FROM instances WHERE last_status_code IS NOT NULL AND last_status_code != '200' GROUP BY last_status_code ORDER BY score DESC LIMIT ?", [amount])
+ elif mode == "detection_mode":
+ database.cursor.execute("SELECT detection_mode, COUNT(domain) AS cnt FROM instances GROUP BY detection_mode ORDER BY cnt DESC LIMIT ?", [amount])
elif mode == "avg_peers":
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 == "obfuscator":
response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=command&amount={amount}")
elif mode == "error_code" and amount > 0:
response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=error_code&amount={amount}")
+ elif mode == "detection_mode" and amount > 0:
+ response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=detection_mode&amount={amount}")
elif mode == "avg_peers" and amount > 0:
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 == "obfuscator" and amount > 0:
{% extends "base.html" %}
-{% block title %}Scoreboard - {% if mode == 'software' %}TOP {{amount}} used software{% elif mode == 'block_level' %}TOP {{amount}} block level metrics{% elif mode == 'obfuscation' %}obfuscation metrics{% elif mode == 'obfuscator' %}TOP {{amount}} obfuscating 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 == 'detection_mode' %}Detection mode metrics{% elif mode == 'block_level' %}TOP {{amount}} block level metrics{% elif mode == 'obfuscation' %}obfuscation metrics{% elif mode == 'obfuscator' %}TOP {{amount}} obfuscating 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}} commands</h1>
{% elif mode == 'error_code' %}
<h1>TOP {{amount}} error codes</h1>
+ {% elif mode == 'detection_mode' %}
+ <h1>Detection mode metrics</h1>
{% elif mode == 'avg_peers' %}
<h1>TOP {{amount}} average peer count</h1>
{% elif mode == 'obfuscator' %}
<table>
<thead>
<th>№</th>
- <th>{% if mode in ('software', 'avg_peers', 'obfuscator') %}Software{% elif mode == 'obfuscation' %}obfuscation status{% elif mode == 'error_code' %}Error code{% else %}Instance{% endif %}</th>
+ <th>{% if mode in ('software', 'avg_peers', 'obfuscator') %}Software{% elif mode == 'obfuscation' %}obfuscation status{% elif mode == 'detection_mode' %}Detection mode{% 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', 'obfuscator', 'obfuscation', 'block_level') %}Total{% else %}Blocks{% endif %}</th>
</thead>
<tr>
<td>{{loop.index}}</td>
<td>
- {% if mode in ('software', 'command', 'error_code', 'avg_peers', 'obfuscator', 'obfuscation', 'block_level') %}
+ {% if mode in ('software', 'command', 'error_code', 'detection_mode', 'avg_peers', 'obfuscator', 'obfuscation', 'block_level') %}
{{entry['domain']}}
{% elif entry['domain'] == None %}
-
{% block footer %}
{% if mode == 'error_code' %}
<div class="notes">
- <h2>Please note to error codes:</h2>
+ <h2>Error codes:</h2>
<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>
</div>
+ {% elif mode == 'detection_mode' %}
+ <div class="notes">
+ <h2>Detection modes:</h2>
+ <div>
+ Detection is done in following order:
+ </div>
+ <ol>
+ <li><b>AUTO_DISCOVERY</b>: <code>/.well-known/nodeinfo</code> was reachable and software type was found in nodeinfo response</li>
+ <li><b>GENERATOR</b>: Meta data <code>generator</code> was found in HTML code</li>
+ <li><b>SITE_NAME</b>: Meta data <code>og:site_name</code> was found in HTML code</li>
+ <li><b>STATIC_CHECK</b>: All above did not reveal software type, so a check on pre-defined JSON elements was done</li>
+ <li><b>None</b>: the instance was not reachable or the used software was not stated</li>
+ </ol>
+ </div>
{% elif mode == 'obfuscation' %}
<div class="notes">
- <h2>Please note to obfuscation status:</h2>
+ <h2>Obfuscation status:</h2>
<ul>
<li>Only supported networks are counted here.</li>
- <li><em>None</em> means not determined yet.</li>
+ <li><b>None</b> means not determined yet.</li>
</ul>
</div>
{% endif %}