Skip to content

Instantly share code, notes, and snippets.

@aknik
Created December 16, 2016 18:55
Show Gist options
  • Save aknik/ff09d30d9d41e3bdb1280fdbe842e32e to your computer and use it in GitHub Desktop.
Save aknik/ff09d30d9d41e3bdb1280fdbe842e32e to your computer and use it in GitHub Desktop.
script bash conexion_wpa_terminal
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