@@ -57,20 +57,26 @@ <h3>Nodes in the database</h3>
5757 < th > IP</ th >
5858 < th > Role</ th >
5959 < th > Round</ th >
60+ < th > Behaviour</ th >
6061 < th > Status</ th >
6162 < th > Logs</ th >
6263
6364 </ tr >
6465 </ thead >
6566 {% for uid, idx, ip, port, role, neighbors, latitude, longitude, timestamp, federation, round,
66- scenario, hash, status
67+ scenario, hash, malicious, status
6768 in nodes %}
6869 < tr id ="node-{{ uid }} ">
6970 < td id ="uid "> {{ uid }}</ td >
7071 < td id ="idx "> {{ idx }}</ td >
7172 < td id ="ip "> {{ ip }}</ td >
7273 < td id ="role "> {{ role }}</ td >
7374 < td id ="round "> {{ round }}</ td >
75+ {% if malicious == "True" %}
76+ < td id ="malicious "> < span class ="badge text-bg-dark "> Malicious</ span > </ td >
77+ {% else %}
78+ < td id ="malicious "> < span class ="badge text-bg-secondary " style ="width: 60px; "> Benign</ span > </ td >
79+ {% endif %}
7480 {% if status %}
7581 < td id ="status "> < span class ="badge text-bg-success "> Online</ span > </ td >
7682 {% else %}
@@ -536,6 +542,7 @@ <h3>Topology</h3>
536542 var idx = node_row . querySelector ( "#idx" ) ;
537543 var ip = node_row . querySelector ( "#ip" ) ;
538544 var round = node_row . querySelector ( "#round" ) ;
545+ var malicious = node_row . querySelector ( "#malicious" ) ;
539546 var status = node_row . querySelector ( "#status" ) ;
540547
541548 if ( ! idx ) {
@@ -553,6 +560,11 @@ <h3>Topology</h3>
553560 round . id = "round" ;
554561 node_row . appendChild ( round ) ;
555562 }
563+ if ( ! malicious ) {
564+ malicious = document . createElement ( "td" ) ;
565+ malicious . id = "malicious" ;
566+ node_row . appendChild ( malicious ) ;
567+ }
556568 if ( ! status ) {
557569 status = document . createElement ( "td" ) ;
558570 status . id = "status" ;
@@ -563,7 +575,15 @@ <h3>Topology</h3>
563575 ip . innerHTML = node [ 2 ] ;
564576 round . innerHTML = node [ 10 ] ;
565577
566- if ( node [ 13 ] ) {
578+ console . log ( "malicious: " , node [ 13 ] )
579+
580+ if ( node [ 13 ] == "True" ) {
581+ status . innerHTML = '<span class="badge text-bg-dark">Malicious</span>' ;
582+ } else {
583+ status . innerHTML = '<span class="badge text-bg-secondary">Benign</span>' ;
584+ }
585+
586+ if ( node [ 14 ] ) {
567587 status . innerHTML = '<span class="badge text-bg-success">Online</span>' ;
568588 if ( offlineNodes . has ( node [ 2 ] + ":" + node [ 3 ] ) ) {
569589 offlineNodes . delete ( node [ 2 ] + ":" + node [ 3 ] ) ;
@@ -581,7 +601,8 @@ <h3>Topology</h3>
581601 latitude : node [ 6 ] ,
582602 longitude : node [ 7 ] ,
583603 neighbors : node [ 5 ] ,
584- status : node [ 13 ] ,
604+ malicious : node [ 13 ] ,
605+ status : node [ 14 ] ,
585606 } ;
586607 updateQueue . push ( data_json ) ;
587608 } ) ;
@@ -692,7 +713,7 @@ <h3>Topology</h3>
692713 response . json ( ) . then ( function ( data ) {
693714 data [ 'nodes_table' ] . forEach ( function ( node ) {
694715 // Detect if a node has status offline and emit node_remove to the WebSocket
695- if ( ! node [ 13 ] ) {
716+ if ( ! node [ 14 ] ) {
696717 if ( ! offlineNodes . has ( node [ 2 ] + ":" + node [ 3 ] ) ) {
697718 console . log ( "Node " + node [ 2 ] + ":" + node [ 3 ] + " is just offline" ) ;
698719 offlineNodes . add ( node [ 2 ] + ":" + node [ 3 ] ) ;
@@ -709,6 +730,7 @@ <h3>Topology</h3>
709730 timestamp : node [ 8 ] ,
710731 federation : node [ 9 ] ,
711732 round : node [ 10 ] ,
733+ malicious : node [ 13 ] ,
712734 status : false ,
713735 scenario_name : nodeData . scenario_name ,
714736 }
0 commit comments