[BACK]Return to Hash.pm CVS log [TXT][DIR] Up to [local] / botnow

File: [local] / botnow / Hash.pm (download)

Revision 1.1, Sat May 15 15:12:32 2021 UTC (2 years, 11 months ago) by bountyht
Branch point for: MAIN

Initial revision

#!/usr/bin/perl

package Hash;

use strict;
use warnings;
use OpenBSD::Pledge;
use OpenBSD::Unveil;
use Data::Dumper;

my %conf = %main::conf;
my @words;
my $wordspath = "words";
my $passlength = $conf{passlength};
# dictionary words for passwords
@words = main::readarray("words");

sub init {
	unveil($wordspath, "r") or die "Unable to unveil $!";
}

sub newpass {
	my $len = scalar @words;
	my $pass;
	for (my $i=0; $i < $passlength; $i++) {
		my $word = $words[int(rand($len))];
		$word =~ s/(\w+)/\u$1/g;
		$pass .= $word;
	}
	return $pass;
}
#dependencies for blowfish
#unveil("./blowfish.o", "rx") or die "Unable to unveil $!";
#	} elsif ($reply =~ /^!identify\s*(.*)?\s+(.*)$/i) {
#		my $hash = getkeyval($hostmask, "password");
#		#print "result = ".`./blowfish.o $2 '$hash'`;
#		if(system("./blowfish.o $2 '$hash' > /dev/null")) {
#			print "login failed\r\n";
#		} else {
#			print "logged in\r\n";
#		}


1; # MUST BE LAST STATEMENT IN FILE