Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed value error in ip address input and keyerror in the output. #31

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/utils.cpython-39.pyc
Binary file not shown.
94 changes: 37 additions & 57 deletions ipdrone.py
Original file line number Diff line number Diff line change
@@ -1,74 +1,54 @@
#coded by N17RO (noob hackers)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#modules required
# NOTE: if you don't know your public ip use the publicIP.py script

# coded by N17RO (noob hackers)

# modules required
import argparse
import requests, json
import sys
from sys import argv
import os
import ipaddress

#arguments and parser
from utils import *

# arguments and parser
parser = argparse.ArgumentParser()

parser.add_argument ("-v", help= "target/host IP address", type=str, dest='target', required=True )

args = parser.parse_args()

#colours used
red = '\033[31m'
yellow = '\033[93m'
lgreen = '\033[92m'
clear = '\033[0m'
bold = '\033[01m'
cyan = '\033[96m'

#banner of script
print (red+"""

██╗██████╗ ██████╗ ██████╗ ██████╗ ███╗ ██╗███████╗
██║██╔══██╗██╔══██╗██╔══██╗██╔═══██╗████╗ ██║██╔════╝
██║██████╔╝██║ ██║██████╔╝██║ ██║██╔██╗ ██║█████╗
██║██╔═══╝ ██║ ██║██╔══██╗██║ ██║██║╚██╗██║██╔══╝
██║██║ ██████╔╝██║ ██║╚██████╔╝██║ ╚████║███████╗
╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
v 1.0
"""+red)
print (lgreen+bold+" <===[[ coded by N17RO ]]===> \n"+clear)
print (yellow+bold+" <---(( search on youtube Noob Hackers ))--> \n"+clear)
ip = args.target


ip = args.target
# banner
printBanner()

api = "http://ip-api.com/json/"
if ipaddress.ip_address(ip).is_private:
print(RED + "[-] Private IP Address can not be tracked, provide the Public IP Address")
exit()

try:
data = requests.get(api+ip).json()
sys.stdout.flush()
a = lgreen+bold+"[$]"
b = cyan+bold+"[$]"
print (a, "[Victim]:", data['query'])
print(red+"<--------------->"+red)
print (b, "[ISP]:", data['isp'])
print(red+"<--------------->"+red)
print (a, "[Organisation]:", data['org'])
print(red+"<--------------->"+red)
print (b, "[City]:", data['city'])
print(red+"<--------------->"+red)
print (a, "[Region]:", data['region'])
print(red+"<--------------->"+red)
print (b, "[Longitude]:", data['lon'])
print(red+"<--------------->"+red)
print (a, "[Latitude]:", data['lat'])
print(red+"<--------------->"+red)
print (b, "[Time zone]:", data['timezone'])
print(red+"<--------------->"+red)
print (a, "[Zip code]:", data['zip'])
print (" "+yellow)
data = requests.get(API+ip).json()
flush()

printA("[Victim]:", data['query'])
printB("[ISP]:", data['isp'])
printA("[Organisation]:", data['org'])
printB("[City]:", data['city'])
printA("[Region]:", data['region'])
printB("[Longitude]:", data['lon'])
printA("[Latitude]:", data['lat'])
printB("[Time zone]:", data['timezone'])
printA("[Zip code]:", data['zip'])

except KeyboardInterrupt:
print ('Terminating, Bye'+lgreen)
sys.exit(0)
print(LGREEN + 'Terminating, Bye')

except requests.exceptions.ConnectionError as e:
print (red+"[~]"+" check your internet connection!"+clear)
sys.exit(1)
print(RED + "[~] check your internet connection!" + CLEAR)

except ValueError:
print(RED + "[!] The Given IP Address does not seem to be valid")

print(WHITE)

16 changes: 16 additions & 0 deletions publicIP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
In case if you want to know your public IP address use this script
usage: python publicIP.py
or: python3 publicIP.py
"""

import requests, json

API = "https://api.ipify.org/?format=json"

IP = requests.get(API).json()['ip']

print("[+] Your public IP Address is:", IP)
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
requests
ipaddress
46 changes: 46 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# utilities for ipdrone.py (helper functions and constants)

import sys

# URL of the API
API = "http://ip-api.com/json/"

# colors
RED = '\033[31m'
YELLOW = '\033[93m'
LGREEN = '\033[92m'
CLEAR = '\033[0m'
BOLD = '\033[01m'
CYAN = '\033[96m'
WHITE = "\u001b[37m"

# banner
def printBanner():
print(f"""
{RED}
██╗██████╗ ██████╗ ██████╗ ██████╗ ███╗ ██╗███████╗
██║██╔══██╗██╔══██╗██╔══██╗██╔═══██╗████╗ ██║██╔════╝
██║██████╔╝██║ ██║██████╔╝██║ ██║██╔██╗ ██║█████╗
██║██╔═══╝ ██║ ██║██╔══██╗██║ ██║██║╚██╗██║██╔══╝
██║██║ ██████╔╝██║ ██║╚██████╔╝██║ ╚████║███████╗
╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
v 1.0
{RED}
{LGREEN+BOLD}
<===[[ coded by N17RO ]]===>
{CLEAR}
{YELLOW+BOLD}
<---(( search on youtube Noob Hackers ))-->
{CLEAR}
""")

def printA(*text):
print(LGREEN + BOLD+ "[$]", *text)
print(RED + "<--------------->" + RED)

def printB(*text):
print(CYAN + BOLD + "[$]", *text)
print(RED + "<--------------->" + RED)

def flush():
sys.stdout.flush()