Blob


1 #!/usr/bin/perl
3 package Hash;
5 use strict;
6 use warnings;
7 use OpenBSD::Pledge;
8 use OpenBSD::Unveil;
9 use Data::Dumper;
11 my %conf = %main::conf;
12 my @words;
13 my $wordspath = "words";
14 my $passlength = $conf{passlength};
15 # dictionary words for passwords
16 @words = main::readarray("words");
18 sub init {
19 unveil($wordspath, "r") or die "Unable to unveil $!";
20 }
22 sub newpass {
23 my $len = scalar @words;
24 my $pass;
25 for (my $i=0; $i < $passlength; $i++) {
26 my $word = $words[int(rand($len))];
27 $word =~ s/(\w+)/\u$1/g;
28 $pass .= $word;
29 }
30 return $pass;
31 }
32 #dependencies for blowfish
33 #unveil("./blowfish.o", "rx") or die "Unable to unveil $!";
34 # } elsif ($reply =~ /^!identify\s*(.*)?\s+(.*)$/i) {
35 # my $hash = getkeyval($hostmask, "password");
36 # #print "result = ".`./blowfish.o $2 '$hash'`;
37 # if(system("./blowfish.o $2 '$hash' > /dev/null")) {
38 # print "login failed\r\n";
39 # } else {
40 # print "logged in\r\n";
41 # }
44 1; # MUST BE LAST STATEMENT IN FILE