From bce776296ba249a9d49474aa2c259dd7df699a79 Mon Sep 17 00:00:00 2001 From: Asim Zeeshan Date: Fri, 29 Jan 2021 19:30:36 +0500 Subject: [PATCH 1/2] Updating calls.php to fix GET statement --- calls.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calls.php b/calls.php index e3f0dbf..2a8d47b 100644 --- a/calls.php +++ b/calls.php @@ -36,7 +36,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } elseif ($_GET['value'] == 'domain') { $idle->viewMoreDomainModal($_GET['id']);//View more details modal } - } elseif ($_GET['type'] == 'dns_search') { + } elseif ($_GET['type'] == 'A' || $_GET['type'] == 'AAAA') { $idle->getIpForDomain($_GET['hostname'], $_GET['type']); } elseif ($_GET['type'] == 'check_up') { echo $idle->checkIsUp($_GET['host']); From a89f624b082a81a7dc4d8deef7c33964a849b40c Mon Sep 17 00:00:00 2001 From: Asim Zeeshan Date: Fri, 29 Jan 2021 19:52:01 +0500 Subject: [PATCH 2/2] Using native dns_get_record() instead of whatsmydns.net --- class.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/class.php b/class.php index 302fb62..c3f191e 100644 --- a/class.php +++ b/class.php @@ -3057,11 +3057,19 @@ class idlers extends helperFunctions public function getIpForDomain(string $domain, string $type = 'A'): string {//Gets IP from A record for a domain - $data = json_decode(file_get_contents("https://whatsmydns.net/api/details?server=428&type=$type&query=$domain"), true); - if (isset($data['data'][0]['response'][0])) { - if (strlen($data['data'][0]['response'][0]) > 6) { - return $data['data'][0]['response'][0]; - } + switch ($type) { + case "A": + $data = dns_get_record($domain, DNS_A); + if (isset($data['0']['ip'])) { + return $data['0']['ip']; + } + break; + case "AAAA": + $data = dns_get_record($domain, DNS_AAAA); + if (isset($data['0']['ipv6'])) { + return $data['0']['ipv6']; + } + break; } return "";//Doesnt exist/null/empty/invalid }