75 lines
3.3 KiB
PHP
75 lines
3.3 KiB
PHP
<section class="diZContainer diZmxAuto">
|
|
<h2 class="diZBorderBottom">Ultimate Domain & IP Lookup Tool</h2>
|
|
<p class="diZmb20">This tool allows you to perform a comprehensive lookup of domain names or IP addresses, providing detailed WHOIS information.</p>
|
|
<form method="post" class="diZToolsSection diZmt4 diZmb4 diZBorderRadius diZPadding5px ">
|
|
<div class="diZFlexRowCol diZJustifyCenter diZItemsCenter ">
|
|
<input class="diZmr2 diZw70" placeholder="Domain" name="domain" type="text" />
|
|
<p class="diZmr2">OR</p>
|
|
<input class="diZmr2 diZw70" placeholder="IP Address" name="ip" type="text" />
|
|
<button type="submit"><span>Check</span></button>
|
|
</div>
|
|
</form>
|
|
<?php
|
|
if(isset($_POST['domain']) && $_POST['domain']){
|
|
function validateDomain($domain) {
|
|
$regex = "/^(?!\-)(?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]\.)+[a-zA-Z]{2,}$/";
|
|
if (preg_match($regex, $domain)) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
$domain = isset($_POST['domain']) ? $_POST['domain'] : '';
|
|
if ($domain && validateDomain($domain)) {
|
|
$command = 'whois '.$_POST['domain'];
|
|
$escaped_command = escapeshellcmd($command);
|
|
$output = shell_exec($escaped_command);
|
|
echo '<div class="diZContainer diZmxAuto diZPadding5px"><pre class="diZTextJustify" style="width: fit-content;"> ',$output, '</pre> <br><br></div>';
|
|
} else {
|
|
echo "Invalid domain.";
|
|
}
|
|
}
|
|
if(isset($_POST['ip']) && $_POST['ip']){
|
|
function validatePublicIp($ip) {
|
|
if (filter_var($ip, FILTER_VALIDATE_IP)) {
|
|
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
$ip = isset($_POST['ip']) ? $_POST['ip'] : '';
|
|
if ($ip && validatePublicIp($ip)) {
|
|
$command = 'whois '.$_POST['ip'];
|
|
$escaped_command = escapeshellcmd($command);
|
|
$output = shell_exec($escaped_command);
|
|
echo '<div class="diZContainer diZmxAuto diZPadding5px"><pre> ',$output, '</pre> <br><br></div>';
|
|
} else {
|
|
echo "Invalid IP address.";
|
|
}
|
|
}
|
|
?>
|
|
<div>
|
|
<h3>Usage:</h3>
|
|
<ul>
|
|
<li>Enter a domain name or an IP address into the respective input field.</li>
|
|
<li>Click the "Check" button to retrieve WHOIS information.</li>
|
|
</ul>
|
|
|
|
<h3>Features:</h3>
|
|
<ul>
|
|
<li>Supports lookup for both domain names and IP addresses.</li>
|
|
<li>Displays WHOIS data including registration details and administrative contacts.</li>
|
|
<li>Secure input validation to ensure accurate results.</li>
|
|
</ul>
|
|
|
|
<h3>Example Use Cases:</h3>
|
|
<ul>
|
|
<li>Investigate ownership and registration details of a domain.</li>
|
|
<li>Check the WHOIS information of an IP address for network troubleshooting.</li>
|
|
<li>Verify domain availability and registration status.</li>
|
|
</ul>
|
|
</div>
|
|
</section>
|