From 96db269aa6a9f6a7a95ded55969d7e430543a833 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 6 Jul 2023 03:00:00 +0200 Subject: [PATCH] Continued: - added mode=command - added links from list.html --- daemon.py | 4 ++-- templates/views/list.html | 12 +++++++++++- templates/views/scoreboard.html | 4 ++-- templates/widgets/list_links.html | 5 +++++ 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 templates/widgets/list_links.html diff --git a/daemon.py b/daemon.py index a8c0eb9..459f0fc 100755 --- a/daemon.py +++ b/daemon.py @@ -113,9 +113,9 @@ def api_list(request: Request, mode: str, value: str, amount: int): domain = wildchar = punycode = reason = None - if mode in ("detection_mode", "software"): + if mode in ("detection_mode", "software", "command"): database.cursor.execute( - f"SELECT domain, origin, software, command, total_peers, total_blocks, first_seen, last_updated \ + f"SELECT domain, origin, software, detection_mode, command, total_peers, total_blocks, first_seen, last_updated \ FROM instances \ WHERE {mode} = ? \ ORDER BY domain \ diff --git a/templates/views/list.html b/templates/views/list.html index c6851db..27ece0c 100644 --- a/templates/views/list.html +++ b/templates/views/list.html @@ -24,6 +24,7 @@ Domain Origin Software + Detection mode Command First added Last seen @@ -42,7 +43,16 @@ {% include "widgets/links.html" %} {% endwith %} - {{row['software']}} + + {% with mode='software', amount=amount, value=row['software'] %} + {% include "widgets/list_links.html" %} + {% endwith %} + + + {% with mode='detection_mode', amount=amount, value=row['detection_mode'] %} + {% include "widgets/list_links.html" %} + {% endwith %} + {{row['command']}} {{row['first_seen']}} {{row['last_seen']}} diff --git a/templates/views/scoreboard.html b/templates/views/scoreboard.html index a1d9cc1..bb25f1f 100644 --- a/templates/views/scoreboard.html +++ b/templates/views/scoreboard.html @@ -42,13 +42,13 @@ {{loop.index}} - {% if mode in ('command', 'error_code', 'avg_peers', 'obfuscator', 'obfuscation') %} + {% if mode in ('error_code', 'avg_peers', 'obfuscator', 'obfuscation') %} {{entry['domain']}} {% elif entry['domain'] == None %} - {% elif mode == 'block_level' %} {{entry['domain']}} - {% elif mode in ('software', 'detection_mode') %} + {% elif mode in ('software', 'detection_mode', 'command') %} {{entry['domain']}} {% else %} {% with domain=entry['domain'] %} diff --git a/templates/widgets/list_links.html b/templates/widgets/list_links.html new file mode 100644 index 0000000..00bdcf6 --- /dev/null +++ b/templates/widgets/list_links.html @@ -0,0 +1,5 @@ +{% if value != None %} + {{value}} +{% else %} + None +{% endif %} -- 2.39.2