Created
December 16, 2016 18:55
-
-
Save aknik/ff09d30d9d41e3bdb1280fdbe842e32e to your computer and use it in GitHub Desktop.
script bash conexion_wpa_terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WLAN="wlan0" | |
check_interval=30 | |
router_ip="8.8.8.8" | |
#service network-manager stop | |
killall wpa_supplicant | |
airmon-ng check kill | |
ifconfig $WLAN down | |
# usuario-pc 54:04:A6:xx:xx:xx | |
macchanger --mac 54:04:A6:xx:xx:xx $WLAN | |
iw reg set BO | |
#iw reg get | |
#iwconfig $WLAN channel 6 | |
# 30db = 1w 20db = 0.1w | |
iwconfig $WLAN txpower 30 | |
# iw $WLAN set txpower fixed 30mBm | |
ifconfig $WLAN up | |
ifconfig $WLAN 192.168.1.196 netmask 255.255.255.0 | |
ifconfig eth0 192.168.2.1 netmask 255.255.255.0 | |
iptables -t nat -A POSTROUTING -o $WLAN -j MASQUERADE | |
route add default gw 192.168.1.1 $WLAN | |
service unbound restart & | |
iwconfig $WLAN rate 48M | |
wpa_supplicant -B -i $WLAN -c ./Plantillas/configuracion.conf | |
sleep 20 | |
# iw $WLAN link | |
# iwlist $WLAN bitrate | |
startWifi () { | |
killall wpa_supplicant | |
airmon-ng check kill | |
wpa_supplicant -B -i $WLAN -c ./Plantillas/configuracion.conf | |
sleep 10 | |
} | |
while [ 1 ]; do | |
ping -c 1 $router_ip & wait $! | |
if [ $? != 0 ]; then | |
echo $(date)"Intento conexión:" >> log.txt | |
startWifi | |
else sleep $check_interval | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment