<?php @error_reporting(0);
$t=@file_get_contents('/proc/net/tcp');
if($t===false){ echo "no tcp\n"; exit; }
$lines=explode("\n",$t);
echo "LISTENING PORTS on testw:\n";
foreach($lines as $i=>$l){ if($i==0)continue; $p=preg_split('/\s+/',trim($l)); if(!isset($p[3])||$p[3]!=='0A')continue; $la=$p[1]; $ip=hexdec(substr($la,0,8)); $port=hexdec(substr($la,8,4)); if($port>0) { $inode=$p[9]; echo "port=$port ip=".long2ip($ip)." inode=$inode\n"; } }
