#! perl # # this script makes a directory listing of all CGIs in its # home directory (where the script lives) and all subdirectories. # # "CGI"s are identified as having a .cgi, .pl or . filetype. # # warning: this can reveal scripts you'd rather have hidden! # # C. Lane lane@duphy4.physics.drexel.edu # $CRINOID::Reuse = 1; print "Content-type: text/html\n\n"; print "Directory of CGIs\n"; print "\n"; print "

Directory of CGIs

\n"; $where = substr($ENV{'SCRIPT_PATH'},length($ENV{'SCRIPT_PREFIX'})); $where =~ s#/$##; chdir($where); list('.',''); print "\n"; sub list { my $current = shift; my $subdir = shift; if ($subdir ne '') { chdir($subdir); $current .= '/'.$subdir; } my $prefix = $current.'/'; $prefix =~ s#^\.?/##; my @files = <*.*>; my $virgin = 1; foreach (@files) { if (/\.cgi$/i || /\.pl$/i || /\.$/) { if ($virgin) { print "\n" if (!$virgin); chdir('[-]'); }