-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVap
executable file
·67 lines (53 loc) · 1.35 KB
/
Vap
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/zsh
function get_daemon_id()
{
create_ap --list-running | tail -n1 | cut -d ' ' -f 1;
}
if [[ "$1" = "-h" || "$1" = "--help" || "$1" = "help" ]]; then
echo "Usage:"
echo "\tVap [interface with internet, -n(no internet), clients, stop]";
exit 0;
fi
if [ "$1" = "clients" ]; then
create_ap --list-clients $(get_daemon_id);
exit 0;
fi
if [ "$1" = "stop" ]; then
if ps -e | grep -q "create_ap"; then
create_ap --stop $(get_daemon_id);
for int in $(ip link | grep -oe "ap[0-9]"); do
echo "deleting virtual interface";
iw dev $int del;
done
rm /tmp/create_ap.*;
else
notify-send "there is no access point";
exit 1;
fi
exit 0;
fi
. Vlib.sh
hotspot_mac="f8:1a:67:af:1b:c3";
optionz="--daemon --mac $hotspot_mac --hidden";
cridentials="gringo G350nslz831rV";
interface_wifi="wlan0";
interface_with_internet="eth0";
if [ interface = "NULL" ]; then
echo "requested interface isn't plugged in";
exit 1;
fi
if ps -e | grep -q "create_ap"; then
notify-send "access point already exists";
exit 1;
fi
echo "Access point will be created on $interface_wifi";
if [ -e /tmp/create_ap.all.lock ]; then
echo "deleting the lock";
rm /tmp/create_ap.all.lock;
fi
if [ "$1" = "-n" ]; then
zsh -c "create_ap -n $optionz $interface_wifi $cridentials"
else
zsh -c "create_ap $optionz $interface_wifi $interface_with_internet $cridentials"
fi
exit 0;