Created
November 11, 2017 17:48
-
-
Save v4p0r/25935f6f1e4ad9595dc439191705f2e0 to your computer and use it in GitHub Desktop.
Simples IP Location, my first script in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
''' | |
First script in python | |
Simples IP Location | |
Date: 11 NOV 2017 - 15:37 | |
Image: http://prntscr.com/h95k5l | |
Respect: YC - HighTech - EOF Club - Brian - d3m0l1d0r - Cater - Strike - rCent | |
Kodo - CrazyDuck - xin0x - mmxm - CriptonKing - d3z3n0v3 - c0de_universal - All Friends | |
''' | |
import requests | |
import json | |
banner = """ | |
* =/\ /\= * | |
/ \'._ (\_/) _.'/ \ * by v4p0r 2k17 | |
* / .''._'--(o.o)--'_.''. \ | |
/.' _/ |`'=/ " \='`| \_ `.\ * * | |
* /` .' `\;-,'\___/',-;/` '. '\ | |
/.-' jgs `\(-V-)/` `-.\ * * | |
* " " | |
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
# IP Location | |
# Coder: v4p0r | |
# Date: 11 NOV 2017 15:23 | |
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::""" | |
def requisicao(ip): | |
try: | |
req = requests.get('http://ip-api.com/json/' + ip) | |
decode_json = json.loads(req.text) | |
return decode_json | |
except: | |
print ('Erro na conexao') | |
return None | |
def print_detalhes(ip_load): | |
print ('\n[+] IP: ', ip_load['query']) | |
print ('[+] ORG: ', ip_load['org']) | |
print ('[+] ISP: ', ip_load['isp']) | |
print ('[+] AS: ', ip_load['as']) | |
print ('[+] SIGLA PAIS: ', ip_load['countryCode']) | |
print ('[+] PAIS: ', ip_load['country']) | |
print ('[+] SIGLA ESTADO: ', ip_load['region']) | |
print ('[+] ESTADO: ', ip_load['regionName']) | |
print ('[+] CIDADE: ', ip_load['city']) | |
print ('[+] HORA LOCAL: ', ip_load['timezone']) | |
print ('[+] LATITUDE: ', ip_load['lat']) | |
print ('[+] LONGITUDE: ', ip_load['lon'], '\n\n[+] INFORMACOES CONCEDIDAS, ESPERO TER AJUDADO ATE O/') | |
sair = False | |
if not sair: | |
print(banner) | |
op = input('\n[!] Escreva o IP ou SAIR para fechar: ') | |
if op == 'SAIR': | |
sair = True | |
print('[!] Saindo... Espero ter ajudado o/') | |
else: | |
ip_load = requisicao(op) | |
if ip_load['status'] == 'fail': | |
print('[!] IP nao encontrado') | |
else: | |
print_detalhes(ip_load) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment