-
Notifications
You must be signed in to change notification settings - Fork 0
/
PInfo.py
111 lines (99 loc) · 3.39 KB
/
PInfo.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import ipinfo
import dns.resolver
import requests
import rich
from rich.console import Console
from rich import print
mine = '0.4.0'
def hinfo():
print("[bold blue] Coming Soon!!!![/bold blue]")
def dinfo(): # Defines the dns command
url = Console().input(
"[blue]Enter a Domain[/blue] :warning:[bold red1](Do not use WWW)[/bold red1]:warning: [blue]"
)
for a in dns.resolver.resolve(url, "a"):
Console().print(
"[red3] A Record :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: [/]",
a,
)
for mx in dns.resolver.resolve(url, "mx"):
Console().print(
"[red3] MX Record :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: [/]",
mx,
)
for ns in dns.resolver.resolve(url, "ns"):
Console().print(
"[red3] NS Record :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: [/]",
ns,
)
def ipi(): # Defines ip info command
keys_file = open("keys.txt")
read = keys_file.readlines()
access_token = read[0].rstrip()
handler = ipinfo.getHandler(access_token)
ip_address = Console().input("[bold blue]Enter an IP: [/bold blue]")
details = handler.getDetails(ip_address)
ip = details.ip
city = details.city
region = details.region
country = details.country_name
try:
hn = details.hostname
org = details.org
except AttributeError:
hn = "No Hostname found for requested IP "
org = "No Organization found for requested IP"
Console().print("[red3] INFO FOR [/red3]", ip)
Console().print(
"[red3] Location :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: [/red3] ",
city +
"," +
region +
country)
Console().print(
"[red3] Hostname :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: [/red3] ",
hn)
Console().print(
"[red3] Organization :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: [/red3] ",
org)
Console().print(
"[red3] Ping :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: [/red3] ")
def main():
while True:
Version = requests.get(
'https://vault108.github.io/PInfo/about.json').json()["Version"]
rdate = requests.get(
'https://vault108.github.io/PInfo/about.json').json()["Date"]
if Version == mine:
Console().print("[cyan1] \n You have the latest version [/cyan1]")
if Version > mine:
print(
"Version",
mine +
" is outdated. Version " +
Version +
" was released " +
rdate)
if Version < mine:
print("Do you have a time machine?")
print("\n[royal_blue1]Choose service you want to use : [/royal_blue1] ")
print("[royal_blue1]"
"""
1 : Check an IP
2 : Check a URL
3 : Check DNS
0 : Exit"""
"[/royal_blue1]"
)
choice = Console().input(
"\n[royal_blue1]Enter your choice : [/royal_blue1]")
if choice == "1":
ipi()
elif choice == "2":
hinfo()
elif choice == "3":
dinfo()
elif choice == "0":
exit()
if __name__ == "__main__":
main()