local $0 = basename($0);
# Parse the argument list.
-my ($ascii, $min_length, $manual);
+my ($ascii, $max_length, $min_length, $manual);
Getopt::Long::config('bundling', 'no_ignore_case');
GetOptions(
'ascii|a' => \$ascii,
+ 'max-length|L=i' => \$max_length,
'min-length|l=i' => \$min_length,
'manual|man|m' => \$manual
);
chomp($word);
my $length = length($word);
next if (defined($min_length) && $length < $min_length);
+ next if (defined($max_length) && $length > $max_length);
if ($ascii) {
next if $word =~ m{ [^[:ascii:]] }xms;
next if $word =~ m{ [[:cntrl:]] }xms;
=head1 SYNOPSIS
-B<cdbmake-wordlist> [B<-am>] [B<-l> I<length>] I<wordlist>
+B<cdbmake-wordlist> [B<-am>] [B<-l> I<min-length>] [B<-L> I<max-length>]
+ I<wordlist>
=head1 DESCRIPTION
from the resulting cdb file, leaving only words that consist solely of
ASCII non-control characters.
+=item B<-L> I<maximum>, B<--max-length>=I<maximum>
+
+Filter all words of length greater than I<maximum> from the resulting cdb
+database. The length of each line (minus the separating newline) in the
+input wordlist will be checked against I<minimum> and will be filtered out
+of the resulting database if it is shorter. Useful for generating
+password dictionaries from word lists that contain random noise that's
+highly unlikely to be used as a password.
+
+The default is to not filter out any words for maximum length.
+
=item B<-l> I<minimum>, B<--min-length>=I<minimum>
Filter all words of length less than I<minimum> from the resulting cdb