====== Mostrar las gráficas de un camino en guifi.net ====== #!/bin/bash BROWSER=firefox # The option -d indicates that the URLs have to be shown in the browser #getopt code reused partially from http://linuxwell.com/2011/07/14/getopt-in-bash/ ARGS=`getopt -o "d" -l "download" \ -n "getopt.sh" -- "$@"` #Bad arguments if [ $? -ne 0 ]; then exit 1 fi # A little magic eval set -- "$ARGS" DOWNLOAD="false" # Now go through all the options while true; do case "$1" in -d|--download) DOWNLOAD="true" shift;; --) shift break;; esac done IP=$1 #for ips in `traceroute -n 10.228.130.1 | grep -v traceroute | cut -d " " -f 4`; do # to filter the 192.168.X.X for ips in `traceroute -n $IP | grep -v traceroute | cut -d " " -f 4 | grep -v -E "^192.168."`; do url="http://guifi.net/ca/guifi/menu/ip/ipsearch/$ips" echo $ips for i in $(wget -qO - $url | grep $ips| grep href | grep -v language | sed -e 's/href="/\nhttp:\/\/guifi.net\//g'| sed -e 's/">/\n/g' | grep http); do if [ $DOWNLOAD == "true" ]; then $BROWSER $i fi echo " "$i done done