initial commit of file from CVS for smeserver-dirty-tools on Sat Sep 7 20:17:20 AEST 2024
This commit is contained in:
35
root/sbin/e-smith/dt-pw-generate
Executable file
35
root/sbin/e-smith/dt-pw-generate
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# (C) 2005-2008 Michael Weinberger
|
||||
# See http://wiki.contribs.org/Dirty_Tools for full documentation
|
||||
|
||||
use strict;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::FormMagick;
|
||||
use esmith::PasswordTools;
|
||||
use Getopt::Long;
|
||||
|
||||
my %opts;
|
||||
my $getRes = GetOptions(
|
||||
"number=s"=>\$opts{'number'},
|
||||
"length=s"=>\$opts{'length'},
|
||||
"mixed-case"=>\$opts{'mixed-case'},
|
||||
"add-consonants"=>\$opts{'add-consonants'},
|
||||
"help"=>\$opts{'help'},
|
||||
);
|
||||
|
||||
if( $opts{'help'} )
|
||||
{
|
||||
print "Usage: dt-pw-generate [--length=N] [--mixed-case] [--add-consonants]\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
for(my $i=0; $i<($opts{'number'}?$opts{'number'}:1); $i++)
|
||||
{
|
||||
my $pw=sme_generate_password(
|
||||
$opts{'length'} ? $opts{'length'} : 8,
|
||||
$opts{'add-consonants'} ? 'yes' : 'no',
|
||||
$opts{'mixed-case'} ? 'yes' : 'no',
|
||||
);
|
||||
print "$pw\n";
|
||||
}
|
Reference in New Issue
Block a user