Nombre: Show2.bash
Autor: @_tty0
Descripción: Script que te muestra la IP pública.
Visto en
tty0
#!/bin/bash
# Print the current Internet IP address
#--- CONFIG HERE ---
CURL='/usr/bin/curl'
NC='/usr/bin/netcat'
SERVER='http://checkip.dyndns.org/'
PORT=80
#--------------------
[ -e ${CURL} ] && ( ${CURL} -s ${SERVER} | tr '>' '\n' | tr '<' '\n' | grep 'Current IP Address:' ; exit $? )
[ -e ${NC} ] && ( echo -ne "GET /index.html HTTP/1.0\n\n" | \
${NC} ${SERVER} ${PORT} | tr '>' '\n' | tr '<' '\n' | \
grep 'Current IP Address:' | sed 's|Current IP Address:|inet ip:|g'; exit $? )
Permisos: chmod 700 show2.bash
Ejecución: ./show2.bash
0 comentarios:
Publicar un comentario