forked from baraalmasri/IP-Locator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathip-locator.pl
90 lines (72 loc) · 2.94 KB
/
ip-locator.pl
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
#!/usr/bin/perl
# Ip Geolocation
#By : Technux0
use Socket;
use Term::ANSIColor;
use WWW::Mechanize;
use JSON;
print color 'bold bright_green';
print q{
_____ _____ ____ _ _ _ _ _ ___ _____
|_ _| ____/ ___| | | | \ | | | | \ \/ / _ \
| | | _|| | | |_| | \| | | | |\ / | | |
| | | |__| |___| _ | |\ | |_| |/ \ |_| |
|_| |_____\____|_| |_|_| \_|\___//_/\_\___/
Ip Geolocation Tool
By : Technux0
------------------------------------
[FOLLOW US ON YOUTUBE] :. https://youtube.com/technux0
------------------------------------
};
print color 'bold bright_green';
@iphost=$ARGV[0] || die "Usage : ./ip-locator.pl [Targets IP] \n ./ip-locator.pl [domain] \n ./ip-locator.pl [host] \n \n";
my @ip = inet_ntoa(scalar gethostbyname("@iphost")or die "IP or Host invalid!\n");
my @hn = scalar gethostbyaddr(inet_aton(@ip),AF_INET);
my $GET=WWW::Mechanize->new();
$GET->get("http://ip-api.com/json/@ip"); # JSON API OF IP-API.COM
my $json = $GET->content();
my $info = decode_json($json);
# Json API Response :
# A successful request will return, by default, the following:
#{
# "status": "success",
# "country": "COUNTRY",
# "countryCode": "COUNTRY CODE",
# "region": "REGION CODE",
# "regionName": "REGION NAME",
# "city": "CITY",
# "zip": "ZIP CODE",
# "lat": LATITUDE,
# "lon": LONGITUDE,
# "timezone": "TIME ZONE",
# "isp": "ISP NAME",
# "org": "ORGANIZATION NAME",
# "as": "AS NUMBER / NAME",
# "query": "IP ADDRESS USED FOR QUERY"
# }
# INFOS OF JSON API ...
print color 'bold bright_white';
print " [!] IP: ", $info->{'query'}, "\n";
print color 'bold bright_red';
print "-----------------------------------------\n";
print color 'bold bright_green';
print " [+] ORG: ", $info->{'as'}, "\n";
print " [+] ISP: ", $info->{'isp'}, "\n";
print " [+] Country: ", $info->{'country'}," - ", $info->{'countryCode'}, "\n";
print " [+] Region: ", $info->{'regionName'}, " - " , $info->{'region'}, "\n";
print " [+] City: ", $info->{'city'}, "\n";
print color 'red';
print q{ [!] Location: Might not be accurate
}; "\n";
print color 'bold bright_blue';
print " [+] Geo: ", "Latitude: " , $info->{'lat'}, " - Longitude: ", $info->{'lon'}, "\n";
print " [+] Geolocation: ", "Lat: " , $info->{'lat'}, " - Lat: ", $info->{'lat'}, "\n";
print color 'bold bright_green';
print " [+] Timezone: ", "timezone: " , $info->{'timezone'}, " - Long: ", $info->{'timezone'}, "\n";
print " [+] As number/name: ", "as: " , $info->{'as'}, " - Long: ", $info->{'as'}, "\n";
print " [+] ORG name: ", $info->{'as'}, "\n";
print " [+] Country code: ", $info->{'countryCode'}, "\n";
print color 'bold bright_red';
print " [+] Status: ", $info->{'status'}, "\n";
print "\n";
# EOF