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])
+ database.cursor.execute("SELECT software, AVG(total_peers) AS average FROM instances WHERE software IS NOT NULL AND total_peers IS NOT NULL GROUP BY software HAVING average > 0 ORDER BY average DESC LIMIT ?", [amount])
+ elif mode == "avg_blocks":
+ database.cursor.execute("SELECT software, AVG(total_blocks) AS average FROM instances WHERE software IS NOT NULL AND total_blocks IS NOT NULL GROUP BY software HAVING average > 0 ORDER BY average DESC LIMIT ?", [amount])
elif mode == "obfuscator":
database.cursor.execute("SELECT software, COUNT(domain) AS cnt FROM instances WHERE has_obfuscation = 1 GROUP BY software ORDER BY cnt DESC LIMIT ?", [amount])
elif mode == "obfuscation":
{% extends "base.html" %}
-{% block title %}Scoreboard - {% if mode == 'software' %}TOP {{amount}} used software{% elif mode == 'detection_mode' %}Detection mode statistics{% elif mode == 'block_level' %}TOP {{amount}} block level statistics{% elif mode == 'obfuscation' %}Obfuscation statistics{% 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 statistics
+ {% elif mode == 'block_level' %}TOP {{amount}} block level statistics
+ {% elif mode == 'obfuscation' %}Obfuscation statistics
+ {% elif mode == 'obfuscator' %}TOP {{amount}} obfuscating software
+ {% elif mode == 'avg_peers' %}TOP {{amount}} average peer count
+ {% elif mode == 'avg_blocks' %}TOP {{amount}} average block 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>Detection mode statistics</h1>
{% elif mode == 'avg_peers' %}
<h1>TOP {{amount}} average peer count</h1>
+ {% elif mode == 'avg_blocks' %}
+ <h1>TOP {{amount}} average block count</h1>
{% elif mode == 'obfuscator' %}
<h1>TOP {{amount}} obfuscating software</h1>
{% elif mode == 'obfuscation' %}
<thead>
<th>№</th>
<th>
- {% if mode in ('software', 'avg_peers', 'obfuscator') %}Software
+ {% if mode in ('software', 'avg_peers', 'avg_blocks', 'obfuscator') %}Software
{% elif mode == 'obfuscation' %}Obfuscation status
{% elif mode == 'detection_mode' %}Detection mode
{% elif mode == 'error_code' %}Error code
</th>
<th>
{% if mode == 'reference' %}References
- {% elif mode == 'avg_peers' %}Average
+ {% elif mode in('avg_peers', 'avg_blocks') %}Average
{% elif mode in('software', 'error_code', 'obfuscator', 'obfuscation', 'block_level', 'detection_mode', 'command') %}Total
{% else %}Blocks
{% endif %}
{{entry['domain']}}
{% elif mode == 'block_level' %}
<a href="top?mode={{mode}}&value={{entry['domain']}}&amount=50">{{entry['domain']}}</a>
- {% elif mode in ('avg_peers', 'obfuscator') %}
+ {% elif mode in ('avg_peers', 'avg_blocks', 'obfuscator') %}
<a href="list?mode=software&value={{entry['domain']}}&amount=50">{{entry['domain']}}</a>
{% elif mode in ('software', 'detection_mode', 'command') %}
<a href="list?mode={{mode}}&value={{entry['domain']}}&amount=50">{{entry['domain']}}</a>