Skip to content

Instantly share code, notes, and snippets.

@mk-pmb
Last active August 15, 2023 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mk-pmb/b8a32f005d507ae07733c9ccbcd7340f to your computer and use it in GitHub Desktop.
Save mk-pmb/b8a32f005d507ae07733c9ccbcd7340f to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# -*- coding: UTF-8, tab-width: 2 -*-
# Origin: https://gist.github.com/mk-pmb/b8a32f005d507ae07733c9ccbcd7340f
# License: CC-0
use strict;
use warnings;
use Data::Dumper;
use HTML::Entities; # Not shipping in default Ubuntu :-(
print "Content-Type: text/html; charset=UTF-8\n\n";
$Data::Dumper::Terse = 1;
print "<pre>", encode_entities(Dumper(\%ENV)), "</pre>\n\n";
#!/bin/bash
# -*- coding: UTF-8, tab-width: 2 -*-
# Origin: https://gist.github.com/mk-pmb/b8a32f005d507ae07733c9ccbcd7340f
# License: CC-0
echo "Content-Type: text/html; charset=UTF-8"
echo
echo '<!DOCTYPE html>'
echo '<html><head>'
echo ' <meta charset="UTF-8">'
echo ' <title>apache-cgi-dumpenv</title>'
echo '</head><body>'
echo '<pre>'
env | sort -V | LANG=C sed -re '
s~&~\&amp;~g
s~<~\&lt;~g
s~>~\&gt;~g
s~"~\&quot;~g
'
echo '</pre>'
echo
echo '<h4>JavaScript:</h4>'
echo '<dl>'
for V in navigator.{appName,userAgent} document.{URL,cookie}; do
echo -n " <dt>$V:</dt><dd><script" 'type="text/javascript">'
echo "document.write($V || '–');</script></dd>"
done
echo '</dl>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment