App-Genpass-WordList

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "abstract" : "Generate password with words from WordList::*",
   "author" : [
      "perlancar <perlancar@cpan.org>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Generate password with words from WordList::*'
author:
  - 'perlancar <perlancar@cpan.org>'
build_requires:
  File::Spec: '0'
  IO::Handle: '0'
  IPC::Open3: '0'
  Test::More: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0

Makefile.PL  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.010.
use strict;
use warnings;

use 5.010001;

use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Generate password with words from WordList::*",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "App-Genpass-WordList",
  "EXE_FILES" => [
    "script/_genpass-wordlist",
    "script/genpass-wordlist"
  ],
  "LICENSE" => "perl",

README  view on Meta::CPAN

NAME
    App::Genpass::WordList - Generate password with words from WordList::*

VERSION
    This document describes version 0.002 of App::Genpass::WordList (from
    Perl distribution App-Genpass-WordList), released on 2018-01-02.

SYNOPSIS
    See the included script genpass-wordlist.

FUNCTIONS
  genpass
    Usage:

     genpass(%args) -> [status, msg, result, meta]

    Generate password with words from WordList::*.

    Using password from dictionary words (in this case, from WordList::*)
    can be useful for humans when remembering the password. Note that using
    a string of random characters is generally better because of the larger
    space (combination). Using a password of two random words from a
    5000-word wordlist has a space of only ~25 million while an 8-character
    of random uppercase letters/lowercase letters/numbers has a space of
    62^8 = ~218 trillion. To increase the space you'll need to use more
    words (e.g. 3 to 5 instead of just 2). This is important if you are
    using the password for something that can be bruteforced quickly e.g.
    for protecting on-disk ZIP/GnuPG file and the attacker has access to
    your file. It is then recommended to use a high number of rounds for
    hashing to slow down password cracking (e.g. "--s2k-count 65011712" in
    GnuPG).

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   num => *int* (default: 1)

    *   patterns => *array[str]* (default: ["%w %w %w","%w %w %w %w","%w %w
        %w %w %w","%w %w %w %w %w %w","%W%4d%W","%W%6d%s"])

lib/App/Genpass/WordList.pm  view on Meta::CPAN

    my ($pattern, $words) = @_;

    $pattern =~ s/(?<all>%(?:(?<N>\d+)(?:\$(?<M>\d+))?)?(?<CONV>[Wwds%]))/
        _fill_conversion({%+}, $words)/eg;

    $pattern;
}

$SPEC{genpass} = {
    v => 1.1,
    summary => 'Generate password with words from WordList::*',
    description => <<'_',

Using password from dictionary words (in this case, from WordList::*) can be
useful for humans when remembering the password. Note that using a string of
random characters is generally better because of the larger space (combination).
Using a password of two random words from a 5000-word wordlist has a space of
only ~25 million while an 8-character of random uppercase letters/lowercase
letters/numbers has a space of 62^8 = ~218 trillion. To increase the space
you'll need to use more words (e.g. 3 to 5 instead of just 2). This is important
if you are using the password for something that can be bruteforced quickly e.g.
for protecting on-disk ZIP/GnuPG file and the attacker has access to your file.
It is then recommended to use a high number of rounds for hashing to slow down
password cracking (e.g. `--s2k-count 65011712` in GnuPG).

_
    args => {
        num => {
            schema => ['int*', min=>1],
            default => 1,
            cmdline_aliases => {n=>{}},
        },
        %App::wordlist::arg_wordlists,
        %arg_patterns,

lib/App/Genpass/WordList.pm  view on Meta::CPAN

    my $wordlists = $args{wordlists} // ['EN::Enable'];
    my $patterns = $args{patterns} // $default_patterns;

    my $res = App::wordlist::wordlist(
        (wordlists => $wordlists) x !!defined($wordlists),
    );
    return $res unless $res->[0] == 200;

    my @words = shuffle @{ $res->[2] };

    my @passwords;
    for my $i (1..$num) {
        push @passwords,
            _fill_pattern($patterns->[rand @$patterns], \@words);
    }

    [200, "OK", \@passwords];
}

1;
# ABSTRACT: Generate password with words from WordList::*

__END__

=pod

=encoding UTF-8

=head1 NAME

App::Genpass::WordList - Generate password with words from WordList::*

=head1 VERSION

This document describes version 0.002 of App::Genpass::WordList (from Perl distribution App-Genpass-WordList), released on 2018-01-02.

=head1 SYNOPSIS

See the included script L<genpass-wordlist>.

=head1 FUNCTIONS


=head2 genpass

Usage:

 genpass(%args) -> [status, msg, result, meta]

Generate password with words from WordList::*.

Using password from dictionary words (in this case, from WordList::*) can be
useful for humans when remembering the password. Note that using a string of
random characters is generally better because of the larger space (combination).
Using a password of two random words from a 5000-word wordlist has a space of
only ~25 million while an 8-character of random uppercase letters/lowercase
letters/numbers has a space of 62^8 = ~218 trillion. To increase the space
you'll need to use more words (e.g. 3 to 5 instead of just 2). This is important
if you are using the password for something that can be bruteforced quickly e.g.
for protecting on-disk ZIP/GnuPG file and the attacker has access to your file.
It is then recommended to use a high number of rounds for hashing to slow down
password cracking (e.g. C<--s2k-count 65011712> in GnuPG).

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<num> => I<int> (default: 1)

=item * B<patterns> => I<array[str]> (default: ["%w %w %w","%w %w %w %w","%w %w %w %w %w","%w %w %w %w %w %w","%W%4d%W","%W%6d%s"])

script/_genpass-wordlist  view on Meta::CPAN

# ABSTRACT: Completer script for genpass-wordlist

use 5.010;
use strict;
use warnings;

die "Please run this script under shell completion\n" unless $ENV{COMP_LINE} || $ENV{COMMAND_LINE};

my $args = {program_name=>"genpass-wordlist",read_config=>0,read_env=>0,skip_format=>undef,subcommands=>undef,url=>"/App/Genpass/WordList/genpass"};

my $meta = {_orig_args_as=>undef,_orig_result_naked=>undef,args=>{num=>{cmdline_aliases=>{n=>{}},default=>1,schema=>["int",{min=>1,req=>1},{}]},patterns=>{cmdline_aliases=>{p=>{}},default=>["%w %w %w","%w %w %w %w","%w %w %w %w %w","%w %w %w %w %w %w...

my $sc_metas = {};

my $copts = {format=>{default=>undef,getopt=>"format=s",handler=>sub{package Perinci::CmdLine::Base;use warnings;use strict;no feature;use feature ':5.10';my($go, $val, $r) = @_;$$r{'format'} = $val},is_settable_via_config=>1,schema=>["str*","in",["t...

my $r = {};

# get words
my $shell;
my ($words, $cword);

script/_genpass-wordlist  view on Meta::CPAN

#                links => {},
#
#                schema => {},
#                filters => {},
#                default => {},
#                req => {},
#                pos => {},
#                greedy => {},
#                partial => {},
#                stream => {},
#                is_password => {},
#                cmdline_aliases => {
#                    _value_prop => {
#                        summary => {},
#                        description => {},
#                        schema => {},
#                        code => {},
#                        is_flag => {},
#                    },
#                },
#                cmdline_on_getopt => {},

script/_genpass-wordlist  view on Meta::CPAN

#                         default => {},
#                         default_lang => {},
#                         defhash_v => {},
#                         deps => { _keys => { all => {}, any => {}, arg => {}, none => {} } },
#                         description => {},
#                         element_completion => {},
#                         element_meta => { _prop => 'fix', _ver => 1.1, summary => "Rinci function metadata" },
#                         filters => {},
#                         greedy => {},
#                         index_completion => {},
#                         is_password => {},
#                         links => {},
#                         meta => 'fix',
#                         name => {},
#                         partial => {},
#                         pos => {},
#                         req => {},
#                         schema => {},
#                         stream => {},
#                         summary => {},
#                         tags => {},

script/genpass-wordlist  view on Meta::CPAN

#!perl

### code_after_shebang
# Note: This script is a CLI  for Riap function /App/Genpass/WordList/genpass
# and generated automatically using Perinci::CmdLine::Gen version 0.483

# PERICMD_INLINE_SCRIPT: {"code_after_shebang":"...","config_dirs":null,"config_filename":"genpass-wordlist.conf","env_name":"GENPASS_WORDLIST_OPT","include":null,"log":null,"pack_deps":1,"pod":0,"read_config":1,"read_env":1,"script_name":"genpass-wo...

my $_pci_metas = {""=>{args=>{num=>{cmdline_aliases=>{n=>{}},default=>1,schema=>["int",{min=>1,req=>1},{}]},patterns=>{cmdline_aliases=>{p=>{}},default=>["%w %w %w","%w %w %w %w","%w %w %w %w %w","%w %w %w %w %w %w","%W%4d%W","%W%6d%s"],description=>...

# This script is generated by Perinci::CmdLine::Inline version 0.541 on Tue Jan  2 11:22:14 2018.

# Rinci metadata taken from these modules: App::Genpass::WordList (no version)

# You probably should not manually edit this file.

our $DATE = '2018-01-02'; # DATE
our $VERSION = '0.002'; # VERSION
# PODNAME: genpass-wordlist
# ABSTRACT: Generate password with words from WordList::*

# BEGIN DATAPACK CODE
{
    my $toc;
    my $data_linepos = 1;
    unshift @INC, sub {
        $toc ||= do {

            my $fh = \*DATA;

script/genpass-wordlist  view on Meta::CPAN


### get arguments (from config file, env, command-line args

{
my %mentioned_args;
require Getopt::Long::EvenLess;
my $go_spec1 = {
    'config-path=s@' => sub { $_pci_r->{config_paths} //= []; push @{ $_pci_r->{config_paths} }, $_[1]; },
    'config-profile=s' => sub { $_pci_r->{config_profile} = $_[1]; },
    'format=s' => sub { $_pci_r->{format} = $_[1]; },
    'help|h|?' => sub { print "genpass-wordlist - Generate password with words from WordList::*\n\nUsage:\n  genpass-wordlist --help (or -h, -?)\n  genpass-wordlist --version (or -v)\n  genpass-wordlist [options]\n\nUsing password from dictionary wor...
    'json' => sub { $_pci_r->{format} = (-t STDOUT) ? "json-pretty" : "json"; },
    'naked-res' => sub { $_pci_r->{naked_res} = 1; },
    'no-config' => sub { $_pci_r->{read_config} = 0; },
    'no-env' => sub { $_pci_r->{read_env} = 0; },
    'no-naked-res|nonaked-res' => sub { $_pci_r->{naked_res} = 0; },
    'version|v' => sub { no warnings 'once'; require App::Genpass::WordList; print "genpass-wordlist version ", "0.002", ($App::Genpass::WordList::DATE ? " ($App::Genpass::WordList::DATE)" : ''), "\n"; print "  Generated by Perinci::CmdLine::Inline v...
};
my $go_spec2 = {
    'config-path=s@' => sub {  },
    'config-profile=s' => sub {  },

script/genpass-wordlist  view on Meta::CPAN

my $exit_code = $_pci_r->{res}[3]{"cmdline.exit_code"} // ($status =~ /200|304/ ? 0 : ($status-300));
exit($exit_code);
}

=pod

=encoding UTF-8

=head1 NAME

genpass-wordlist - Generate password with words from WordList::*

=head1 VERSION

This document describes version 0.002 of main (from Perl distribution App-Genpass-WordList), released on 2018-01-02.

=head1 SYNOPSIS

Usage:

 % genpass-wordlist [options]

=head1 DESCRIPTION

Using password from dictionary words (in this case, from WordList::*) can be
useful for humans when remembering the password. Note that using a string of
random characters is generally better because of the larger space (combination).
Using a password of two random words from a 5000-word wordlist has a space of
only ~25 million while an 8-character of random uppercase letters/lowercase
letters/numbers has a space of 62^8 = ~218 trillion. To increase the space
you'll need to use more words (e.g. 3 to 5 instead of just 2). This is important
if you are using the password for something that can be bruteforced quickly e.g.
for protecting on-disk ZIP/GnuPG file and the attacker has access to your file.
It is then recommended to use a high number of rounds for hashing to slow down
password cracking (e.g. C<--s2k-count 65011712> in GnuPG).

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--num>=I<s>, B<-n>

script/genpass-wordlist  view on Meta::CPAN

#                links => {},
#
#                schema => {},
#                filters => {},
#                default => {},
#                req => {},
#                pos => {},
#                greedy => {},
#                partial => {},
#                stream => {},
#                is_password => {},
#                cmdline_aliases => {
#                    _value_prop => {
#                        summary => {},
#                        description => {},
#                        schema => {},
#                        code => {},
#                        is_flag => {},
#                    },
#                },
#                cmdline_on_getopt => {},



( run in 0.743 second using v1.01-cache-2.11-cpan-49f99fa48dc )