PersonalCorpus 版 (精华区)
<HTML><HEAD><TITLE>Real Time System Status</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META http-equiv=Refresh content=60>
</HEAD>
<BODY text=#600000 bgColor=#ffffff>
<TABLE width=760 align=left bgColor=#d0b000 border=4>
<TBODY>
<TR>
<TD width=170><FONT color=#000000><B> Gateway
system</B></FONT>
<TD><FONT color=#000080> vilab <FONT size=2>{
<?php
$fp=fopen("/proc/net/ip_conntrack","r");
$tcp_count=0;
$udp_count=0;
$icmp_count=0;
while (1) {
$s=fgets($fp,1000);
if (feof($fp)) break;
if (strlen($s)<10) break;
if (substr($s,0,3)=="tcp") {
for ($i=11;($s[$i]<'A')||($s[$i]>'Z');$i++);
for ($j=$i;$s[$j]!=' ';$j++);
$tcp_state[]=substr($s,$i,$j-$i);
$t=strstr($s,"src=");
for ($i=4;$t[$i]!=' ';$i++);
$tcp_src[]=substr($t,4,$i-4);
$t=strstr($s,"dst=");
for ($i=4;$t[$i]!=' ';$i++);
$tcp_dst[]=substr($t,4,$i-4);
$t=strstr($s,"sport=");
for ($i=6;$t[$i]!=' ';$i++);
$tcp_sport[]=substr($t,6,$i-6);
$t=strstr($s,"dport=");
for ($i=6;$t[$i]!=' ';$i++);
$tcp_dport[]=substr($t,6,$i-6);
$tcp_count++;
} else if (substr($s,0,3)=="udp") {
if (strstr($s,"[ASSURED]")!=NULL) {
$udp_state[]="ASSURED";
} else {
$udp_state[]="OTHERS";
}
$t=strstr($s,"src=");
for ($i=4;$t[$i]!=' ';$i++);
$udp_src[]=substr($t,4,$i-4);
$t=strstr($s,"dst=");
for ($i=4;$t[$i]!=' ';$i++);
$udp_dst[]=substr($t,4,$i-4);
$t=strstr($s,"sport=");
for ($i=6;$t[$i]!=' ';$i++);
$udp_sport[]=substr($t,6,$i-6);
$t=strstr($s,"dport=");
for ($i=6;$t[$i]!=' ';$i++);
$udp_dport[]=substr($t,6,$i-6);
$udp_count++;
} else if (substr($s,0,4)=="icmp") {
$t=strstr($s,"src=");
for ($i=4;$t[$i]!=' ';$i++);
$icmp_src[]=substr($t,4,$i-4);
$t=strstr($s,"dst=");
for ($i=4;$t[$i]!=' ';$i++);
$icmp_dst[]=substr($t,4,$i-4);
$icmp_count++;
}
}
fclose($fp);
?>
<?php
$fp=fopen("/proc/version","r");
$s=fgets($fp,100);
fclose($fp);
for ($i=0;;$i++) if ($s[$i]!='(') echo $s[$i]; else break;
echo "-";
$fp=fopen("/proc/cpuinfo","r");
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
echo substr($modelname,12,strlen($modelname)-12);
echo " ";
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
$modelname=fgets($fp,100);
echo substr($modelname,11,strlen($modelname)-11);
echo " bogomips; ";
fclose($fp);
$fp=fopen("/proc/meminfo","r");
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
echo "mem:";
echo substr($meminfo,12,strlen($meminfo)-13);
echo "; ";
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
$meminfo=fgets($fp,100);
echo "swap:";
echo substr($meminfo,12,strlen($meminfo)-13);
echo "}";
fclose($fp);
?>
</FONT></FONT>
<TR>
<TD><FONT color=#000000> <B>System date</B></FONT>
<TD><FONT color=#000080>
<?php
echo date(Y);
echo "/";
echo date(m);
echo "/";
echo date(d);
echo " - ";
echo "<B>";
echo date(H);
echo ":";
echo date(i);
echo ":";
echo date(s);
echo "</B>";
?>
<FONT size=2> GMT+8</FONT>
<?php
echo "(up ";
$fp=fopen("/proc/uptime","r");
$s=fgets($fp,100);
for ($i=0;;$i++) if($s[$i]==' ') break;
$uptime=substr($s,0,$i);
echo (int)($uptime/86400);
echo " days, ";
$uptime=$uptime-86400*((int)($uptime/86400));
echo (int)($uptime/3600);
echo ":";
$uptime=$uptime-3600*((int)($uptime/3600));
echo (int)($uptime/60);
echo ":";
$uptime=$uptime-60*((int)($uptime/60));
echo (int)$uptime;
echo ")";
fclose($fp);
?>
</FONT>
<TR>
<?php
/*
echo "<TD><FONT color=#000000> <B>Load average</B></FONT>";
echo "<TD><FONT color=#000080><B> ";
$fp=fopen("/proc/loadavg","r");
$s=fgets($fp,100);
echo substr($s,0,4);
echo " ";
echo substr($s,5,4);
echo " ";
echo substr($s,10,4);
echo " </B> </FONT>";
fclose($fp);
*/
echo "<TD><FONT color=#000000> <B>Ethernet
</B>(RX/TX)</FONT>";
echo "<TD><FONT color=#000080><B> </B>";
$fp=fopen("/proc/net/dev","r");
$s=fgets($fp,200);
$s=fgets($fp,200);
while (1) {
$s=fgets($fp,200);
if (feof($fp)) break;
for ($i=0;$s[$i]==' ';$i++);
echo substr($s,$i,7-$i)," <B>";
for ($i=8;$s[$i]==' ';$i++);
for ($j=0;$j<1;$i++) if (($s[$i]!=' ')&&($s[$i+1]==' ')) $j++;
for ($i++;$s[$i]==' ';$i++);
for ($j=$i+1;$s[$j]!=' ';$j++);
$t=substr($s,$i,$j-$i);
for ($ti=strlen($t)-1,$tj=1,$tk=(int)($ti/3);$tk>0;$ti--,$tj++) {
$t[$ti+$tk]=$t[$ti];
if ($tj==3) { $tj=0; $tk--; $t[$ti+$tk]=','; }
}
echo $t," ";
for ($i=$j,$k=0;$k<7;$i++) if (($s[$i]!=' ')&&($s[$i+1]==' ')) $k++;
for ($i++;$s[$i]==' ';$i++);
for ($j=$i+1;$s[$j]!=' ';$j++);
$t=substr($s,$i,$j-$i);
for ($ti=strlen($t)-1,$tj=1,$tk=(int)($ti/3);$tk>0;$ti--,$tj++) {
$t[$ti+$tk]=$t[$ti];
if ($tj==3) { $tj=0; $tk--; $t[$ti+$tk]=','; }
}
echo $t," </B>";
}
echo " ";
echo " </B> </FONT>";
fclose($fp);
?>
<TR>
<TD><FONT color=#000000> <B>Memory</B> (Kb)</FONT>
<TD><FONT color=#000080> <B>
<?php
$fp=fopen("/proc/meminfo","r");
$s=fgets($fp,100);
$s=fgets($fp,100);
$s=fgets($fp,100);
$s=fgets($fp,100);
$memtotal=substr($s,16,strlen($s)-20);
$s=fgets($fp,100);
$memfree=substr($s,16,strlen($s)-20);
$s=fgets($fp,100);
$memshared=substr($s,16,strlen($s)-20);
$s=fgets($fp,100);
$buffers=substr($s,16,strlen($s)-20);
$s=fgets($fp,100);
$cached=substr($s,16,strlen($s)-20);
$s=fgets($fp,100);
$swapcached=substr($s,16,strlen($s)-20);
$s=fgets($fp,100);
$s=fgets($fp,100);
$s=fgets($fp,100);
$s=fgets($fp,100);
$s=fgets($fp,100);
$s=fgets($fp,100);
$s=fgets($fp,100);
$swaptotal=substr($s,16,strlen($s)-20);
$s=fgets($fp,100);
$swapfree=substr($s,16,strlen($s)-20);
echo $memtotal-$memfree+$swaptotal-$swapfree;
echo " </B> used <FONT size=2>(";
echo $swaptotal-$swapfree;
echo " swap)</FONT>; <B>";
echo $memfree+$swapfree;
echo "</B> free <FONT size=2>(";
echo $buffers;
echo " buffers, ";
echo $cached;
echo " cached,";
echo $swapcached;
echo " swap)</FONT>; ";
echo $memshared;
echo " shared</FONT>";
fclose($fp);
?>
<TR>
<TD><FONT color=#000000> <B>Iptlogd</B></FONT>
<TD><FONT color=#000080>
<?php
$fp=fopen("/var/run/iptlogd.status","r");
$startime=fgets($fp);
$compileinfo=fgets($fp);
$iptlogdversion=fgets($fp);
fclose($fp);
echo "since:<B>2002-09-26 14:30</B> ver:<B> ",
$iptlogdversion,"</B>";
?>
</FONT>
<TR>
<TD><FONT color=#000000> <B>Concurrent connections</B></FONT>
<TD><FONT color=#000080>
<?php
echo "<B>",$tcp_count," ",$udp_count;
echo" ",$icmp_count,"</B> (tcp udp icmp)";
?>
</FONT>
</TR></TBODY></TABLE>
<BR><BR>
<BR clear=all>
<TABLE width=600 bgColor=#e0e000 border=4>
<TBODY>
<TR align=middle>
<TD><FONT color=#000000><B>IP</B></FONT>
<TD><FONT color=#000000><B>Free Flux</B> (Bytes)</FONT>
<TD><FONT color=#000000><B>Toll Flux</B> (Bytes)</FONT>
<?php
$tot00=0;
$tot01=0;
$tot02=0;
$tot10=0;
$tot11=0;
$tot12=0;
$fp=fopen("/var/run/iptlogd.mmap","rb");
$str=fread($fp,4096);
fclose($fp);
for ($i=1;$i<=254;$i++) {
for ($offset=0;$offset<9;$offset+=8) {
$k0=0;
$k1=0;
$k2=ord($str[$i*16+7+offset]);
for ($j=6;$j>=0;$j--) {
$k0=$k0*256;
$k1=$k1*256;
$k2=$k2*256+ord($str[$i*16+$j+$offset]);
if ($k2>999999) {
$k1=$k1+(int)($k2/1000000);
$k2=$k2-1000000*((int)($k2/1000000));
}
if ($k1>999999) {
$k0=$k0+(int)($k1/1000000);
$k1=$k1-1000000*((int)($k1/1000000));
}
}
if ($offset==0) {
if (($k0==0)&&($k1==0)&&($k2<1024)) break;
echo "<TR align=middle>";
echo "<TD> 192.168.0.";
echo "<B>",$i,"</B>";
}
echo "<TD>";
$kk0=$k0;
$kk1=$k1;
$kk2=$k2;
echo " <B>";
if ($kk0>0) {
echo $kk0;
echo "T";
}
if ($kk1>999) {
echo (int)($kk1/1000);
echo "G";
}
$kkk1=$kk1 -1000*(int)($kk1/1000);
$kk1=(int)($kk1/1000);
if ($kkk1!=0) {
echo $kkk1;
echo "M";
}
if (($kk0==0)&&($kk1==0)) {
echo (int)($kk2/1000);
echo "K";
}
echo "</B>";
if ($offset==0) {
$tot00=$tot00+$k0;
$tot01=$tot01+$k1;
$tot02=$tot02+$k2;
if ($tot02>999999) {
$tot02=$tot02-1000000;
$tot01=$tot01+1;
}
if ($tot01>999999) {
$tot01=$tot01-1000000;
$tot00=$tot00+1;
}
} else {
$tot10=$tot10+$k0;
$tot11=$tot11+$k1;
$tot12=$tot12+$k2;
if ($tot12>999999) {
$tot12=$tot12-1000000;
$tot11=$tot11+1;
}
if ($tot11>999999) {
$tot11=$tot11-1000000;
$tot10=$tot10+1;
}
}
}
}
echo "<TR align=middle>";
echo "<TD> <B>Total</B>";
echo "<TD> ";
echo " <B>";
if ($tot00>0) {
echo $tot00;
echo "T";
}
if ($tot01>999) {
echo (int)($tot01/1000);
echo "G";
}
if ($tot00==0) {
$tot01=$tot01 -1000*(int)($tot01/1000);
if ($tot01!=0) {
echo $tot01;
echo "M";
}
}
echo "</B>";
echo "<TD>";
echo "<B>";
if ($tot10>0) {
echo $tot10;
echo "T";
}
if ($tot11>999) {
echo (int)($tot11/1000);
echo "G";
}
if ($tot10==0) {
$tot11=$tot11 -1000*(int)($tot11/1000);
if ($tot11!=0) {
echo $tot11;
echo "M";
}
}
echo "</B>";
?>
</TR></TBODY></TABLE>
<TABLE width=600 align=left bgColor=#d0b000 border=4>
<TBODY>
<?php
$temp_tcp_count=0;
for ($i=0;$i<$tcp_count;$i++) { //if ($tcp_state[$i]=="ESTABLISHED"){
$temp_tcp_src[]=$tcp_src[$i];
$temp_tcp_sport[]=$tcp_sport[$i];
$temp_tcp_dst[]=$tcp_dst[$i];
$temp_tcp_dport[]=$tcp_dport[$i];
$temp_tcp_state[]=$tcp_state[$i];
$temp_tcp_count++;
}
for ($i=0;$i<$temp_tcp_count;$i++) {
$k=$i;
for ($j=$i+1;$j<$temp_tcp_count;$j++)
if (strcmp($temp_tcp_src[$j],$temp_tcp_src[$k])<0) $k=$j;
echo "<TR><TD>",$temp_tcp_src[$k],"<TD>",$temp_tcp_sport[$k],"<TD>",
$temp_tcp_dst[$k],"<TD>",$temp_tcp_dport[$k],"<TD>",
$temp_tcp_state[$k],"<BR>";
if ($i<$k) {
$temp_tcp_src[$k]=$temp_tcp_src[$i];
$temp_tcp_sport[$k]=$temp_tcp_sport[$i];
$temp_tcp_dst[$k]=$temp_tcp_dst[$i];
$temp_tcp_dport[$k]=$temp_tcp_dport[$i];
$temp_tcp_state[$k]=$temp_tcp_state[$i];
}
}
?>
</TR></TBODY></TABLE>
<BR clear=all>
<TABLE width=600 align=left bgColor=#d0b000 border=4>
<TBODY>
<?php
$temp_udp_count=0;
for ($i=0;$i<$udp_count;$i++) { //if ($udp_state[$i]==""){
$temp_udp_src[]=$udp_src[$i];
$temp_udp_sport[]=$udp_sport[$i];
$temp_udp_dst[]=$udp_dst[$i];
$temp_udp_dport[]=$udp_dport[$i];
$temp_udp_state[]=$udp_state[$i];
$temp_udp_count++;
}
for ($i=0;$i<$temp_udp_count-1;$i++) {
$k=$i;
for ($j=$i+1;$j<$temp_udp_count;$j++)
if (strcmp($temp_udp_src[$j],$temp_udp_src[$k])<0) $k=$j;
echo "<TR><TD>",$temp_udp_src[$k],"<TD>",$temp_udp_sport[$k],"<TD>",
$temp_udp_dst[$k],"<TD>",$temp_udp_dport[$k],"<TD>",
$temp_udp_state[$k],"<BR>";
if ($i<$k) {
$temp_udp_src[$k]=$temp_udp_src[$i];
$temp_udp_sport[$k]=$temp_udp_sport[$i];
$temp_udp_dst[$k]=$temp_udp_dst[$i];
$temp_udp_dport[$k]=$temp_udp_dport[$i];
$temp_udp_state[$k]=$temp_udp_state[$i];
}
}
?>
</TR></TBODY></TABLE>
<BR clear=all>
<TABLE width=600 align=left bgColor=#d0b000 border=4>
<TBODY>
<?php
for ($i=0;$i<$icmp_count;$i++) {
echo "<TR><TD>",$icmp_src[$i],"<TD>",$icmp_dst[$i],"<BR>";
}
?>
</TR></TBODY></TABLE>
<BR>
--
<BR>
<FONT color=#000000><B>
You are visitor :
<?php
$fp=fopen("counter.txt","r");
$s=fgets($fp,6);
fclose($fp);
echo $s;
$s++;
$fp=fopen("counter.txt","w");
fputs($fp,$s,6);
fclose($fp);
?>
</B></FONT>
</BODY></HTML>
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:215.259毫秒