Mercurial > repos > ktnyt > gembassy
comparison glang-galaxy-conf/snippets/perl_snippet_file.pl @ 2:8947fca5f715 draft default tip
Uploaded
author | ktnyt |
---|---|
date | Fri, 26 Jun 2015 05:21:44 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:84a17b3fad1f | 2:8947fca5f715 |
---|---|
1 #!/usr/bin/env perl | |
2 use warnings; | |
3 | |
4 my $scriptname = shift; | |
5 my $outname = shift; | |
6 open SCR, "<", $scriptname; | |
7 open OUT, ">", $outname; | |
8 open STDOUT, ">", shift; | |
9 open STDERR, ">", shift; | |
10 | |
11 my $open = ""; | |
12 my @files; | |
13 for(my $i = 0; @ARGV; $i++) { | |
14 my $fn = shift; | |
15 push @files, $fn; | |
16 $open .= qq(open IN$i, "<", "$fn";\n); | |
17 } | |
18 | |
19 my $script = join("", <SCR>); | |
20 | |
21 if($script =~ /(open)|(system)|(`.+`)|([$@%]ENV)/smg) { | |
22 printf(STDERR "Found vulnerable code (open, system, backticks) in given script."); | |
23 exit(1); | |
24 } | |
25 | |
26 eval("$open$script"); | |
27 | |
28 close SCR; | |
29 close OUT; |