| Server IP : 23.94.149.180 / Your IP : 216.73.216.147 Web Server : nginx/1.20.1 System : Linux deadrock 5.14.0-741.22.1.el9_9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 12 15:18:14 UTC 2026 x86_64 User : nginx ( 991) PHP Version : 8.6.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /files/www/hacklab/phpfwgen/ |
Upload File : |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
<HTML>
<HEAD>
<TITLE>Open Ports</TITLE>
<?php
#############################################################################
#
# $Id: openports.php3,v 1.5 2000/04/12 06:48:44 delson Exp $
#
# List of Open TCP/UDP ports, for reference.
#
# (C) Del under the GPL.
#
#############################################################################
require ('config.inc');
require ('files.inc');
$services = read_services();
require ('utility.inc');
require ('javascript.inc');
?>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<TABLE WIDTH="99%" BORDER=0 BGCOLOR="#EEEEEE" CELLSPACING=2 CELLPADDING=4>
<TR ALIGN=LEFT VALIGN=TOP>
<TD BGCOLOR=#339933><FONT SIZE=+1 COLOR=WHITE><B>Open Ports</B></FONT></TD>
</TR>
<TR ALIGN=LEFT VALIGN=TOP>
<TD>
<A HREF="javascript:showHelp('help-openports.html');"><IMG SRC="help.gif" ALT="Help" ALIGN=RIGHT BORDER=0></A>
The open ports table is for reference only. It lists the currently
open TCP and UDP ports on this machine. This listing might be of
some use in determining which ports need to be firewalled.</TD>
</TR>
</TABLE>
<TABLE WIDTH="99%" BORDER=0 BGCOLOR="#EEEEEE" CELLSPACING=2 CELLPADDING=4>
<TR ALIGN=LEFT VALIGN=TOP>
<TD><B>Protocol</B></TD>
<TD><B>Port Number</B></TD>
</TR>
<?php
#
# Print all of the open ports.
#
function print_port ($proto,$port) {
print "<TR VALIGN=MIDDLE ALIGN=LEFT>";
$fs = "<TD>" . service_colour("$port/$proto");
$ef = "</FONT></TD>";
print "$fs$proto$ef$fs$port$ef</TR>\n";
}
$portr = popen("/bin/netstat -a", "r");
while (!feof($portr)) {
$buffer = trim(fgets($portr, 255));
list ($proto, $rq, $sq, $la, $lp, $fa, $fp, $state) = preg_split ("/[\s:]+/", $buffer);
if ( ($proto == "tcp") and ($state == "LISTEN") ) {
print_port ($proto, $lp);
} elseif ( ($proto == "udp") and ($la == "*") ) {
print_port ($proto, $lp);
} elseif ( ($proto == "udp") and ($la == "localhost") ) {
print_port ($proto, $lp);
}
}
$term = pclose($portr);
?>
</TABLE>
</BODY>
</HTML>