#!/usr/bin/env perl ## ########################### ## Server Info CGI v1.08 ## ########################### ## ## ###################################### ## ## Server Info CGI v1.08 � 2000 ## ## ## http://www.widexl.com ## ## ## Made by Henk Boonstra ## ## ###################################### ## ## This script gives information about your (web)server. ## Software, Modules, libraries, env, network... ## ## Install: ## Change the path to perl (The first line in this script). ## Upload the script in ASCII mode to your cgi-bin directory. ## chmod script to 755. ## Open the script in a browser. ## ############################## ############################## use strict; use warnings FATAL => 'all'; no warnings 'redefine'; # to be remove in production use Carp; our %info = (); my $output = undef; my $ver = 'v1.8'; find_prog(); print "Content-type: text/html\n\n"; my $header = qq|
\n\n";
if ($^O eq 'MSWin32') {
$info{'OS_VERSION'} = `ver`;
$info{'HOST_NAME'} = `hostname`;
if ($info{'OS_VERSION'}) {$info{'EXEC'} = 'Enabled'}
}
else {
$info{'PROC_RELEASE'} = `uname -r`;
$info{'MACHINE'} = `uname -m`;
$info{'PROCESSOR'} = `uname -p`;
$info{'NODE_NAME'} = `uname -n`;
$info{'SYS_NAME'} = `uname -s`;
$info{'WHOAMI'} = `whoami`;
my $ex = `which perl`;
$info{'TAR'} = `which tar` || $info{'TAR'};
$info{'GZIP'} = `which gzip` || $info{'GZIP'};
$info{'COMPRESS'} = `which compress` || $info{'COMPRESS'};
$info{'WHOIS'} = `which whois` || $info{'WHOIS'};
$info{'CONVERT'} = `which convert` || $info{'CONVERT'};
$info{'MAIL_PROGRAM'} = `which sendmail` || $info{'MAIL_PROGRAM'};
$info{'MAIL_PROGRAM'} = "Found no mail program" if (!$info{'MAIL_PROGRAM'});
$info{'UPTIME'} = `uptime`;
$info{'QUOTA'} = `quota`;
$info{'QUOTA'} =~ s/\n/ /isg if ($info{'QUOTA'}); if ($ex) {$info{'EXEC'} = 'Enabled'} } $info{'OS'} = $^O; $info{'SERVER_NAME'} = $ENV{'SERVER_NAME'}; $info{'SERVER_ADDR'} = $ENV{'SERVER_ADDR'}; $info{'PERL_EXE'} = $^X; $info{'PERL_VER'} = $]; $info{'PERL_LIB'} = "@INC"; $info{'HTTP_HOST'} = $ENV{'HTTP_HOST'}; $info{'APACHE_LIB'} = $info{'APACHE_LIB'}; $info{'DOCU_ROOT'} = $ENV{'DOCUMENT_ROOT'}; $info{'SERVER_ADMIN'} = $ENV{'SERVER_ADMIN'}; $info{'SERVER_SOFT'} = $ENV{'SERVER_SOFTWARE'}; $info{'HTTP_ACCEPT'} = $ENV{'HTTP_ACCEPT'}; $info{'REMOTE_ADDR'} = $ENV{'REMOTE_ADDR'}; $info{'REMOTE_HOST'} = $ENV{'REMOTE_HOST'}; $info{'ACCEPT_LANG'} = $ENV{'HTTP_ACCEPT_LANGUAGE'}; $info{'USER_AGENT'} = $ENV{'HTTP_USER_AGENT'}; $info{'SERVER_VER'} = server('version'); $info{'SERVER_CPU'} = server('cpuinfo'); $info{'SERVER_MEM'} = server('meminfo'); # The Output. $output .= "Server info \n"; $output .= "Operating system = <%OS%> \n"; if (("$^O" eq "MSWin32") and ($info{'EXEC'})) { $output .= "Version = <%OS_VERSION%> \n"; $output .= "Host name = <%HOST_NAME%> \n"; } if (("$^O" ne "MSWin32") and ($info{'EXEC'})) { $output .= "Kernel = <%PROC_RELEASE%> \n"; $output .= "Machine = <%MACHINE%> \n"; $output .= "Processor type = <%PROCESSOR%> \n"; $output .= "Whoami = <%WHOAMI%> \n"; $output .= "Host name = <%NODE_NAME%> \n"; } $output .= "Server name = <%SERVER_NAME%> \n"; $output .= "Server IP = <%SERVER_ADDR%> \n"; $output .= " \n\n"; $output .= "Web server info \n"; $output .= "HTTP address = <%HTTP_HOST%> \n"; $output .= "Document root = <%DOCU_ROOT%> \n"; $output .= "Apache lib = <%APACHE_LIB%> \n"; $output .= "Administrator = <%SERVER_ADMIN%> \n"; $output .= "Server software = <%SERVER_SOFT%> \n"; $output .= "HTTP accept = <%HTTP_ACCEPT%> \n"; $output .= " \n\n"; $output .= "Server programs \n"; $output .= "Mail program = <%MAIL_PROGRAM%> \n"; $output .= "Tar program = <%TAR%> \n"; $output .= "Gzip program = <%GZIP%> \n"; $output .= "Compress program = <%COMPRESS%> \n"; $output .= "Whois program = <%WHOIS%> \n"; $output .= "ImageMagick convert = <%CONVERT%> \n"; $output .= " \n\n"; $output .= "Perl info \n"; $output .= "Perl location = <%PERL_EXE%> \n"; $output .= "Perl version = <%PERL_VER%> \n"; $output .= "Locations of Perl libraries = <%PERL_LIB%> \n"; $output .= " \n\n"; $output .= "Remote user info \n"; $output .= "Remote IP = <%REMOTE_ADDR%> \n"; $output .= "Remote hostname = <%REMOTE_HOST%> \n"; $output .= "Language = <%ACCEPT_LANG%> \n"; $output .= "User agent = <%USER_AGENT%> \n"; $output .= " \n\n"; $output .= "Extra info \n"; $output .= "Executing of system commands = Enabled \n" if ($info{'EXEC'}); $output .= "Executing of system commands = Not enabled \n" if (!$info{'EXEC'}); $output .= "Server uptime = <%UPTIME%> \n"; $output .= " \n\n"; if ("$^O" ne "MSWin32") { $output .= "Server version \n"; $output .= "<%SERVER_VER%> \n"; $output .= " \n\n"; if ($info{'QUOTA'}) { $output .= "Disk Quota \n"; $output .= "<%QUOTA%>\n"; $output .= " \n\n"; } $output .= "CPU info \n"; $output .= "<%SERVER_CPU%> \n"; $output .= " \n\n"; $output .= "Memory info \n"; $output .= "<%SERVER_MEM%> \n"; $output .= " \n\n"; } $output .= "Perl libraries installed \n"; eval {require CGI}; if ($@) {$output .= "The library CGI is not installed \n"} else {$output .= "Library CGI v$CGI::VERSION installed \n"} eval {require mod_perl}; if ($@) {$output .= "The library mod_perl is not installed \n"} else {$output .= "Library mod_perl v$mod_perl::VERSION installed \n"} eval {require LWP}; if ($@) {$output .= "The library www-perl is not installed \n"} else {$output .= "Library www-perl v$LWP::VERSION installed \n"} eval {require LWP::Parallel}; if ($@) {$output .= "The library LWP::Parallel is not installed \n"} else {$output .= "Library LWP::Parallel v$LWP::Parallel::VERSION installed \n"} eval {require SOAP::Lite}; if ($@) {$output .= "The library SOAP::Lite is not installed \n"} else {$output .= "Library SOAP::Lite v$SOAP::Lite::VERSION installed \n"} eval {require DBI}; if ($@) {$output .= "The library DBI is not installed \n"} else {$output .= "Library DBI v$DBI::VERSION installed \n"} eval {require DBD::mysql}; if ($@) {$output .= "The library DBD::mysql is not installed \n"} else {$output .= "Library DBD::mysql v$DBD::mysql::VERSION installed \n"} eval {require URI}; if ($@) {$output .= "The library URI is not installed \n"} else {$output .= "Library URI v$URI::VERSION installed \n"} eval {require Digest::MD5}; if ($@) {$output .= "The library Digest::MD5 is not installed \n"} else {$output .= "Library Digest::MD5 v$Digest::MD5::VERSION installed \n"} eval {require Crypt::SSLeay}; if ($@) {$output .= "The library Crypt::SSLeay is not installed \n"} else {$output .= "Library Crypt::SSLeay v$Crypt::SSLeay::VERSION installed \n"} eval {require Net::SSLeay}; if ($@) {$output .= "The library Net::SSLeay is not installed \n\n"} else {$output .= "Library Net::SSLeay.pm v$Net::SSLeay::VERSION installed \n\n"} if ($info{'APACHE_LIB'}) { my @standard_mod = ('mod_rewrite.so', 'mod_cgi.so', 'mod_perl.so', 'mod_env.so', 'mod_include.so', 'mod_alias.so', 'mod_python.so'); my @auth_mod = ('mod_auth_digest.so', 'mod_auth_mysql.so'); my @ext_mod = ('mod_expires.so', 'mod_headers.so', 'libphp5.so', 'mod_proxy.so', 'mod_speling.so', 'mod_status.so', 'mod_usertrack.so', 'mod_vhost_alias.so'); $output .= "Apache modules installed \n"; foreach my $item(@standard_mod) { if (-e "$info{'APACHE_LIB'}/$item") {$output .= "Module '$item' installed \n"} else {$output .= "Module '$item' is not installed \n"} } $output .= " \n\n"; foreach my $item (@auth_mod) { if (-e "$info{'APACHE_LIB'}/$item") {$output .= "Module '$item' installed \n"} else {$output .= "Module '$item' is not installed \n"} } $output .= " \n\n"; foreach my $item(@ext_mod) { if (-e "$info{'APACHE_LIB'}/$item") {$output .= "Module '$item' installed \n"} else {$output .= "Module '$item' is not installed \n"} } $output .= " \n\n"; } eval { $info{'GET_USER'} = getpwent(); $info{'GET_GROUP'} = getgrent(); $info{'GET_HOST'} = gethostent(); $info{'GET_NET'} = getnetent(); $info{'GET_PROTO'} = getprotoent(); $info{'GET_SERV'} = getservent(); $output .= "Special info \n"; $output .= "user = <%GET_USER%> \n"; $output .= "group = <%GET_GROUP%> \n"; $output .= "host = <%GET_HOST%> \n"; $output .= "network = <%GET_NET%> \n"; $output .= "protocol = <%GET_PROTO%> \n"; $output .= "service = <%GET_SERV%> \n"; $output .= " \n\n"; }; $output .= "Web server Env \n"; my @keys = keys %ENV; my @values = values %ENV; foreach my $key (sort(@keys)) { $output .= "$key = $ENV{$key} \n"; } $output .= " |