| View previous topic :: View next topic |
| Author |
Message |
nwongfeiying Grandmaster Cheater
Reputation: 2
Joined: 25 Jun 2007 Posts: 695
|
Posted: Thu Jul 02, 2009 12:34 am Post subject: [PHP] Sockets |
|
|
| Code: | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Port Scanner</title>
</head>
<body>
<?php
$domain = $_GET["domain"];
$MIN = 0;
$MAX = 500;
$host = gethostbyname($domain);
$socket = socket_create(AF_INET, SOCK_STREAM, 0);
for($n = $MIN; $n <= $MAX; $n++)
{
$result = @socket_connect($socket, $host, $n);
if($result)
{
$port = getservbyport($n, "tcp");
printf("Port $n ($port) is open. <br />");
$socket = socket_create(AF_INET, SOCKET_STREAM, 0);
}
sleep(100);
}
socket_close($socket);
?>
</body>
</html>
|
I'm doing nothing wrong so why doesn't it work? It works if I use a small range, but doesn't work if I give it a big range. For example, if I use 8060 - 8090 it works, but if I use 1 - 9000, it doesn't work.
|
|
| Back to top |
|
 |
Yuri Advanced Cheater
Reputation: 0
Joined: 09 Dec 2008 Posts: 75 Location: /d/
|
Posted: Thu Jul 02, 2009 12:39 am Post subject: |
|
|
| you suck.
|
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 60
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Thu Jul 02, 2009 12:46 am Post subject: Re: [PHP] Sockets |
|
|
| nwongfeiying wrote: | | I'm doing nothing wrong so why doesn't it work? It works if I use a small range, but doesn't work if I give it a big range. For example, if I use 8060 - 8090 it works, but if I use 1 - 9000, it doesn't work. | Maybe you are getting a timeout, because you set a maximum script runtime.
Also, make a check if $_GET['DOMAIN'] is set: isset($_GET['DOMAIN']
|
|
| Back to top |
|
 |
LolSalad Grandmaster Cheater
Reputation: 1
Joined: 26 Aug 2007 Posts: 988 Location: Australia
|
Posted: Thu Jul 02, 2009 12:51 am Post subject: Re: [PHP] Sockets |
|
|
| Holly wrote: | | Maybe you are getting a timeout, because you set a maximum script runtime. |
This is probably correct; try set_time_limit(0).
_________________
|
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 60
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Thu Jul 02, 2009 12:59 am Post subject: Re: [PHP] Sockets |
|
|
| Wahoa wrote: | | Holly wrote: | | Maybe you are getting a timeout, because you set a maximum script runtime. |
This is probably correct; try set_time_limit(0). |
Or set it to 0 in php.ini
|
|
| Back to top |
|
 |
Localhost I post too much
Reputation: 0
Joined: 28 Apr 2007 Posts: 3402
|
Posted: Thu Jul 02, 2009 11:40 am Post subject: |
|
|
or maybe your server doesn't support flooding?
_________________
|
|
| Back to top |
|
 |
|