36 lines
		
	
	
		
			787 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			36 lines
		
	
	
		
			787 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
								 | 
							
								#!/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";
							 | 
						||
| 
								 | 
							
									}
							 |