-
Notifications
You must be signed in to change notification settings - Fork 6
/
testhostapd
executable file
·28 lines (26 loc) · 960 Bytes
/
testhostapd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
dhcpcd="/etc/dhcpcd.conf"
dhcpcdap="/etc/dhcpcd_ap.conf"
echo -e "\n\e[97mTHIS SCRIPT WILL MANUALLY START HOSTAPD FOR TESTING\e[0m"
echo -e "\t- Requires pre-configured /etc/dhcpcd_ap.conf file"
echo
echo -e "\e[91mWARNING: If you proceed, your wireless connection will be interrupted! Proceed only if this a direct terminal or ethernet SSH connection"
echo
echo -en "\e[0mPress any key to proceed or Ctrl-c to quit... "
read -rsn1 keyin
echo
echo -e "\n\e[93mSwitching to wireless Access Point mode"
sudo cp "$dhcpcd" /etc/dhcpcd_tmp.conf
sudo cp "$dhcpcdap" "$dhcpcd"
sudo systemctl restart dhcpcd
echo -e "\n\e[0m * Starting hostapd; \e[97m\e[1mCtrl-c\e[22m to exit hostapd when done *\e[0m"
echo
sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
echo
echo -e "\e[93mSwitching back to wireless client mode"
sudo cp /etc/dhcpcd_tmp.conf "$dhcpcd"
sudo rm /etc/dhcpcd_tmp.conf
sudo systemctl restart dhcpcd
echo
echo -e "\e[97mDone\e[0m"
echo