Hopefully successfully integrate proper repo.
This commit is contained in:
29
code/iottb/utils/diagram1.py
Normal file
29
code/iottb/utils/diagram1.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import networkx as nx
|
||||
|
||||
# Create the graph
|
||||
G1 = nx.DiGraph()
|
||||
|
||||
# Add nodes with positions
|
||||
G1.add_node("IoT Device", pos=(1, 3))
|
||||
G1.add_node("AP", pos=(3, 3))
|
||||
G1.add_node("Switch (Port Mirroring Enabled)", pos=(5, 3))
|
||||
G1.add_node("Gateway Router", pos=(7, 3))
|
||||
G1.add_node("Internet", pos=(9, 3))
|
||||
G1.add_node("Capture Device", pos=(5, 1))
|
||||
|
||||
# Add edges
|
||||
G1.add_edge("IoT Device", "AP")
|
||||
G1.add_edge("AP", "Switch (Port Mirroring Enabled)")
|
||||
G1.add_edge("Switch (Port Mirroring Enabled)", "Gateway Router")
|
||||
G1.add_edge("Gateway Router", "Internet")
|
||||
G1.add_edge("Switch (Port Mirroring Enabled)", "Capture Device")
|
||||
|
||||
# Draw the graph
|
||||
pos = nx.get_node_attributes(G1, 'pos')
|
||||
plt.figure(figsize=(12, 8))
|
||||
nx.draw(G1, pos, with_labels=True, node_size=3000, node_color='lightblue', font_size=10, font_weight='bold')
|
||||
nx.draw_networkx_edge_labels(G1, pos, edge_labels={("Switch (Port Mirroring Enabled)", "Capture Device"): "Mirrored Traffic"}, font_color='red')
|
||||
|
||||
plt.title("IoT Device Connected via AP to Gateway Router via Switch with Port Mirroring Enabled")
|
||||
plt.show()
|
||||
27
code/iottb/utils/diagramm2.py
Normal file
27
code/iottb/utils/diagramm2.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import networkx as nx
|
||||
|
||||
# Create the graph
|
||||
G2 = nx.DiGraph()
|
||||
|
||||
# Add nodes with positions
|
||||
G2.add_node("IoT Device", pos=(1, 3))
|
||||
G2.add_node("Capture Device (Hotspot)", pos=(3, 3))
|
||||
G2.add_node("Ethernet Connection", pos=(5, 3))
|
||||
G2.add_node("Gateway Router", pos=(7, 3))
|
||||
G2.add_node("Internet", pos=(9, 3))
|
||||
|
||||
# Add edges
|
||||
G2.add_edge("IoT Device", "Capture Device (Hotspot)")
|
||||
G2.add_edge("Capture Device (Hotspot)", "Ethernet Connection")
|
||||
G2.add_edge("Ethernet Connection", "Gateway Router")
|
||||
G2.add_edge("Gateway Router", "Internet")
|
||||
|
||||
# Draw the graph
|
||||
pos = nx.get_node_attributes(G2, 'pos')
|
||||
plt.figure(figsize=(12, 8))
|
||||
nx.draw(G2, pos, with_labels=True, node_size=3000, node_color='lightblue', font_size=10, font_weight='bold')
|
||||
nx.draw_networkx_edge_labels(G2, pos, edge_labels={("Capture Device (Hotspot)", "Ethernet Connection"): "Bridged Traffic"}, font_color='red')
|
||||
|
||||
plt.title("Capture Device Provides Hotspot and Bridges to Ethernet for Internet")
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user