Herramientas de usuario

Herramientas del sitio


public:recetas:muestragraficascaminoguifinet

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

public:recetas:muestragraficascaminoguifinet [2013/11/08 08:34] – creado mperezpublic:recetas:muestragraficascaminoguifinet [2013/11/13 11:05] (actual) mperez
Línea 2: Línea 2:
  
 <code> <code>
 +
 #!/bin/bash #!/bin/bash
  
Línea 7: Línea 8:
  
 # The option -d indicates that the URLs have to be shown in the browser # The option -d indicates that the URLs have to be shown in the browser
-if [ $1 == "-d" ]; then IP=$2; else IP=$1; fi 
  
 +#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 #for ips in `traceroute -n 10.228.130.1 | grep -v traceroute | cut -d " " -f 4`; do
-Para filtrar las 192.168+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 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"   url="http://guifi.net/ca/guifi/menu/ip/ipsearch/$ips"
   echo $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   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 [ $== "-d" ]; then +    if [ $DOWNLOAD == "true" ]; then 
           $BROWSER $i           $BROWSER $i
     fi     fi
-    echo "  ",$i+    echo "  "$i
  
   done   done
 done done
 </code> </code>
public/recetas/muestragraficascaminoguifinet.1383899691.txt.gz · Última modificación: 2013/11/08 08:34 por mperez