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
|
||||
Reference in New Issue
Block a user