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