-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgods-eye.py
91 lines (64 loc) · 2.05 KB
/
gods-eye.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
from urllib.request import urlopen as open
import json
import pyttsx3
import re
import webbrowser
from pyfiglet import Figlet
print(Figlet().renderText('Gods - eye'))
print(" -by dellano samuel fernandez")
engine = pyttsx3.init()
def goto2():
global ip
ip = input("Enter ip address : ")
exit() if ip.lower() == 'exit' else check(ip)
def speak(audio):
engine.say(audio)
engine.runAndWait()
regex = '''^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(
25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$'''
def check(Ip):
if(Ip.startswith('192')):
print("I think its a private ip address")
speak('Invalid ip address,sir')
goto2()
elif(re.search(regex, Ip)):
print("Valid Ip address found")
speak("locating sir")
goto1()
else:
print("Invalid ip address")
speak("Invalid ip address,sir")
goto2()
def goto1():
url = "http://ip-api.com/json/"
response = open(url + ip)
data = response.read()
values = json.loads(data)
status = values['status']
success = "success"
lat = str(values['lat'])
lon = str(values['lon'])
a = lat + ","
b = lon + "/" + "data=!3m1!1e3?hl=en"
location = a + b
maps = "https://www.google.com/maps/search/"
webbrowser.open(maps + location)
print(" IP: " + values['query'])
print(" Status: " + values['status'])
print(" city: " + values['city'])
print(" ISP: " + values['isp'])
print(" latitude: " + lat)
print(" longitude: " + lon)
print(" country: " + values['country'])
print(" region: " + values['regionName'])
print(" city: " + values['city'])
print(" zip: " + values['zip'])
print(" AS: " + values['as'])
if status == success:
speak("sucessfully located")
else:
speak("cannot find the location,sir")
goto2()
goto2()