#!/usr/local/bin/perl -T #you may need to adjust the above line (#!/usr/bin/perl is common) #----------------------------------------------------------------------------- # EZPass v1.1 (c) 2001-2002 Croesus Design and Promotion # Rev 11.25.2001-2002 # Developed by Jason C. Fleming # This program is distributed as open source WITHOUT ANY WARRANTY; without even # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # IN NO EVENT WILL CROESUS DESIGN, THE AUTHOR OF THIS PRODUCT OR ANY # REPRESENTATIVE OF CROESUS DESIGN BE LIABLE FOR LOSS OF DATA OR FOR # DIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL (INCLUDING LOST PROFIT), # OR OTHER DAMAGE, WHETHER BASED IN CONTRACT, TORT, OR OTHERWISE. #----------------------------------------------------------------------------- $| = 1; #flush output read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); #get form input @namevalues = split(/&/, $buffer); foreach $namevalue (@namevalues) { ($name, $value) = split(/=/, $namevalue); $name =~ tr/+/ /; $value =~ tr/+/ /; $name =~ s/%(..)/pack("C", hex($1))/eg; $value =~ s/%(..)/pack("C", hex($1))/eg; $value =~ s///g; #deletes SSI's in case html is returned $value =~ s/([:;<>\*\|`&\$!#\(\)\[\]\{\}'"])//g; # bleeps out html etc. $form{$name} = $value; } if ($form{path}) { if (substr($form{'path'},0,1) eq '/') {$form{'path'} = substr($form{'path'},1)} if (substr($form{'path'},-1) ne '/') {$form{'path'} .= '/'} } $program = $ENV{SCRIPT_NAME}; $root = $ENV{DOCUMENT_ROOT}; if ($form{'directory'}) { $form{'access'}=qq~AuthUserFile $root/$form{'path'}.htpasswd AuthGroupFile /dev/null AuthName "$form{'directory'}" AuthType Basic require valid-user ~; $form{'passwd'}="$form{'login'}:" . &Crypt($form{'password'}); } &OutputPage; sub OutputPage { print "Cache-Control: No-Cache\nContent-Type: text/html\n\n"; print qq~.htaccess Generator
EZ Pass
File Generator for .htaccess
by Croesus Design

Name of Protected Area (this can be anything)
Secret Directory (path to password file, relative to document root)
Ex: private/
Username
Password
.htaccess File Code
.htpasswd File Code



~; } sub Crypt { my $pass_code = shift(@_); my @chr = ('a'..'z'); my $s1= @chr[int(rand($#chr + 1))]; my $s2= @chr[int(rand($#chr + 1))]; my $salt = "$s1$s2"; my $crypt=crypt($pass_code,$salt); return $crypt; }