#!/usr/local/bin/perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use diagnostics; $|++; my $query = new CGI; print $query->header; # Where we sent the mediaID parameter? if (defined $query->param('mediaID')) { vmquery($query); } # If we weren't sent the mediaID parameter, just display the form. else { $query->start_html ( -title => "Tape Pull Process Tool" -bgcolor => "ffffff" ), $query->h1 ("Process Tape Pulls" ), $query->hr; print_prompt($query); makeEnd($query); } sub print_prompt { my $query = shift; my $cmd = "default_value"; print $query->start_form; print $query->p("Beginning: Date & Time"), $query->textfield ( -name=>"from", -size=>22, -maxlength=>19Ü ); print $query->p("End: Date & Time"), $query->textfield ( -name =>"to", -size =>22, -maxlength=>19Ü ); print $query->p("Tape ID"), $query->textfield ( -name=>"mediaID", -value => "$cmd", -size =>25, -maxsize =>25Ü ); print " \@mitre.org"; print "

", $query->reset; print $query->submit('action','submit'); print $query->end_form; print "


"; } sub makeEnd { my ($query) = shift; print $query->end_html; } # Sub which executes the vmquery command sub vmquery { my $query = shift; my $cmd_param = check_param( $query->param('mediaID') ); my $cmd = "/opt/openv/volmgr/bin/vmquery -m $cmd_param"; print "Running the command: $cmd
"; print `$cmd`; } # Verify that the parameters sent from the browser are sane sub check_param { my $param = shift; # You need to do some serious parameter checking here, you probably want to # put something better than this in $param =~ m/^(\w+)$/; return $1; }