Blame
Date:
Sun Oct 8 22:28:02 2023 UTC
Message:
Now prevents creating accounts that exist in database with a password
01
2021-12-17
jrmu
#!/usr/bin/perl
02
2021-12-17
jrmu
03
2021-12-17
jrmu
package Hash;
04
2021-12-17
jrmu
05
2021-12-17
jrmu
use strict;
06
2021-12-17
jrmu
use warnings;
07
2021-12-17
jrmu
use OpenBSD::Pledge;
08
2021-12-17
jrmu
use OpenBSD::Unveil;
09
2021-12-17
jrmu
use Data::Dumper;
10
2021-12-17
jrmu
11
2021-12-17
jrmu
my %conf = %main::conf;
12
2021-12-17
jrmu
my @words;
13
2021-12-17
jrmu
my $wordspath = "words";
14
2021-12-17
jrmu
my $passlength = $conf{passlength};
15
2021-12-17
jrmu
# dictionary words for passwords
16
2021-12-17
jrmu
@words = main::readarray("words");
17
2021-12-17
jrmu
18
2021-12-17
jrmu
sub init {
19
2021-12-17
jrmu
unveil($wordspath, "r") or die "Unable to unveil $!";
20
2021-12-17
jrmu
}
21
2021-12-17
jrmu
22
2021-12-17
jrmu
sub newpass {
23
2021-12-17
jrmu
my $len = scalar @words;
24
2021-12-17
jrmu
my $pass;
25
2021-12-17
jrmu
for (my $i=0; $i < $passlength; $i++) {
26
2021-12-17
jrmu
my $word = $words[int(rand($len))];
27
2021-12-17
jrmu
$word =~ s/(\w+)/\u$1/g;
28
2021-12-17
jrmu
$pass .= $word;
29
2021-12-17
jrmu
}
30
2021-12-17
jrmu
return $pass;
31
2021-12-17
jrmu
}
32
2021-12-17
jrmu
#dependencies for blowfish
33
2021-12-17
jrmu
#unveil("./blowfish.o", "rx") or die "Unable to unveil $!";
34
2021-12-17
jrmu
# } elsif ($reply =~ /^!identify\s*(.*)?\s+(.*)$/i) {
35
2021-12-17
jrmu
# my $hash = getkeyval($hostmask, "password");
36
2021-12-17
jrmu
# #print "result = ".`./blowfish.o $2 '$hash'`;
37
2021-12-17
jrmu
# if(system("./blowfish.o $2 '$hash' > /dev/null")) {
38
2021-12-17
jrmu
# print "login failed\r\n";
39
2021-12-17
jrmu
# } else {
40
2021-12-17
jrmu
# print "logged in\r\n";
41
2021-12-17
jrmu
# }
42
2021-12-17
jrmu
43
2021-12-17
jrmu
44
2021-12-17
jrmu
1; # MUST BE LAST STATEMENT IN FILE
IRCNow