checkip
Publicado por Percio Andrade Castelo Branco (última atualização em 27/05/2015)
[ Hits: 2.807 ]
Homepage: null
Busca informações de um IP ou IP de um domínio.
Exemplos:
$ checkip IP
Information for 189.34.1.229
ip: 189.34.1.229
hostname: bd2201e5.virtua.com.br
city: Florianópolis
region: Santa Catarina
country: BR
loc: https://google.com.br/maps?q=-27.5833-48.5667
org: AS28573 NET Serviços de Comunicação S.A.
end: Baía Norte, Brazil
$ checkip mercadolivre.com.br
Information for mercadolivre.com.br
ip: 216.33.196.59
hostname: No Hostname
city: Buenos Aires
region: Distrito Federal
country: AR
loc: https://google.com.br/maps?q=-34.6033-58.3816
org: AS53387 MercadoLibre Inc.
end: Avenida Corrientes 1031-1069, Buenos Aires, Ciudad Autónoma de Buenos Aires, Argentina
$ checkip -i
ip: XXXX
hostname: XXXXX
city: São Paulo
region: Sao Paulo
country: BR
loc: https://google.com.br/maps?q=-23.5475-46.6361
org: AS61440 Digital Energy Technologies Chile SpA
end: Praça do Patriarca, 2-82 - Sé, São Paulo - SP, 01002-010, Brazil
#!/bin/bash
# Author: Percio Andrade
# Desc: Simple script to curl IP info
# Version: 1.0
# RECEIVE IP NUMBER
# 1.1
# SED CORRECTION AND GOOGLE URL CORRECTION
# 1.2
# GOOGLE JSON TO GET CEP AND ANDRESS
# CHECK IF CURL EXIST
if [[ ! -f "/usr/bin/curl" ]] || [[ ! -f "/usr/bin/dig" ]];then
echo -e "\nInstalling dependencies\n"
yum -y install curl dig
clear
fi
IP=$1
# CHECK VALUES
if [[ -z ${IP} ]];then
echo -e "Please enter IP or domain to check"
exit
elif [[ $IP == "-i" ]];then
GET=$(curl -s ipinfo.io/`hostname -i`|egrep -v "{|}"|sed -e 's/"//g;s/,//g;s/^[ \t]*//;s/[ \t]*$//'|sed -e "s/loc:/loc: https:\/\/google.com.br\/maps?q=/g"|sed 's/= -/=-/g') && GETMAP=$(echo $GET|grep =-|cut -d- -f2,3,4,5)
INVOKEMAP=$(curl -s -H "Content-Type: application/json" --data @body.json http://maps.google.com/maps/api/geocode/json?address=-$GETMAP|grep formatted_address|head -1|awk -F: '{print $2}'|cut -d '"' -f2)
echo -e "$GET\nend: $INVOKEMAP"
exit
fi
# CALL CURL ON IPINFO
CHECKIP(){
GET=$(curl -s ipinfo.io/${IP}|egrep -v "{|}"|sed -e 's/"//g;s/,//g;s/^[ \t]*//;s/[ \t]*$//'|sed -e "s/loc:/loc: https:\/\/google.com.br\/maps?q=/g"|sed 's/= -/=-/g') && GETMAP=$(echo $GET|grep =-|cut -d- -f2,3,4,5)
INVOKEMAP=$(curl -s -H "Content-Type: application/json" --data @body.json http://maps.google.com/maps/api/geocode/json?address=-$GETMAP|grep formatted_address|head -1|awk -F: '{print $2}'|cut -d '"' -f2)
echo -e "$GET\nend: $INVOKEMAP"
}
REQUEST=$(echo "$IP"|awk '$0 ~/[^0-9.]/ { print "NOT_NUMBER" }')
#echo "Request Id: $IP"
#echo "TEST :::$REQUEST"
echo -e "\nInformation for $IP\n"
# CHECK IF RETURN IS IP OR DOMAIN
if [[ "$IP" != "" ]] && [[ "$REQUEST" != "NOT_NUMBER" ]]; then
#IF OK INVOKE CHECKIP FUNCTION
CHECKIP
else
#IF NOT CURL AND DIG A FOR DOMAIN
GET=$(curl -s ipinfo.io/`dig +short A $IP|head -1`|egrep -v "{|}"|sed -e 's/"//g;s/,//g;s/^[ \t]*//;s/[ \t]*$//'|sed -e "s/loc:/loc: https:\/\/google.com.br\/maps?q=/g"|sed 's/= -/=-/g') && GETMAP=$(echo $GET|grep =-|cut -d- -f2,3,4,5)
INVOKEMAP=$(curl -s -H "Content-Type: application/json" --data @body.json http://maps.google.com/maps/api/geocode/json?address=-$GETMAP|grep formatted_address|head -1|awk -F: '{print $2}'|cut -d '"' -f2)
echo -e "$GET\nend: $INVOKEMAP"
fi
Atualizando páginas automaticamente com Lynx
diMail - envia e-mail com um front do dialog
Script para adicionar usuarios ftp
Nenhum comentário foi encontrado.
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Como impedir exclusão de arquivos por outros usuários no (Linux)
Cirurgia no Linux Mint em HD Externo via USB
Anúncio do meu script de Pós-Instalação do Ubuntu
Formas seguras de instalar Debian Sid (2)
Duas Pasta Pessoal Aparecendo no Ubuntu 24.04.3 LTS (12)
Alguém pode me indicar um designer freelancer? [RESOLVIDO] (5)
Alguém executou um rm e quase mata a Pixar! (3)
Por que passar nas disciplinas da faculdade é ruim e ser reprovado é b... (6)









