Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
IPExplorer/main.py at main · wickstudio/IPExplorer · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
wickstudio
IPExplorer
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
IPExplorer
/
main.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
177 lines (153 loc) · 7.08 KB
main
Breadcrumbs
IPExplorer
/
main.py
Copy path
Top
File metadata and controls
Code
Blame
177 lines (153 loc) · 7.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import
os
import
sys
import
socket
import
requests
from
ipwhois
import
IPWhois
import
ssl
import
pyfiglet
from
colorama
import
init
,
Fore
,
Style
import
webbrowser
import
time
import
subprocess
def
disable_ansi_on_windows
():
if
sys
.
platform
.
startswith
(
'win'
):
os
.
system
(
'color'
)
def
print_banner
():
banner
=
pyfiglet
.
figlet_format
(
"WICK TOOL"
,
font
=
"slant"
)
print
(
Fore
.
YELLOW
+
banner
+
Style
.
RESET_ALL
)
print
(
Fore
.
CYAN
+
"Welcome to the IP Information Retrieval Tool"
+
Style
.
RESET_ALL
)
print
()
def
print_contact_info
():
print
(
Fore
.
YELLOW
+
"Contact Information:"
+
Style
.
RESET_ALL
)
print
(
"1. Website: https://wickdev.xyz/"
)
print
(
"2. GitHub: https://github.com/Wickdev077"
)
print
(
"3. Instagram: https://www.instagram.com/mik__subhi/"
)
def
resolve_ip
(
ip_address
):
try
:
host
=
socket
.
gethostbyname
(
ip_address
)
return
host
except
socket
.
gaierror
:
return
None
def
get_geolocation_info
(
ip_address
):
try
:
url
=
f"https://ipinfo.io/
{
ip_address
}
/json"
response
=
requests
.
get
(
url
)
data
=
response
.
json
()
return
data
except
Exception
as
e
:
print
(
Fore
.
RED
+
f"Sorry, there was an error while retrieving geolocation information
{
str
(
e
)
}
"
+
Style
.
RESET_ALL
)
return
None
def
print_colored_info
(
label
,
info
):
print
(
Fore
.
GREEN
+
f"
{
label
}
: "
+
Style
.
RESET_ALL
+
info
)
def
open_google_maps_with_delay
(
latitude
,
longitude
):
print
(
Fore
.
YELLOW
+
"Opening Google Maps..."
+
Style
.
RESET_ALL
)
time
.
sleep
(
3
)
google_maps_url
=
f"https://www.google.com/maps/search/?api=1&query=
{
latitude
}
,
{
longitude
}
"
webbrowser
.
open
(
google_maps_url
)
def
ping_ip
(
ip_address
):
try
:
result
=
subprocess
.
run
([
'ping'
,
'-c'
,
'4'
,
ip_address
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
text
=
True
,
timeout
=
10
)
if
result
.
returncode
==
0
:
print
(
Fore
.
GREEN
+
"
\n
Ping to IP Address:"
+
Style
.
RESET_ALL
)
print
(
result
.
stdout
)
else
:
print
(
Fore
.
RED
+
"
\n
Ping to IP Address (Failed)"
+
Style
.
RESET_ALL
)
print
(
result
.
stderr
)
except
subprocess
.
TimeoutExpired
:
print
(
Fore
.
RED
+
"
\n
Ping to IP Address (Timed out)"
+
Style
.
RESET_ALL
)
except
Exception
as
e
:
print
(
Fore
.
RED
+
f"An error occurred while pinging the IP address:
{
str
(
e
)
}
"
+
Style
.
RESET_ALL
)
def
get_ip_information
(
ip_address
):
resolved_ip
=
resolve_ip
(
ip_address
)
if
resolved_ip
:
print_colored_info
(
"Resolved IP Address"
,
resolved_ip
)
try
:
ip_info
=
IPWhois
(
resolved_ip
).
lookup_rdap
()
print_colored_info
(
"IP Range"
,
ip_info
[
'asn_cidr'
])
print_colored_info
(
"Organization"
,
ip_info
[
'asn_description'
])
print_colored_info
(
"Country"
,
ip_info
[
'asn_country_code'
])
geolocation_info
=
get_geolocation_info
(
resolved_ip
)
if
geolocation_info
:
print
(
Fore
.
BLUE
+
"
\n
Geolocation Information :"
+
Style
.
RESET_ALL
)
print_colored_info
(
"City"
,
geolocation_info
[
'city'
])
print_colored_info
(
"Region"
,
geolocation_info
[
'region'
])
print_colored_info
(
"Country"
,
geolocation_info
[
'country'
])
lat
,
lon
=
geolocation_info
[
'loc'
].
split
(
','
)
print_colored_info
(
"Latitude"
,
lat
)
print_colored_info
(
"Longitude"
,
lon
)
if
'bogon'
in
geolocation_info
.
get
(
'org'
,
''
).
lower
():
print_colored_info
(
"VPN/Proxy Detected"
,
"Yes"
)
else
:
print_colored_info
(
"VPN/Proxy Detected"
,
"No"
)
get_ssl_certificate
(
resolved_ip
)
except
Exception
as
e
:
print
(
Fore
.
RED
+
f"Oops, there was an error while fetching information:
{
str
(
e
)
}
"
+
Style
.
RESET_ALL
)
else
:
print
(
Fore
.
RED
+
f"Sorry, we couldn't resolve the IP address for:
{
ip_address
}
"
+
Style
.
RESET_ALL
)
def
get_ssl_certificate
(
ip_address
):
try
:
context
=
ssl
.
create_default_context
()
with
socket
.
create_connection
((
ip_address
,
443
),
timeout
=
10
)
as
sock
:
with
context
.
wrap_socket
(
sock
,
server_hostname
=
ip_address
)
as
ssl_sock
:
cert
=
ssl_sock
.
getpeercert
()
print
(
Fore
.
BLUE
+
"
\n
SSL Certificate Information:"
+
Style
.
RESET_ALL
)
print_colored_info
(
"Issuer"
,
cert
[
'issuer'
])
print_colored_info
(
"Subject"
,
cert
[
'subject'
])
print_colored_info
(
"Expiration Date"
,
cert
[
'notAfter'
])
except
ssl
.
SSLError
:
print
(
Fore
.
RED
+
f"Unable to retrieve SSL certificate information for
{
ip_address
}
"
+
Style
.
RESET_ALL
)
except
Exception
as
e
:
print
(
Fore
.
RED
+
f"Sorry, there was an issue connecting to
{
ip_address
}
:
{
str
(
e
)
}
"
+
Style
.
RESET_ALL
)
def
get_dns_information
(
ip_address
):
try
:
domain
=
socket
.
gethostbyaddr
(
ip_address
)[
0
]
print_colored_info
(
"DNS Information for"
,
domain
)
a_records
=
socket
.
gethostbyname_ex
(
domain
)
print_colored_info
(
"A Records"
,
', '
.
join
(
a_records
[
2
]))
mx_records
=
[]
try
:
mx_records
=
[
str
(
record
.
exchange
)
for
record
in
dns
.
resolver
.
resolve
(
domain
,
'MX'
)]
except
Exception
:
pass
print_colored_info
(
"MX Records"
,
', '
.
join
(
mx_records
))
txt_records
=
[]
try
:
txt_records
=
[
str
(
record
)
for
record
in
dns
.
resolver
.
resolve
(
domain
,
'TXT'
)]
except
Exception
:
pass
print_colored_info
(
"TXT Records"
,
', '
.
join
(
txt_records
))
ns_records
=
[]
try
:
ns_records
=
[
str
(
record
.
target
)
for
record
in
dns
.
resolver
.
resolve
(
domain
,
'NS'
)]
except
Exception
:
pass
print_colored_info
(
"NS Records"
,
', '
.
join
(
ns_records
))
except
Exception
as
e
:
print
(
Fore
.
RED
+
f"Sorry, there was an error while retrieving DNS information:
{
str
(
e
)
}
"
+
Style
.
RESET_ALL
)
if
__name__
==
"__main__"
:
init
(
autoreset
=
True
)
disable_ansi_on_windows
()
print_banner
()
ip_address
=
input
(
"Please enter an IP Address or Domain: "
)
geolocation_info
=
get_geolocation_info
(
ip_address
)
if
geolocation_info
:
latitude
,
longitude
=
geolocation_info
[
'loc'
].
split
(
','
)
get_ip_information
(
ip_address
)
get_dns_information
(
ip_address
)
ping_ip
(
ip_address
)
if
geolocation_info
:
google_maps_url
=
f"https://www.google.com/maps/search/?api=1&query=
{
latitude
}
,
{
longitude
}
"
webbrowser
.
open
(
google_maps_url
)
print_contact_info
()
while
True
:
choice
=
input
(
"Type a number to open a contact link (1 for Website, 2 for GitHub, 3 for Instagram, or q to quit): "
).
strip
()
if
choice
==
'1'
:
webbrowser
.
open
(
"https://wickdev.xyz/"
)
elif
choice
==
'2'
:
webbrowser
.
open
(
"https://github.com/Wickdev077"
)
elif
choice
==
'3'
:
webbrowser
.
open
(
"https://www.instagram.com/mik__subhi/"
)
elif
choice
.
lower
()
==
'q'
:
break
else
:
print
(
Fore
.
RED
+
"Invalid choice. Please select a valid option."
+
Style
.
RESET_ALL
)
You can’t perform that action at this time.