Page 1 of 1

Need a port Scanner = $$$

Posted: Fri Apr 09, 2004 1:14 am
by shtroumf
Hi,

im looking for someone that can design me a good port scanner that can scan for uncommuns ports

it's is possible to scan behind a proxies with a cgi or php script ?

email: shtroumf@hotmail.com
icq: 229638655

thank you

John

Posted: Fri Apr 09, 2004 3:45 am
by Whissy
I doubt it unless you put the script behind the proxy.
Also your intentions don't sound too good.
Unless you are doing it for "security" reasons obviously ;)

Posted: Fri Apr 09, 2004 10:15 am
by Roja
It depends entirely on what the "proxy" is, and what it does, and how it allows it.

If its a pass-thru, inline socks proxy, then sure.

If its a webproxy, and there is no firewall, then again, sure, because you can just go right past it.

If its a webproxy, and there IS a firewall (ie, the webproxy is the only way out), then NO, because that only gives you port 80, period.

Lack of information - please be more specific.

Posted: Fri Apr 09, 2004 1:38 pm
by McGruff
Can you explain why you want to do this?

Posted: Sat Apr 10, 2004 10:07 pm
by shtroumf
I need them for Irc and yes mostly socks proxies

Posted: Wed Jun 09, 2004 12:04 pm
by bla5e
why do u need a port scanner for IRC?

Posted: Wed Jun 09, 2004 12:08 pm
by bla5e

Code: Select all

<?php
	class phports {

	var $ports;
	var $addr;
	var $sockets;

	function phports() {
		for($i=1;$i<1025;$i++) $this->ports[]=$i;
		$this->addr=$_SERVER['REMOTE_ADDR'];
		$this->sockets=$this->sockets_enabled();
		if(!$this->sockets) 
		  echo "<p class="error">sockets are not enabled on this server</p>";
	}

	function run()  {
		echo "<div id="scan">\n";
		$this->tcp_scan();
		$this->udp_scan();
		echo "<p class="name">php port scan</p>\n";
		echo "</div>";
	}

	function sockets_enabled() {
		ob_start();
		phpinfo(1); 
		$php_info = ob_get_contents();
		ob_end_clean();

		if (!strstr($php_info,"--enable-sockets")) return false;
		return true; 
	}

	function set_ports($ports) {
		$this->ports=$ports;
	}

	function set_addr($addr) {
		$this->addr=$addr;
	}


	function tcp_scan($addr=null,$ports=null) {
		if(!$this->sockets) return false; 
		if(!is_array($ports)) $ports=$this->ports;
		if(null==$addr) $addr=$this->addr;

		echo "<p class="title">tcp scan: $addr</p>\n";
		for($i=0;$i<count($ports);$i++) {
			$socket = fsockopen($addr,$ports[$i]);
			if($socket) {
				echo "<p class="port">open: $ports[$i]</p>\n";
 				socket_set_timeout ($socket, 3);
				fclose($socket);
			}
		}
	}

	function udp_scan($addr=null,$ports=null) {
		if(!$this->sockets) return false; 
		if(!is_array($ports)) $ports=$this->ports;
		if(null==$addr) $addr=$this->addr;

		echo "<p class="title">udp scan: $addr</p>\n";
			for($i=0;$i<count($ports);$i++) { 
				$fp = fsockopen("udp://".$addr, $ports[$i], $errno, $errstr);
				if (!$fp) {
   					echo "ERROR: $errno - $errstr<br />\n";
				} 
				else {
 					socket_set_timeout ($fp, 3);
   					$write = fwrite($fp, "\x00");

					$startTime = time();
					$header = fread($fp, 1);
					$endTime = time();

					$timeDiff = $endTime - $startTime;  

					if ($timeDiff >= 3) {
						echo "<p class="port">open: $ports[$i]</p>\n";
					} 
   					fclose($fp);
				}
		}
	}
}
	$scanner=new phports();
	$scanner->run();
?>
there try that

Posted: Wed Jun 09, 2004 2:33 pm
by shtroumf
Thanks a lot