From 125eb060c2483d92e7fcdd8a5abd3adad3678467 Mon Sep 17 00:00:00 2001 From: casjay Date: Tue, 18 Oct 2022 20:01:03 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 +- .../data/htdocs/cgi-bin/.gitkeep | 0 .../data/htdocs/cgi-bin/env.cgi | 404 ++++++++++++++++++ .../data/htdocs/cgi-bin/env.php | 45 ++ .../template-files/data/htdocs/cgi-bin/env.pl | 404 ++++++++++++++++++ .../template-files/data/htdocs/cgi-bin/env.py | 8 + .../template-files/data/htdocs/cgi-bin/env.rb | 7 + 7 files changed, 870 insertions(+), 2 deletions(-) delete mode 100644 rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/.gitkeep create mode 100755 rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.cgi create mode 100755 rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.php create mode 100755 rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.pl create mode 100755 rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.py create mode 100755 rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.rb diff --git a/Dockerfile b/Dockerfile index 48feaa8..16a13ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ RUN set -ex; \ if [ "${ALPINE_VERSION}" = "edge" ]; then echo "http://dl-cdn.alpinelinux.org/alpine/${ALPINE_VERSION}/testing" >>"/etc/apk/repositories" ; fi ; \ apk update --update-cache && apk add \ bash iproute2 \ - spawn-fcgi lighttpd lighttpd-mod_auth lighttpd-mod_webdav && \ + spawn-fcgi lighttpd lighttpd-mod_auth lighttpd-mod_webdav python3 ruby perl perl-cgi php8-cgi && \ cp -Rf "/etc/lighttpd" "$DEFAULT_TEMPLATE_DIR/lighttpd" @@ -45,7 +45,7 @@ ARG \ SERVICE_PORT="80" \ EXPOSE_PORTS="80" \ PHP_SERVER="lighttpd" \ - NODE_VERSION="14" \ + NODE_VERSION="system" \ NODE_MANAGER="system" \ BUILD_VERSION="latest" \ LICENSE="MIT" \ diff --git a/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/.gitkeep b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.cgi b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.cgi new file mode 100755 index 0000000..e86aa7c --- /dev/null +++ b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.cgi @@ -0,0 +1,404 @@ +#!/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| + + + + + Server Info script + + + + + +|; + +$output .= "$header\n"; +$output .= "
\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 .= "
\n"; +$output .= "\n"; + +$output =~ s/<%\s*(.*?)\s*%>/if ($info{$1}) {$info{$1}} else {"undefined<\/i>"}/oesg; + +print $output; + +return 'OK'; + +######################## +## Find Programs +######################## +sub find_prog { + +if (-e "/usr/local/bin/tar") {$info{'TAR'} = "/usr/local/bin/tar"} +elsif (-e "/usr/bin/tar") {$info{'TAR'} = "/usr/bin/tar"} +elsif (-e "/usr/local/tar") {$info{'TAR'} = "/usr/local/tar"} + +if (-e "/usr/local/bin/gzip") {$info{'GZIP'} = "/usr/local/bin/gzip"} +elsif (-e "/usr/bin/gzip") {$info{'GZIP'} = "/usr/bin/gzip"} +elsif (-e "/usr/local/gzip") {$info{'GZIP'} = "/usr/local/gzip"} + +if (-e "/usr/local/bin/compress") {$info{'COMPRESS'} = "/usr/local/bin/compress"} +elsif (-e "/usr/bin/compress") {$info{'COMPRESS'} = "/usr/bin/compress"} +elsif (-e "/usr/local/compress") {$info{'COMPRESS'} = "/usr/local/compress"} + +if (-e "/usr/local/bin/whois") {$info{'WHOIS'} = "/usr/local/bin/whois"} +elsif (-e "/usr/bin/whois") {$info{'WHOIS'} = "/usr/bin/whois"} +elsif (-e "/usr/local/whois") {$info{'WHOIS'} = "/usr/local/whois"} + +if (-e "/usr/local/bin/convert") {$info{'CONVERT'} = "/usr/local/bin/convert"} +elsif (-e "/usr/bin/convert") {$info{'CONVERT'} = "/usr/bin/convert"} +elsif (-e "/usr/local/convert") {$info{'CONVERT'} = "/usr/local/convert"} + +######################## +## Find Mail +######################## +if (-e "/var/qmail/bin/qmail-inject") {$info{'MAIL_PROGRAM'} = "/var/qmail/bin/qmail-inject"} +elsif (-e "/usr/sbin/sendmail") {$info{'MAIL_PROGRAM'} = "/usr/sbin/sendmail"} +elsif (-e "/usr/lib/sendmail") {$info{'MAIL_PROGRAM'} = "/usr/lib/sendmail"} +elsif (-e "/usr/bin/sendmail") {$info{'MAIL_PROGRAM'} = "/usr/bin/sendmail"} + +######################## +## Find Apache +######################## +if (-e "/usr/lib/httpd/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/httpd/modules"} +elsif (-e "/opt/lib/apache2/mod_env.so") {$info{'APACHE_LIB'} = "/opt/lib/apache2"} +if (-e "/usr/lib64/httpd/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib64/httpd/modules"} +#elsif (-e "/System/Library/Apache/Modules/mod_env.so") {$info{'APACHE_LIB'} = "/System/Library/Apache/Modules"}# Mac +#elsif (-e "/System/Library/Apache2/Modules/mod_env.so") {$info{'APACHE_LIB'} = "/System/Library/Apache2/Modules"}# Mac +#elsif (-e "/usr/local/apache/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/local/apache/modules"}# MachTen/WebTen +#elsif (-e "/usr/local/apache2/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/local/apache2/modules"}# MachTen/WebTen +#elsif (-e "/usr/lib/apache/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/apache/modules"}# OpenBSD +#elsif (-e "/usr/lib/apache2/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/apache2/modules"}# OpenBSD +#elsif (-e "/usr/lib/apache/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/apache"} +#elsif (-e "/usr/lib/httpd/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/httpd"} +#elsif (-e "C:/Apache/modules") {$info{'APACHE_LIB'} = "C:/Apache/modules"}# windows +#elsif (-e "C:/Apache2/modules") {$info{'APACHE_LIB'} = "C:/Apache2/modules"}# windows +} + +############## +## Server Info +############## +sub server { + my $serv_info = shift; + my $server_info = undef; + + if (-e "/proc/$serv_info") { + open SERVER, "", ); + close SERVER; + } + return $server_info; +} diff --git a/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.php b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.php new file mode 100755 index 0000000..26e6e1c --- /dev/null +++ b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.php @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + PHP Info + + + + + + + + + + + + + + diff --git a/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.pl b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.pl new file mode 100755 index 0000000..e86aa7c --- /dev/null +++ b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.pl @@ -0,0 +1,404 @@ +#!/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| + + + + + Server Info script + + + + + +|; + +$output .= "$header\n"; +$output .= "
\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 .= "
\n"; +$output .= "\n"; + +$output =~ s/<%\s*(.*?)\s*%>/if ($info{$1}) {$info{$1}} else {"undefined<\/i>"}/oesg; + +print $output; + +return 'OK'; + +######################## +## Find Programs +######################## +sub find_prog { + +if (-e "/usr/local/bin/tar") {$info{'TAR'} = "/usr/local/bin/tar"} +elsif (-e "/usr/bin/tar") {$info{'TAR'} = "/usr/bin/tar"} +elsif (-e "/usr/local/tar") {$info{'TAR'} = "/usr/local/tar"} + +if (-e "/usr/local/bin/gzip") {$info{'GZIP'} = "/usr/local/bin/gzip"} +elsif (-e "/usr/bin/gzip") {$info{'GZIP'} = "/usr/bin/gzip"} +elsif (-e "/usr/local/gzip") {$info{'GZIP'} = "/usr/local/gzip"} + +if (-e "/usr/local/bin/compress") {$info{'COMPRESS'} = "/usr/local/bin/compress"} +elsif (-e "/usr/bin/compress") {$info{'COMPRESS'} = "/usr/bin/compress"} +elsif (-e "/usr/local/compress") {$info{'COMPRESS'} = "/usr/local/compress"} + +if (-e "/usr/local/bin/whois") {$info{'WHOIS'} = "/usr/local/bin/whois"} +elsif (-e "/usr/bin/whois") {$info{'WHOIS'} = "/usr/bin/whois"} +elsif (-e "/usr/local/whois") {$info{'WHOIS'} = "/usr/local/whois"} + +if (-e "/usr/local/bin/convert") {$info{'CONVERT'} = "/usr/local/bin/convert"} +elsif (-e "/usr/bin/convert") {$info{'CONVERT'} = "/usr/bin/convert"} +elsif (-e "/usr/local/convert") {$info{'CONVERT'} = "/usr/local/convert"} + +######################## +## Find Mail +######################## +if (-e "/var/qmail/bin/qmail-inject") {$info{'MAIL_PROGRAM'} = "/var/qmail/bin/qmail-inject"} +elsif (-e "/usr/sbin/sendmail") {$info{'MAIL_PROGRAM'} = "/usr/sbin/sendmail"} +elsif (-e "/usr/lib/sendmail") {$info{'MAIL_PROGRAM'} = "/usr/lib/sendmail"} +elsif (-e "/usr/bin/sendmail") {$info{'MAIL_PROGRAM'} = "/usr/bin/sendmail"} + +######################## +## Find Apache +######################## +if (-e "/usr/lib/httpd/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/httpd/modules"} +elsif (-e "/opt/lib/apache2/mod_env.so") {$info{'APACHE_LIB'} = "/opt/lib/apache2"} +if (-e "/usr/lib64/httpd/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib64/httpd/modules"} +#elsif (-e "/System/Library/Apache/Modules/mod_env.so") {$info{'APACHE_LIB'} = "/System/Library/Apache/Modules"}# Mac +#elsif (-e "/System/Library/Apache2/Modules/mod_env.so") {$info{'APACHE_LIB'} = "/System/Library/Apache2/Modules"}# Mac +#elsif (-e "/usr/local/apache/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/local/apache/modules"}# MachTen/WebTen +#elsif (-e "/usr/local/apache2/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/local/apache2/modules"}# MachTen/WebTen +#elsif (-e "/usr/lib/apache/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/apache/modules"}# OpenBSD +#elsif (-e "/usr/lib/apache2/modules/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/apache2/modules"}# OpenBSD +#elsif (-e "/usr/lib/apache/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/apache"} +#elsif (-e "/usr/lib/httpd/mod_env.so") {$info{'APACHE_LIB'} = "/usr/lib/httpd"} +#elsif (-e "C:/Apache/modules") {$info{'APACHE_LIB'} = "C:/Apache/modules"}# windows +#elsif (-e "C:/Apache2/modules") {$info{'APACHE_LIB'} = "C:/Apache2/modules"}# windows +} + +############## +## Server Info +############## +sub server { + my $serv_info = shift; + my $server_info = undef; + + if (-e "/proc/$serv_info") { + open SERVER, "", ); + close SERVER; + } + return $server_info; +} diff --git a/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.py b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.py new file mode 100755 index 0000000..5f97222 --- /dev/null +++ b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python +import sys +import os + +print "Content-Type: text/html\n\n" + +for name, value in os.environ.items(): + print "%s\t= %s
" % (name, value) diff --git a/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.rb b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.rb new file mode 100755 index 0000000..10cd3ee --- /dev/null +++ b/rootfs/usr/local/share/template-files/data/htdocs/cgi-bin/env.rb @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +# -*- coding: None -*- + +require 'cgi' //cgi file to create a simple cgi object. + cgi = CGI.new //instantiating a cgi object. + puts cgi.header //thats telling the server about the type(html). + puts "hello" // thats the output on the browser.