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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
| #!/usr/bin/perl
# ultra 31337 login voor .htaccess scriptje
# door Alain op 10-03-2002
# die al 3 jaar geen per meer heeft aangeraakt :)
# revisie 1
# vars
$file = "/etc/shadow";
$htpasswd = "/opt/domain/www.eendomeinnaampjeblaat.nl/.klantenpw";
#uitgesloten usernames
@uitgesloten =
('root','bin','daemon','adm','lp','sync','shutdown','halt','mail','news','uucp','operator','games','ftp','mysql','gdm','nobody','sys','man','proxy','majordom','postgres','backup','msql','list','irc','gnats','techni','inetd','telnetd','listar','identd','www-data');
# functies
# Haal de usernames uit de lijst die geen check nodig hebben
sub check {
local($username) = @_;
$return = "true";
$x = 0;
while ($uitgesloten[$x]) {
if ($uitgesloten[$x] eq $username) {
$return = "false";
}
$x++;
}
return "$return";
}
sub schrijfweg {
local($passline) = @_;
open (HT, ">>$htpasswd") || die print "het lukte niet om de file $file te openen...\n\n";
print HT "$passline\n";
close(HT);
}
# mainprog
# file ff leegmaken
open (HT, ">$htpasswd") || die print "het lukte niet om de file $file te openen...\n\n";
close(HT);
# file openen
open (PWD, "<$file") || die print "het lukte niet om de file $file te openen...\n\n";
# spul uit de file in een mooie array gooie...
@inhoud = <PWD>;
# zolang er nog wat in staat dan lusse we ff
while ($inhoud[$i]) {
# let's split
(@username[$i] , @password[$i]) = split (/:/, $inhoud[$i]);
if (&check($username[$i]) eq "true") {
&schrijfweg("$username[$i]:$password[$i]");
}
$i++;
}
exit(); |