Created
October 13, 2014 07:23
-
-
Save anhldbk/a0518b42d48a195ed708 to your computer and use it in GitHub Desktop.
Get public IP with Python & Requests
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
import requests | |
r = requests.get(r'http://jsonip.com') | |
ip= r.json()['ip'] | |
print 'Your IP is', ip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ainda não está online, mas pretendo fazê-lo:+1:
import os
Solicita o endereço IP de destino ao usuário
adres = input("Insira o endereço IP de destino: ")
Exibe um menu interativo para que o usuário escolha quais opções utilizar
print("Escolha as opções para a varredura:")
print("1 - -v (verbose)")
print("2 - -A (OS detection, version detection and script scanning)")
print("3 - -sS (TCP SYN scan)")
print("4 - -O (OS detection)")
print("5 - Todas as opções acima")
print("6 - Nenhuma opção adicional")
selected_options = []
while True:
option = input("Opção selecionada (ou 'done' para finalizar): ")
if option == 'done':
break
elif option.isdigit() and int(option) in range(1, 7):
selected_options.append(option)
else:
print("Opção inválida.")
Monta o comando nmap com as opções selecionadas
nmap_cmd = "sudo nmap "
if '1' in selected_options:
nmap_cmd += "-v "
if '2' in selected_options:
nmap_cmd += "-A "
if '3' in selected_options:
nmap_cmd += "-sS "
if '4' in selected_options:
nmap_cmd += "-O "
if '5' in selected_options:
nmap_cmd += "-v -A -sS -O "
if not selected_options or '6' in selected_options:
nmap_cmd += "-sP "
nmap_cmd += adres
Executa o comando nmap
response = os.system(nmap_cmd)
Exibe o resultado da varredura
print(f"\nResultado da varredura em {adres}:")
print(response)