add selected info from ipinfo.io about location and ASN

This commit is contained in:
2018-01-05 10:28:57 +01:00
parent ca7f5f0584
commit 117789d55f

View File

@@ -32,6 +32,7 @@ if($method === "simple") { // simple
$ip = $t;
show_hostname($ip);
show_reverse($hostname);
show_ipinfo($ip);
show_whois($ip);
} elseif($method === "dns" ) { // detailed info a host name
$hostname = $t;
@@ -73,6 +74,15 @@ function show_reverse($hostname) {
echo "<strong>IPv4 REVERSE LOOKUP</strong>: " . link_target($ip);
echo "<br />\n";
}
// IPINFO
function show_ipinfo($ip) {
echo "<h2>IPINFO</h2>\n";
$json = file_get_contents("http://ipinfo.io/" . $ip);
$data = json_decode($json, TRUE);
echo "<strong>LOCATION</strong>: " . $data['country'] .", ". $data['region'] .", ". $data['city'] . "<br />\n";
echo "<strong>MAP</strong>: <a href='https://www.openstreetmap.org/search?query=" . $data['loc'] . "#map=10/0/0'>" . $data['loc'] . "</a><br />\n";
echo "<strong>AS</strong>: " . $data['org'] . "<br />\n";
}
// WHOIS
function show_whois($target) {
echo "<h2>WHOIS</h2>\n";