Need a port Scanner = $$$

Looking to hire a PHP developer for a paid position? Looking for a paid PHP job? Want to post your resume? Let the job hunt begin...

Moderator: General Moderators

Post Reply
shtroumf
Forum Newbie
Posts: 9
Joined: Fri Apr 09, 2004 1:12 am

Need a port Scanner = $$$

Post 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
Whissy
Forum Newbie
Posts: 4
Joined: Thu Apr 08, 2004 10:52 am
Location: UK/ Wales

Post 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 ;)
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post 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.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Can you explain why you want to do this?
shtroumf
Forum Newbie
Posts: 9
Joined: Fri Apr 09, 2004 1:12 am

Post by shtroumf »

I need them for Irc and yes mostly socks proxies
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Post by bla5e »

why do u need a port scanner for IRC?
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Post 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
shtroumf
Forum Newbie
Posts: 9
Joined: Fri Apr 09, 2004 1:12 am

Post by shtroumf »

Thanks a lot
Post Reply