#--------------------- untaint the shell command -----------------------------------------# # --- untaint the $nnm argument if ($nnm !~ /([a-z]+ms1.[nkth][sxev].(cs.)?boeing.com)/ && $nnm !~ /(^case3.*)/) { print h3("NNM tainted: $nnm\n"); die; } $nnm = $1; # --- untaint the $command argument unless ($command =~ /^[\w\s.\-\/]+$/ ) ##/^([-\@\w.]+)$/) ### #=~ m#^([\w\.\-/]+)$#) { print h3("command tainted: $command"); print li($1); print li($2); print li($3); print li("$4\n"); die; } $command = $1; # --- untaint the $debug argument unless ($debug =~ m#^([\w\.\-/]+)$#) { die h3("debug tainted: $debug\n"); } $debug = $1; #-----------------------------------------------------------------------------------------# open(RSH, $cmd ) || die "Failed to run {$cmd}: $!"; while () { $result .= "$_\n"; push( @lines, $_ ); } close(RSH); if ( $debug ) { print hr; print br; print i("Result: {" . $result . "}"); } print br( "Lines returned: (" . @lines . ")" ); print Dumper( @lines ); print br,"------------", p;