Hopefully successfully integrate proper repo.
This commit is contained in:
55
code/iottb/scripts/wifi_ctl.sh
Normal file
55
code/iottb/scripts/wifi_ctl.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# Note, this is not my original work. Source: https://linuxtldr.com/changing-interface-mode/
|
||||
|
||||
function list_nic_info () {
|
||||
ip addr show
|
||||
}
|
||||
|
||||
function enable_monm_iw () {
|
||||
interface=$1
|
||||
sudo ip link set "$interface" down
|
||||
sudo iw "$interface" set monitor control
|
||||
sudo ip link set "$interface" up
|
||||
}
|
||||
|
||||
function disable_monm_iw () {
|
||||
interface=$1
|
||||
sudo ip link set "$interface" down
|
||||
sudo iw "$interface" set type managed
|
||||
sudo ip link set "$interface" up
|
||||
}
|
||||
|
||||
function enable_monm_iwconfig () {
|
||||
interface=$1
|
||||
sudo ifconfig "$interface" down
|
||||
sudo iwconfig "$interface" mode monitor
|
||||
sudo ifconfig "$interface" up
|
||||
}
|
||||
|
||||
function disable_monm_iwconfig () {
|
||||
interface=$1
|
||||
sudo ifconfig "$interface" down
|
||||
sudo iwconfig "$interface" mode managed
|
||||
sudo ifconfig "$interface" up
|
||||
}
|
||||
|
||||
function enable_monm_acng () {
|
||||
interface=$1
|
||||
sudo airmon-ng check
|
||||
sudo airmon-ng check kill
|
||||
sudo airmon-ng start "$interface"
|
||||
}
|
||||
|
||||
function disable_monm_acng () {
|
||||
interface="${1}mon"
|
||||
sudo airmon-ng stop "$interface"
|
||||
sudo systemctl restart NetworkManager
|
||||
}
|
||||
|
||||
if declare -f "$1" > /dev/null
|
||||
then
|
||||
"$@"
|
||||
else
|
||||
echo "Unknown function '$1'" >&2
|
||||
exit 1
|
||||
fi
|
||||
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