#!/usr/bin/perl -w
#
# DATE: 21 August, 2002
# VERSION: 0.2.1
#
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
print "Content-type: text/html\n\n";
#Location of Perl
$whereperl = join("
", split(/\s+/, qx/whereis perl/));
#Location of Sendmail
$wheresendmail = join("
", split(/\s+/, qx/whereis sendmail/));
#Location of Current Directory
$currentdirectory = `pwd`;
# List of processes
$processes = qx/ps aux/;
$processes =~ s/
/\n/gi;
$processes =~ s/
/\n\n/gi;
$processes =~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs;
#Perl Variables
$perlversion = $];
$path_tar = join("
", split(/\s+/, qx/whereis tar/));
$path_gzip = join("
", split(/\s+/, qx/whereis gzip/));
$path_apache = join("
", split(/\s+/, qx/whereis apache/));
$path_httpd = join("
", split(/\s+/, qx/whereis httpd/));
$path_php = join("
", split(/\s+/, qx/whereis php/));
$path_mysql = join("
", split(/\s+/, qx/whereis mysql/));
$path_man = join("
", split(/\s+/, qx/whereis man/));
$path_perldoc = join("
", split(/\s+/, qx/whereis perldoc/));
#Perl Os
$perlos = $^O;
$perlos_version = get_server('version');
$perlos_version =~ s/#/
#/s;
$perlos_version =~ s/\(/
(/s;
$perlos_cpu = get_server_detail('cpuinfo');
$perlos_mem = get_server_detail('meminfo');
$perlos_mem =~ s/^.*?\n.*?\n.*?\n//s;
$perlos_dsk = `df`;
sub get_server
{
open PROC, "",
";
}
#Environment Variables
$environment = qq~
| ENVIRONMENT VARIABLES 5 | |
| $key | $value |
| PERL INFORMATION | SERVER INFORMATION | ENVIRONMENT VARIABLES | INSTALLED PERL MODULES |
| PERL INFORMATION 5 | |
| Perl version | $perlversion |
| Perl | $whereperl |
| Sendmail | $wheresendmail |
| SERVER INFORMATION 5 | |
| Name | $servername |
| IP | $serverip |
| Listing Port | $serverport |
| Document Root | $documentroot |
| Disk Usage by Root | $diskusage KB |
| Server stamp | $serversoftware |
| Server Time (Local) | $localtime |
| Server Time (GMT) | $gmttime |
| Server Uptime/Load | at $serveruptime |
| Server Details |
OPERATING SYSTEM: CPU UTILIZATION: MEMORY UTILIZATION: DISK UTILIZATION: |
| Module Paths | $modulepaths |
| Path(s) to TAR | $path_tar |
| Path(s) to GZIP | $path_gzip |
| Path to APACHE/HTTPD | $path_apache $path_httpd |
| Path to PHP | $path_php |
| Path to MYSQL | $path_mysql |
| Path to MAN (Unix manual) | $path_man |
| Path to PERLDOC | $path_perldoc |
| Processes currently on the server | |
| LIST OF ALL INSTALLED PERL MODULES 5 | ||
|
~;
&vars;
find(\&wanted,@INC);
$modcount = 0;
foreach $line(@foundmods)
{
$match = lc($line);
if ($found{$line}[0] >0)
{$found{$line} = [$found{$line}[0]+1,$match]}
else
{$found{$line} = ["1",$match];$modcount++}
}
@foundmods = sort count keys(%found);
sub count
{
return $found{$a}[1] cmp $found{$b}[1]
}
$third = $modcount/3;
$count=0;
$firstroundtotal = 0;
foreach $mod(@foundmods)
{
chomp $mod;
$count++;
if ($count <= $third)
{
$firstroundtotal++;
print qq~
$firstroundtotal. $mod ~; } else { push (@mod1,$mod) } } $count = 0; print qq~ | ~;
foreach $mod1(@mod1)
{
chomp $mod1;
$count++;
if ($count <= $third){}
else {
push (@mod2,$mod1)}}$count = 0;
foreach $mod2(@mod2)
{ chomp $mod2; $count++; if ($count <= $third)
{
$firstroundtotal++;
print qq~
$firstroundtotal. $mod2 ~; }}; sub vars {use File::Find;} sub wanted { $count = 0; if ($File::Find::name =~ /\.pm$/) { open(MODFILE,$File::Find::name) || return; while( |
|
| PERL INFORMATION | SERVER INFORMATION | ENVIRONMENT VARIABLES | INSTALLED PERL MODULES |