GeekTony commited on
Commit
9d8745f
1 Parent(s): aa72c46

Create app.py

Browse files

custom Cyber Threat Map pleasing display -Geektony

Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+ import networkx as nx
4
+
5
+ def get_cyber_map():
6
+ url = "https://threatmap.checkpoint.com/ThreatPortal/livemap.html"
7
+ response = requests.get(url)
8
+ html = response.text
9
+ return html
10
+
11
+ def get_cyber_graph():
12
+ G = nx.Graph()
13
+ G.add_nodes_from(["Attacker", "Target", "Malware", "Vulnerability"])
14
+ G.add_edges_from([("Attacker", "Malware"), ("Malware", "Vulnerability"), ("Vulnerability", "Target")])
15
+ return G
16
+
17
+ map_component = gr.HTML(fn=get_cyber_map, live=True)
18
+ graph_component = gr.Network(fn=get_cyber_graph)
19
+
20
+ iface = gr.Interface(
21
+ fn=None,
22
+ inputs=None,
23
+ outputs=[map_component, graph_component],
24
+ layout="horizontal"
25
+ )
26
+
27
+ iface.launch()