Browse Source

add selected info from ipinfo.io about location and ASN

master
mxmehl 4 years ago
parent
commit
117789d55f
Signed by: mxmehl GPG Key ID: 2704E4AB371E2E92
  1. 10
      index.php

10
index.php

@ -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";

Loading…
Cancel
Save