Lmao ty, i was actually looking for a script of this.
|
This will add a little form to your site.
Just fill in the domain field and click 'Check' and it will output the IP of the site.
Might be useless, but because of making this I weren't bored any more
[PHP]<?php
if ($_POST['sub_address'] && $_POST['address'])
{
$ip_address = gethostbyname($_POST['address']);
if ($ip_address == $_POST['address'])
echo "Invalid domain or the IP couldn't be found.";
else
echo "<b>" . $_POST['address'] . "</b>'s IP is: " . $ip_address;
}
echo "<hr>
<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">
<b>Domain:</b><br />
<input type=\"text\" name=\"address\"><br />
<input type=\"submit\" name=\"sub_address\" value=\"Check\">
</form>
";
?> [/PHP]
Lmao ty, i was actually looking for a script of this.
You're welcome mate
[PHP]<?php
if(isset($_POST['sub_address']) && isset($_POST['address'])){
$ip_address = gethostbyname($_POST['address']);
if($ip_address == $_POST['address']){
echo 'Invalid domain or the IP couldn\'t be found.';
} else {
echo '<b>'.$_POST['address'].'</b>'s IP is: '.$ip_address;
}
} else {
echo '<hr>
<form method="post" action="'.$_SERVER['PHP_SELF'].'">
<b>Domain:</b><br />
<input type="text" name="address"><br />
<input type="submit" name="sub_address" value="Check">
</form>';
}
?>[/PHP]
Due to recent changes in PHP (5.2.5), you can no longer say "if($variable)" -- you have to specify what exactly you want from $variable... so you have to instead do "if(isset($variable))".
Also, if you ever have strictly double quotes in an echo, you should use single quotes for the echo starters.
echo ' " " '; is a lot neater than echo ' \' \' '; ... They both work but it's just a lot nicer.
Also, the only complication with gethostbyname() is that when you check something invalid, such as "asfawafsdfzdz.awefadfzdf", it'll return localhost, so then your script returns the webserver's IP.
~Z
If it's working, I'm happy.
Vulnerability: Cross-Site Scripting Vulnerability
Discoverer: super_
Danger Level: 2/5
Exploit: Script uses $_SERVER['PHP_SELF'], which, due to its nature, returns scriptname and any other data after it. E.g.
if URL was http://site/dir/file.php/lol, then PHP_SELF would be:
file.php/lol
Usage: /getip.php/"><script>alert("XSS")</script>
Vulnerable code:
[php]echo "<hr>
<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">
<b>Domain:</b><br />
<input type=\"text\" name=\"address\"><br />
<input type=\"submit\" name=\"sub_address\" value=\"Check\">
</form>
"; [/php]
Solution: Use $_SERVER['SCRIPT_NAME'] instead.
Greetz to J33bles, Nmopal, ******, System79, PeeHPee, and T_X
OR YOU COULD JUST DO THIS:
start > run > type in: cmd and click ok
Then type:
ping domain.com
it replys with an ip and there you go, a non idiotic way to do it.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |