#!/usr/bin/perl -wT #---------------------------------------------------------------------- # heading : Miscellaneous # description : Sensor Information # navigation : 5000 5130 #---------------------------------------------------------------------- # Ian Wells 27th December 2002 #---------------------------------------------------------------------- package esmith; use strict; use CGI ':all'; use CGI::Carp qw(fatalsToBrowser); use esmith::cgi; use esmith::config; use esmith::util; use esmith::db; sub showInitial ($); BEGIN { # Clear PATH and related environment variables so that calls to # external programs do not cause results to be tainted. See # "perlsec" manual page for details. $ENV {'PATH'} = '/bin:/usr/bin'; $ENV {'SHELL'} = '/bin/bash'; delete $ENV {'ENV'}; } esmith::util::setRealToEffective (); $CGI::POST_MAX=1024 * 100; # max 100K posts $CGI::DISABLE_UPLOADS = 1; # no uploads my %conf; tie %conf, 'esmith::config'; #------------------------------------------------------------ # examine state parameter and display the appropriate form #------------------------------------------------------------ my $q = new CGI; if (! grep (/^state$/, $q->param)) { showInitial ($q); } else { esmith::cgi::genStateError ($q, \%conf); } exit (0); #------------------------------------------------------------ # subroutine to display initial form #------------------------------------------------------------ sub showInitial ($) { my @sensorOutput = `/usr/bin/sensors`; my ($q) = @_; esmith::cgi::genHeaderNonCacheable ($q, \%conf, 'Sensor Information'); print $q->hr; print $q->p ($q->pre ("@sensorOutput")); esmith::cgi::genFooter ($q); }