2 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl
use CGI::Carp 'fatalsToBrowser';
umask (011);
require 'cgi-lib.pl';
# Change this next line to the path to your words.txt
$unencrypted_pwords='/pfad/zur/textdatei.txt';
# Change this next line to the path to your .htpasswd file
$htpasswd_FILE = '/pfad/zur/passwortdatei.pwd';
# Alte Passwortdatei löschen
unlink ("$htpasswd_FILE");
# You shouldn't have to modify anything below this unless you know what you're doing.
$salt1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
print &PrintHeader;
open(PREAD,"<$unencrypted_pwords") ||&CgiError('Could not open unencrypted password file');
while (<PREAD>) {
chop $_;
($user,$pass) = split(/\:/,$_);
$words{$user}=$pass;
}
close (PREAD);
open(HTPASS,">>$htpasswd_FILE") || &error('Could not find specified file');
$number = 0;
foreach $key (keys %words) {
$salt = substr($salt1,rand(length($salt1)),1);
$salt .= substr($salt1,rand(length($salt1)),1);
$pass=$words{$key};
$encryptedpass = crypt ($pass,$salt);
print HTPASS "$key:$encryptedpass\n";
$words{$key}=$encryptedpass;
++$number;
}
close(HTPASS);
print "<p><strong>Fertig! $number Benutzernamen und Passwörter wurden in die Datei $htpasswd_FILE geschrieben.</strong><P>";
foreach $key (keys %words) {
print "$key : $words{$key}<BR>\n";
}
QuoteK1234:volk
VBO:sicherdas
QuoteK1234:0Z1krSG1cYjgc
VBO:kiBnHNG.L/JU6
2 Einträge, 1 Seite |