Mostrando entradas con la etiqueta Ip. Mostrar todas las entradas
Mostrando entradas con la etiqueta Ip. Mostrar todas las entradas

Iptables Script

d
Visto en The Lone Pole
#!/bin/bash
if [ -z $1 ]; then
        echo "Usage: $0  [reason]";
        exit;
fi

IP=$1
REASON="denied ip"

if [ $# -gt 1 ]; then
        shift;
        REASON=$@
fi

iptables -A INPUT -s ${IP}/32 -j LOG --log-prefix "${REASON} "
iptables -A INPUT -s ${IP}/32 -j DROP

Leer más...

Show2.bash

d
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
Leer más...

Show.bash

d
Nombre: Show.bash
Autor: @Tonejito
Descripción: Script que te muestra la IP privada
Visto en Tonejito
#!/bin/sh

IP=/bin/ip
SED=/bin/sed
CUT=/usr/bin/cut

IF=en0

if [ ! -z ${1} ]
then
  IF=${1}
fi

$IP addr show dev $IF | $SED -n 3p | $SED -e 's/\ \+/\ /g' -e 's/\/.*$//g' | $CUT -d ' ' -f 3
Permisos: chmod 700 show.bash 
Ejecución: ./show.bash
Leer más...

Dom.bash

d
Nombre: Dom.bash.
Autor: Nixcraft.
Descripción: Script que permite obtener información del Centro de Datos, propietario de la IP, Ciudad y País de un Dominio
Visto en nixCraft
#!/bin/bash
# A sample shell script to print domain ip address hosting information such as
# Location of server, city, ip address owner, country and network range.
# This is useful to track spammers or research purpose.
# -------------------------------------------------------------------------
# Copyright (c) 2006 nixCraft project [http://cyberciti.biz/fb/]
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# Last updated on Mar/05/2010
# -------------------------------------------------------------------------
 
# Get all domains
_dom=$@
 
# Die if no domains are given
[ $# -eq 0 ] && { echo "Usage: $0 domain1.com domain2.com ..."; exit 1; }
for d in $_dom
do
 _ip=$(host $d | grep 'has add' | head -1 | awk '{ print $4}')
 [ "$_ip" == "" ] && { echo "Error: $d is not valid domain or dns error."; continue; }
 echo "Getting information for domain: $d [ $_ip ]..."
 whois "$_ip" | egrep -w 'OrgName:|City:|Country:|OriginAS:|NetRange:'
 echo ""
done
Establecemos permisos de ejecución 
chmod +x dom.bash
Ejecutamos el script pasando como parámetro un dominio o varios
./dom.bash cyberciti.biz google.com
Leer más...

Monitor-Traffic

d
Autor: @Tonejito
http://tonejito.blogspot.com/2011/12/monitoring-my-network-traffic.html
Función: Script que monitorea el tráfico de la red excluyendo las peticiones más comunes.

 #!/bin/bash
TCPDUMP=/usr/sbin/tcpdump
IP=/sbin/ip
DEV=en1
ADDR=`$IP addr show dev $DEV | grep 'inet ' | cut -d ' ' -f 6 | cut -d '/' -f 1`

$TCPDUMP -ni $DEV "host $ADDR and port not (67 or 68 or 80 or 443 or 1863 or 5222 or 587 or 993 or 995)"
Leer más...

Script para buscar direcciones IP en páginas html

d
Autor: @paco_medina
Función: Recibe como parámetro una URL y muestra en pantalla las direcciones IP que contenga.
#!/bin/bash
# Programa que busca direcciones IP en páginas html
# Autor: @paco_medina
if [ $# -lt 1 ]; then
echo "Uso: $0 url"
echo "Ejemplo: $0 www.sitio.com.mx"
exit 1
fi
HTML=/tmp/pagina.html
DOMINIO=`echo $1|cut -d. -f2-5`
wget $1 -O $HTML -o /dev/null
grep "href=" $HTML |grep $DOMINIO |
cut -d/ -f3|grep ${DOMINIO}$|sort -u>/tmp/dir-ip
for i in $(cat /tmp/dir-ip)

do
host $i
done
rm $HTML
Leer más...