printenv.pl 847 B

123456789101112131415161718192021222324252627
  1. #
  2. # To permit this cgi, replace # on the first line above with the
  3. # appropriate #!/path/to/perl shebang, and on Unix / Linux also
  4. # set this script executable with chmod 755.
  5. #
  6. # ***** !!! WARNING !!! *****
  7. # This script echoes the server environment variables and therefore
  8. # leaks information - so NEVER use it in a live server environment!
  9. # It is provided only for testing purpose.
  10. # Also note that it is subject to cross site scripting attacks on
  11. # MS IE and any other browser which fails to honor RFC2616.
  12. ##
  13. ## printenv -- demo CGI program which just prints its environment
  14. ##
  15. use strict;
  16. use warnings;
  17. print "Content-type: text/plain; charset=iso-8859-1\n\n";
  18. foreach my $var (sort(keys(%ENV))) {
  19. my $val = $ENV{$var};
  20. $val =~ s|\n|\\n|g;
  21. $val =~ s|"|\\"|g;
  22. print "${var}=\"${val}\"\n";
  23. }