SIEM Big Data Visualization [05] : P2PComm_GeoTopology_Map_Plugin_App
This article will introduce the Peer to Peer Communication Geolocation Topology Map Plugin App developed for SIEM big data analytics. This is part of the SIEM big data visualization project, if you are interested about other dashboard plug in, you can check below links:
Program Design Purpose:
The goal of this project is to develop a Flask-based web App plugin that can be integrated into other Security Information and Event Management (SIEM) system for devices' communication data and state visualization. This plugin is designed to visualize real-time peer-to-peer (P2P) communication status within a distributed system with key metrics such as data flow throughput between encrypted devices and data transmission speed between servers and clients will be displayed alongside the network topology on an interactive geolocation map. This visualization Web-App will enable security administrators to effectively monitor, analyze, and manage real-time P2P communication states, helping to identify potential performance bottlenecks, latency issues, and abnormal communication patterns across the distributed network.
For the program demo, please refer to this video:
# Version: v0.2.1
# Created: 2020/05/22
# Copyright: Copyright (c) 2024 LiuYuancheng
# License: MIT License
Introduction
The P2PComm_GeoTopology_Map_Plugin is a Flask-based web application designed to visualize real-time peer-to-peer (P2P) communication diagrams and network topology over an interactive geolocation map. The plugin app use Google Maps API and full customizable configuration settings to provide an all-in-one HTML webpage which can be easily integrated in other into other Security Information and Event Management (SIEM) systems to make it a valuable addition for monitoring and managing distributed network communications. The Web plug UI is shown below:
This tool can help the security administrators with enhanced capabilities to monitor and analyze distributed system communications. The four features provided by the program are:
System Main Components Introduction
The project is structured into three main components:
System Design
The system workflow diagram is shown below:
The system includes four function modules:
Module[1] : Flask Web Host Application
Module[2] : Data Management Module
Module[3] : Database
CREATE TABLE IF NOT EXISTS gatewayInfo(id integer PRIMARY KEY, name text NOT NULL,ipAddr text NOT NULL,lat float NOT NULL,lng float NOT NULL, actF integer NOT NULL, rptTo integer NOT NULL,type text NOT NULL)
CREATE TABLE IF NOT EXISTS gatewayState(time float PRIMARY KEY,id text NOT NULL, updateInfo text NOT NULL)
Module[4] : Data Collector
User Interface Design
In the demo web app, we added a sidebar attached beside the map which allow users to change various map settings. The user can choose the data update rate of the flask webserver calling GET request through a dropdown menu. A filter function is also added to adjust the display certain types of communication links (active, gateway, control hub).
The design of the control side bar is shown below:
The design of symbols, icons and links on the map panel is shown below:
Program Setup
Development Environment : Python3.7.4, HTML+flask, socketIO+eventlet, SQLite3
Additional Lib/Software Need :
Hardware Needed : None
Program Files List:
Program Usage
Follow the below steps to execute the program
Step1 : Setup the configuration file
Rename the src/config_template.txt to config.txt , then fill in the your google map API Key and set the parameters as shown below:
# This is the config file template for P2P communication display map
# emulator program <p2pCommMapApp.py>
# Setup the parameter with below format (every line follows <key>:<value> format, the
# key can not be changed):
#-----------------------------------------------------------------------------
# Database file name
DB_NAME:node_database.db
# Node information record
NODES_INFO:nodes_record.json
# Google Map API key
MAP_API_KEY:AIzaSyBoHBPqxFw40DFvCbXrj1IWNcvkzb6WkkI
# Set the Hub GPS location
HUB_LAT:1.2945315
HUB_LONG:103.7746052
#-----------------------------------------------------------------------------
# Init the PLC local web Flask app parameters
FLASK_SER_PORT:5000
FLASK_DEBUG_MD:False
FLASK_MULTI_TH:True
Rename the src/nodes_record_template.json to src/nodes_record.txt and add your node in the json file with below info:
"<Node_ID>": {
"no": 1,
"name": "NUS",
"ipAddr": "10.0.0.1",
"lat": 1.2964053,
"lng": 103.7690442,
"type": "GW",
"rptTo": 0,
"actF": 0
}
To find the Geolocation GPS of a IP you can use the online tool or this app: https://github.com/LiuYuancheng/IPGeoPosLocater
Step 2 : Run the test data creator and map P2PComm_GeoTopology_Map App
Start up the data insert simulation program to add new gateway
python3 databaseCreater.py
If you want to link to your system call the module function updateStateTable(self, gatewayID, infoStr) to insert the new gateway state in to database.
Run the flask webserver:
python3 p2pCommMapApp.py
Step3 : View the P2PComm_GeoTopology_Map
After running step2, wait 10 sec make sure the database thread fully started then do step 3, open web browser and enter URL: https://127.0.0.1:5000, then check the web plug in as shown below:
You can use iframe to integrate the map in your SIEM dashboard, for example in Grafana dashboard you can set the AJAX config as shown below:
Then you can see the map will show on the Grafana dashboard page:
Project GitHub Repo Link:
Thanks for spending time to check the article detail, if you have any question and suggestion or find any program bug, please feel free to message me. Many thanks if you can give some comments and share any of the improvement advice so we can make our work better ~