capitannemo

whoami.pl

Nov 4th, 2012
741
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/perl/bin/perl
  2.  
  3. sub indentPrintln($$) {
  4. my($level, $text) = @_;
  5.  
  6. for (my $i = 0; $i < $level; $i++) {
  7. print(" ");
  8. }
  9.  
  10. print("$text\n");
  11. }
  12.  
  13. @pieces = split(/\\/, $ENV{'REMOTE_USER'});
  14. $DOMAIN = $pieces[0];
  15. $USER = $pieces[1];
  16.  
  17. $SERVER = $ENV{'SERVER_NAME'};
  18.  
  19. print("Content-type: text/html\r\n");
  20. print("\r\n");
  21.  
  22. indentPrintln(0, "<HTML>");
  23. indentPrintln(1, "<HEAD>");
  24. indentPrintln(2, "<TITLE>whoami at $SERVER</TITLE>");
  25. indentPrintln(1, "</HEAD>");
  26. indentPrintln(1, "<BODY>");
  27. indentPrintln(2, "<FONT FACE=\"Verdana\" SIZE=-1>");
  28. indentPrintln(3, "You appear to be user <B>$USER</B>, ");
  29. indentPrintln(3, "logged into the Windows NT domain <B>$DOMAIN</B>.");
  30. indentPrintln(2, "</FONT>");
  31. indentPrintln(1, "</BODY>");
  32. indentPrintln(0, "</HTML>");
RAW Paste Data