1' 2 3' To permit this cgi, replace ' on the first line above with the 4' appropriate shebang, f.e. '!c:/windows/system32/cscript -nologo 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'' 14'' printenv -- demo CGI program which just prints its environment 15'' 16Option Explicit 17 18Dim objShell, objArray, str, envvar, envval 19Set objShell = CreateObject("WScript.Shell") 20Set objArray = CreateObject("System.Collections.ArrayList") 21 22WScript.StdOut.WriteLine "Content-type: text/plain; charset=iso-8859-1" & vbLF 23For Each str In objShell.Environment("PROCESS") 24 objArray.Add str 25Next 26objArray.Sort() 27For Each str In objArray 28 envvar = Left(str, InStr(str, "=")) 29 envval = Replace(Mid(str, InStr(str, "=") + 1), vbLF, "\n") 30 WScript.StdOut.WriteLine envvar & Chr(34) & envval & Chr(34) 31Next 32 33