コンピュータや音楽の事書いてます

レンタルサーバの仕様cgi

レンタルサーバの仕様をperl cgiで調べた時のめも。

#!/usr/bin/perl

print "Content-type: text/html\r\n\r\n";
print <<EOF;
<style>
pre { 
	border:1px solid;
	line-height:1ex;
}
</style>
EOF

&command_print ("uname -a");
&command_print ("cat /etc/*release");
&command_print ("ls -l /");
&command_print ("ls -l /proc");
&command_print ("ls -l /etc");
&command_print ("cat `find /etc/httpd -name *.conf`");

sub command_print {
	$line = `$_[0]`;
	$line =~ s/\n/<br>\n/g;
	print <<EOF;
	
<font color=blue>command: $_[0]</font>
<pre>
$line
</pre>
<br><br>\n
EOF
};