wordlist 0.1.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +28 -0
  3. data/.gitignore +6 -3
  4. data/ChangeLog.md +55 -1
  5. data/Gemfile +15 -0
  6. data/LICENSE.txt +1 -3
  7. data/README.md +301 -60
  8. data/Rakefile +7 -32
  9. data/benchmarks.rb +115 -0
  10. data/bin/wordlist +4 -7
  11. data/data/stop_words/ar.txt +104 -0
  12. data/data/stop_words/bg.txt +259 -0
  13. data/data/stop_words/bn.txt +363 -0
  14. data/data/stop_words/ca.txt +126 -0
  15. data/data/stop_words/cs.txt +138 -0
  16. data/data/stop_words/da.txt +101 -0
  17. data/data/stop_words/de.txt +129 -0
  18. data/data/stop_words/el.txt +79 -0
  19. data/data/stop_words/en.txt +175 -0
  20. data/data/stop_words/es.txt +178 -0
  21. data/data/stop_words/eu.txt +98 -0
  22. data/data/stop_words/fa.txt +332 -0
  23. data/data/stop_words/fi.txt +747 -0
  24. data/data/stop_words/fr.txt +116 -0
  25. data/data/stop_words/ga.txt +109 -0
  26. data/data/stop_words/gl.txt +160 -0
  27. data/data/stop_words/he.txt +499 -0
  28. data/data/stop_words/hi.txt +97 -0
  29. data/data/stop_words/hr.txt +179 -0
  30. data/data/stop_words/hu.txt +35 -0
  31. data/data/stop_words/hy.txt +45 -0
  32. data/data/stop_words/id.txt +357 -0
  33. data/data/stop_words/it.txt +134 -0
  34. data/data/stop_words/ja.txt +44 -0
  35. data/data/stop_words/ko.txt +677 -0
  36. data/data/stop_words/ku.txt +63 -0
  37. data/data/stop_words/lt.txt +507 -0
  38. data/data/stop_words/lv.txt +163 -0
  39. data/data/stop_words/mr.txt +99 -0
  40. data/data/stop_words/nl.txt +48 -0
  41. data/data/stop_words/no.txt +172 -0
  42. data/data/stop_words/pl.txt +138 -0
  43. data/data/stop_words/pt.txt +147 -0
  44. data/data/stop_words/ro.txt +281 -0
  45. data/data/stop_words/ru.txt +421 -0
  46. data/data/stop_words/sk.txt +173 -0
  47. data/data/stop_words/sv.txt +386 -0
  48. data/data/stop_words/th.txt +115 -0
  49. data/data/stop_words/tr.txt +114 -0
  50. data/data/stop_words/uk.txt +28 -0
  51. data/data/stop_words/ur.txt +513 -0
  52. data/data/stop_words/zh.txt +125 -0
  53. data/gemspec.yml +13 -12
  54. data/lib/wordlist/abstract_wordlist.rb +25 -0
  55. data/lib/wordlist/builder.rb +172 -138
  56. data/lib/wordlist/cli.rb +459 -0
  57. data/lib/wordlist/compression/reader.rb +72 -0
  58. data/lib/wordlist/compression/writer.rb +80 -0
  59. data/lib/wordlist/exceptions.rb +31 -0
  60. data/lib/wordlist/file.rb +177 -0
  61. data/lib/wordlist/format.rb +39 -0
  62. data/lib/wordlist/lexer/lang.rb +34 -0
  63. data/lib/wordlist/lexer/stop_words.rb +69 -0
  64. data/lib/wordlist/lexer.rb +221 -0
  65. data/lib/wordlist/list_methods.rb +462 -0
  66. data/lib/wordlist/modifiers/capitalize.rb +46 -0
  67. data/lib/wordlist/modifiers/downcase.rb +46 -0
  68. data/lib/wordlist/modifiers/gsub.rb +52 -0
  69. data/lib/wordlist/modifiers/modifier.rb +44 -0
  70. data/lib/wordlist/modifiers/mutate.rb +134 -0
  71. data/lib/wordlist/modifiers/mutate_case.rb +26 -0
  72. data/lib/wordlist/modifiers/sub.rb +98 -0
  73. data/lib/wordlist/modifiers/tr.rb +72 -0
  74. data/lib/wordlist/modifiers/upcase.rb +46 -0
  75. data/lib/wordlist/modifiers.rb +9 -0
  76. data/lib/wordlist/operators/binary_operator.rb +39 -0
  77. data/lib/wordlist/operators/concat.rb +48 -0
  78. data/lib/wordlist/operators/intersect.rb +56 -0
  79. data/lib/wordlist/operators/operator.rb +29 -0
  80. data/lib/wordlist/operators/power.rb +73 -0
  81. data/lib/wordlist/operators/product.rb +51 -0
  82. data/lib/wordlist/operators/subtract.rb +55 -0
  83. data/lib/wordlist/operators/unary_operator.rb +30 -0
  84. data/lib/wordlist/operators/union.rb +62 -0
  85. data/lib/wordlist/operators/unique.rb +53 -0
  86. data/lib/wordlist/operators.rb +8 -0
  87. data/lib/wordlist/unique_filter.rb +41 -61
  88. data/lib/wordlist/version.rb +4 -2
  89. data/lib/wordlist/words.rb +72 -0
  90. data/lib/wordlist.rb +104 -2
  91. data/spec/abstract_list_spec.rb +18 -0
  92. data/spec/builder_spec.rb +220 -76
  93. data/spec/cli_spec.rb +802 -0
  94. data/spec/compression/reader_spec.rb +137 -0
  95. data/spec/compression/writer_spec.rb +194 -0
  96. data/spec/file_spec.rb +269 -0
  97. data/spec/fixtures/wordlist.txt +15 -0
  98. data/spec/fixtures/wordlist.txt.bz2 +0 -0
  99. data/spec/fixtures/wordlist.txt.gz +0 -0
  100. data/spec/fixtures/wordlist.txt.xz +0 -0
  101. data/spec/fixtures/wordlist_with_ambiguous_format +3 -0
  102. data/spec/fixtures/wordlist_with_comments.txt +19 -0
  103. data/spec/fixtures/wordlist_with_empty_lines.txt +19 -0
  104. data/spec/format_spec.rb +50 -0
  105. data/spec/helpers/text.rb +3 -3
  106. data/spec/helpers/wordlist.rb +2 -2
  107. data/spec/lexer/lang_spec.rb +70 -0
  108. data/spec/lexer/stop_words_spec.rb +77 -0
  109. data/spec/lexer_spec.rb +718 -0
  110. data/spec/list_methods_spec.rb +181 -0
  111. data/spec/modifiers/capitalize_spec.rb +27 -0
  112. data/spec/modifiers/downcase_spec.rb +27 -0
  113. data/spec/modifiers/gsub_spec.rb +59 -0
  114. data/spec/modifiers/modifier_spec.rb +20 -0
  115. data/spec/modifiers/mutate_case_spec.rb +46 -0
  116. data/spec/modifiers/mutate_spec.rb +39 -0
  117. data/spec/modifiers/sub_spec.rb +98 -0
  118. data/spec/modifiers/tr_spec.rb +46 -0
  119. data/spec/modifiers/upcase_spec.rb +27 -0
  120. data/spec/operators/binary_operator_spec.rb +19 -0
  121. data/spec/operators/concat_spec.rb +26 -0
  122. data/spec/operators/intersect_spec.rb +37 -0
  123. data/spec/operators/operator_spec.rb +16 -0
  124. data/spec/operators/power_spec.rb +57 -0
  125. data/spec/operators/product_spec.rb +39 -0
  126. data/spec/operators/subtract_spec.rb +37 -0
  127. data/spec/operators/unary_operator_spec.rb +14 -0
  128. data/spec/operators/union_spec.rb +37 -0
  129. data/spec/operators/unique_spec.rb +25 -0
  130. data/spec/spec_helper.rb +2 -1
  131. data/spec/unique_filter_spec.rb +108 -18
  132. data/spec/wordlist_spec.rb +55 -3
  133. data/spec/words_spec.rb +41 -0
  134. data/wordlist.gemspec +1 -0
  135. metadata +164 -126
  136. data/lib/wordlist/builders/website.rb +0 -216
  137. data/lib/wordlist/builders.rb +0 -1
  138. data/lib/wordlist/flat_file.rb +0 -47
  139. data/lib/wordlist/list.rb +0 -162
  140. data/lib/wordlist/mutator.rb +0 -113
  141. data/lib/wordlist/parsers.rb +0 -74
  142. data/lib/wordlist/runners/list.rb +0 -116
  143. data/lib/wordlist/runners/runner.rb +0 -67
  144. data/lib/wordlist/runners.rb +0 -2
  145. data/scripts/benchmark +0 -59
  146. data/scripts/text/comedy_of_errors.txt +0 -4011
  147. data/spec/classes/parser_class.rb +0 -7
  148. data/spec/classes/test_list.rb +0 -9
  149. data/spec/flat_file_spec.rb +0 -25
  150. data/spec/list_spec.rb +0 -58
  151. data/spec/mutator_spec.rb +0 -43
  152. data/spec/parsers_spec.rb +0 -118
data/lib/wordlist/list.rb DELETED
@@ -1,162 +0,0 @@
1
- require 'wordlist/unique_filter'
2
- require 'wordlist/mutator'
3
-
4
- module Wordlist
5
- class List
6
-
7
- include Enumerable
8
-
9
- # Maximum length of words
10
- attr_accessor :max_length
11
-
12
- # Minimum length of words
13
- attr_accessor :min_length
14
-
15
- #
16
- # Creates a new List object.
17
- #
18
- # @param [Hash] options
19
- # Additional options.
20
- #
21
- # @option options [Integer] :max_length
22
- # The maximum length of words produced by the list.
23
- #
24
- # @option options [Integer] :min_length
25
- # The minimum length of words produced by the list.
26
- #
27
- # @yield [list]
28
- # If a block is given, it will be passed the new list object.
29
- #
30
- # @yieldparam [List] list
31
- # The new list object.
32
- #
33
- def initialize(options={})
34
- @mutators = []
35
-
36
- @max_length = options[:max_length]
37
- @min_length = options.fetch(:min_length,0)
38
-
39
- yield self if block_given?
40
- end
41
-
42
- #
43
- # Adds a mutation rule for the specified pattern, to be replaced
44
- # using the specified substitute.
45
- #
46
- # @param [String, Regexp] pattern
47
- # The pattern to recognize text to mutate.
48
- #
49
- # @param [String, Integer, nil] substitute
50
- # The optional text to replace recognized text.
51
- #
52
- # @yield [match]
53
- # If a block is given, it will be passed the recognized text to be
54
- # mutated. The return value of the block will be used to replace
55
- # the recognized text.
56
- #
57
- # @yieldparam [String] match
58
- # The recognized text to be mutated.
59
- #
60
- # @example
61
- # list.mutate 'o', '0'
62
- #
63
- # list.mutate '0', 0x41
64
- #
65
- # list.mutate(/[oO]/) do |match|
66
- # match.swapcase
67
- # end
68
- #
69
- def mutate(pattern,substitute=nil,&block)
70
- @mutators << Mutator.new(pattern,substitute,&block)
71
- end
72
-
73
- #
74
- # Enumerate through every word in the list.
75
- #
76
- # @yield [word]
77
- # The given block will be passed each word in the list.
78
- #
79
- # @yieldparam [String] word
80
- # A word from the list.
81
- #
82
- # @example
83
- # list.each_word do |word|
84
- # puts word
85
- # end
86
- #
87
- def each_word(&block)
88
- end
89
-
90
- #
91
- # Enumerates through every unique word in the list.
92
- #
93
- # @yield [word]
94
- # The given block will be passed each unique word in the list.
95
- #
96
- # @yieldparam [String] word
97
- # A unique word from the list.
98
- #
99
- # @example
100
- # list.each_unique do |word|
101
- # puts word
102
- # end
103
- #
104
- def each_unique
105
- unique_filter = UniqueFilter.new()
106
-
107
- each_word do |word|
108
- if unique_filter.saw!(word)
109
- yield word
110
- end
111
- end
112
-
113
- unique_filter = nil
114
- end
115
-
116
- #
117
- # Enumerates through every unique mutation, of every unique word, using
118
- # the mutator rules define for the list.
119
- #
120
- # @yield [word]
121
- # The given block will be passed every mutation of every unique
122
- # word in the list.
123
- #
124
- # @yieldparam [String] word
125
- # A mutation of a unique word from the list.
126
- #
127
- # @example
128
- # list.each_mutation do |word|
129
- # puts word
130
- # end
131
- #
132
- def each_mutation(&block)
133
- mutation_filter = UniqueFilter.new()
134
-
135
- mutator_stack = [lambda { |mutated_word|
136
- # skip words shorter than the minimum length
137
- next if mutated_word.length < @min_length
138
-
139
- # truncate words longer than the maximum length
140
- mutated_word = mutated_word[0,@max_length] if @max_length
141
-
142
- if mutation_filter.saw!(mutated_word)
143
- yield mutated_word
144
- end
145
- }]
146
-
147
- (@mutators.length-1).downto(0) do |index|
148
- mutator_stack.unshift(lambda { |word|
149
- prev_mutator = @mutators[index]
150
- next_mutator = mutator_stack[index+1]
151
-
152
- prev_mutator.each(word,&next_mutator)
153
- })
154
- end
155
-
156
- each_unique(&(mutator_stack.first))
157
- end
158
-
159
- alias each each_mutation
160
-
161
- end
162
- end
@@ -1,113 +0,0 @@
1
- module Wordlist
2
- class Mutator
3
-
4
- include Enumerable
5
-
6
- # The pattern to match
7
- attr_accessor :pattern
8
-
9
- # The data to substitute matched text with
10
- attr_accessor :substitute
11
-
12
- #
13
- # Creates a new Mutator object.
14
- #
15
- # @param [String, Regexp] pattern
16
- # The pattern which recognizes text to mutate.
17
- #
18
- # @param [String, Integer] substitute
19
- # The optional text to replace recognized text.
20
- #
21
- # @yield [match]
22
- # If a block is given, it will be used to mutate recognized text.
23
- #
24
- # @yieldparam [String] match
25
- # The match text to mutate.
26
- #
27
- def initialize(pattern,substitute=nil,&block)
28
- @pattern = pattern
29
- @substitute = (substitute || block)
30
- end
31
-
32
- #
33
- # Mutates the given text.
34
- #
35
- # @param [String] matched
36
- # The recognized text to be mutated.
37
- #
38
- # @return [String]
39
- # The mutated text.
40
- #
41
- def replace(matched)
42
- result = if @substitute.kind_of?(Proc)
43
- @substitute.call(matched)
44
- else
45
- @substitute
46
- end
47
-
48
- result = if result.kind_of?(Integer)
49
- result.chr
50
- else
51
- result.to_s
52
- end
53
-
54
- return result
55
- end
56
-
57
- #
58
- # Enumerates over every possible mutation of the given word.
59
- #
60
- # @param [String] word
61
- # The word to mutate.
62
- #
63
- # @yield [mutation]
64
- # The given block will be passed every possible mutation of the
65
- # given word.
66
- #
67
- # @yieldparam [String] mutation
68
- # One possible mutation of the given word.
69
- #
70
- # @return [String]
71
- # The original word.
72
- #
73
- def each(word)
74
- choices = 0
75
-
76
- # first iteration
77
- yield(word.gsub(@pattern) { |matched|
78
- # determine how many possible choices there are
79
- choices = ((choices << 1) | 0x1)
80
-
81
- replace(matched)
82
- })
83
-
84
- (choices - 1).downto(0) do |iteration|
85
- bits = iteration
86
-
87
- yield(word.gsub(@pattern) { |matched|
88
- result = if ((bits & 0x1) == 0x1)
89
- replace(matched)
90
- else
91
- matched
92
- end
93
-
94
- bits >>= 1
95
- result
96
- })
97
- end
98
-
99
- return word
100
- end
101
-
102
- #
103
- # Inspects the mutator.
104
- #
105
- # @return [String]
106
- # The inspected mutator.
107
- #
108
- def inspect
109
- "#{@pattern.inspect} -> #{@substitute.inspect}"
110
- end
111
-
112
- end
113
- end
@@ -1,74 +0,0 @@
1
- module Wordlist
2
- module Parsers
3
- # Ignore case of parsed text
4
- attr_accessor :ignore_case
5
-
6
- # Ignore the punctuation of parsed text
7
- attr_accessor :ignore_punctuation
8
-
9
- # Ignore URLs
10
- attr_accessor :ignore_urls
11
-
12
- # Ignore Phone numbers
13
- attr_accessor :ignore_phone_numbers
14
-
15
- # Ignore References
16
- attr_accessor :ignore_references
17
-
18
- #
19
- # Initializes the parsers settings.
20
- #
21
- def initialize
22
- @ignore_case = false
23
- @ignore_punctuation = true
24
- @ignore_urls = true
25
- @ignore_phone_numbers = false
26
- @ignore_references = false
27
- end
28
-
29
- #
30
- # Parses the given text.
31
- #
32
- # @param [String] text
33
- # The text to parse.
34
- #
35
- # @return [Array<String>]
36
- # The Array of parsed tokens.
37
- #
38
- def parse(text)
39
- text = text.to_s
40
-
41
- if @ignore_punctuation
42
- # eat tailing punctuation
43
- text.gsub!(/[\.\?!]*$/,'')
44
- end
45
-
46
- if @ignore_case
47
- # downcase the sentence
48
- text.downcase!
49
- end
50
-
51
- if @ignore_urls
52
- text.gsub!(/\s*\w+:\/\/[\w\/\+_\-,:%\d\.\-\?&=]*\s*/,' ')
53
- end
54
-
55
- if @ignore_phone_numbers
56
- # remove phone numbers
57
- text.gsub!(/\s*(\d-)?(\d{3}-)?\d{3}-\d{4}\s*/,' ')
58
- end
59
-
60
- if @ignore_references
61
- # remove RFC style references
62
- text.gsub!(/\s*[\(\{\[]\d+[\)\}\]]\s*/,' ')
63
- end
64
-
65
- if @ignore_punctuation
66
- # split and ignore punctuation characters
67
- return text.scan(/\w+[\-_\.:']\w+|\w+/)
68
- else
69
- # split and accept punctuation characters
70
- return text.scan(/[\w\-_,:;\.\?\!'"\\\/]+/)
71
- end
72
- end
73
- end
74
- end
@@ -1,116 +0,0 @@
1
- require 'wordlist/runners/runner'
2
- require 'wordlist/flat_file'
3
-
4
- module Wordlist
5
- module Runners
6
- class List < Runner
7
-
8
- #
9
- # Creates a new List Runner.
10
- #
11
- def initialize
12
- @file = nil
13
- @min_length = nil
14
- @max_length = nil
15
- @mutations = []
16
-
17
- @words = false
18
- @unique_words = false
19
-
20
- @output = nil
21
- end
22
-
23
- #
24
- # Runs the list runner.
25
- #
26
- # @param [Array<String>] args
27
- # Arguments to run the runner with.
28
- #
29
- def run(*args)
30
- super(*args)
31
-
32
- list = if @file
33
- FlatFile.new(
34
- @file,
35
- :min_length => @min_length,
36
- :max_length => @max_length
37
- )
38
- else
39
- print_error('the --file option must be specified')
40
- exit -1
41
- end
42
-
43
- @mutations.each do |pattern,substitute|
44
- list.mutate(pattern,substitute)
45
- end
46
-
47
- words = lambda { |output|
48
- puts = output.method(:puts)
49
-
50
- if @unique_words
51
- list.each_unique(&puts)
52
- elsif @words
53
- list.each_word(&puts)
54
- else
55
- list.each(&puts)
56
- end
57
- }
58
-
59
- if @output
60
- File.open(@output,'w+',&words)
61
- else
62
- words.call(Kernel)
63
- end
64
- end
65
-
66
- protected
67
-
68
- #
69
- # Parses the given arguments.
70
- #
71
- # @param [Array<String>] args
72
- # Arguments to parse.
73
- #
74
- def optparse(*args)
75
- super(*args) do |opts|
76
- opts.banner = 'usage: wordlist [options]'
77
-
78
- opts.on('-f','--file FILE','The wordlist file to list') do |file|
79
- @file = file
80
- end
81
-
82
- opts.on('--min-length NUM','Minimum length of words in characters') do |min|
83
- @min_length = min
84
- end
85
-
86
- opts.on('--max-length NUM','Maximum length of words in characters') do |max|
87
- @max_length = max
88
- end
89
-
90
- opts.on('-m','--mutate SUBSTRING::REPLACE','Adds a mutation rule') do |substring_and_replace|
91
- @mutations << substring_and_replace.split('::',2)
92
- end
93
-
94
- opts.on('-M','--mutate-pattern PATTERN::REPLACE','Adds a mutation rule') do |pattern_and_replace|
95
- pattern, replace = substring_and_replace.split('::',2)
96
-
97
- @mutations << [Regexp.new(pattern), replace]
98
- end
99
-
100
- opts.on('-w','--words','Only print the words in the wordlist') do
101
- @words = true
102
- end
103
-
104
- opts.on('-u','--unique','Only print the unique words in the wordlist') do
105
- @unique_words = true
106
- end
107
-
108
- opts.on('-o','--output FILE','Optional file to output the wordlist to') do |file|
109
- @output = File.expand_path(file)
110
- end
111
- end
112
- end
113
-
114
- end
115
- end
116
- end
@@ -1,67 +0,0 @@
1
- require 'optparse'
2
-
3
- module Wordlist
4
- module Runners
5
- class Runner
6
- #
7
- # Creates and runs the runner with the given arguments.
8
- #
9
- # @param [Array<String>] args
10
- # Arguments to parse.
11
- #
12
- def self.run(*args)
13
- runner = new()
14
- runner.run(*args)
15
- end
16
-
17
- #
18
- # Runs the runner with the given arguments.
19
- #
20
- # @param [Array<String>] args
21
- # Arguments to run the runner with.
22
- #
23
- def run(*args)
24
- optparse(*args)
25
- end
26
-
27
- protected
28
-
29
- #
30
- # Prints the given error message.
31
- #
32
- # @param [String] message
33
- # The error message to print.
34
- #
35
- def print_error(message)
36
- $stderr.puts "#{$0}: #{message}"
37
- end
38
-
39
- #
40
- # Parses the given arguments.
41
- #
42
- # @param [Array<String>] args
43
- # Arguments to parse.
44
- #
45
- # @yield [opts]
46
- # If a block is given, it will be passed the option parse to be
47
- # configured.
48
- #
49
- # @yieldparam [OptionParser] opts
50
- # The option parser to be configured.
51
- #
52
- def optparse(*args)
53
- opts = OptionParser.new()
54
-
55
- yield opts if block_given?
56
-
57
- begin
58
- opts.parse!(args)
59
- rescue OptionParser::InvalidOption => e
60
- $stderr.puts e.message
61
- $stderr.puts opts
62
- exit -1
63
- end
64
- end
65
- end
66
- end
67
- end
@@ -1,2 +0,0 @@
1
- require 'wordlist/runners/runner'
2
- require 'wordlist/runners/list'
data/scripts/benchmark DELETED
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','lib')))
3
-
4
- require 'wordlist'
5
- require 'benchmark'
6
- require 'fileutils'
7
-
8
- path = File.expand_path(File.join(File.dirname(__FILE__),'shakespeare_wordlist.txt'))
9
-
10
- FileUtils.rm_f(path)
11
-
12
- Benchmark.bm do |bm|
13
- bm.report('build') do
14
- Wordlist::Builder.build(path) do |wordlist|
15
- wordlist.parse_file('/home/hal/shaks12.txt')
16
- end
17
- end
18
-
19
- bm.report('each_unique') do
20
- Wordlist::FlatFile.new(path) do |wordlist|
21
- wordlist.each_unique { |word| word }
22
- end
23
- end
24
-
25
- bm.report('each_mutation (1)') do
26
- Wordlist::FlatFile.new(path) do |wordlist|
27
- wordlist.mutate /o/i, '0'
28
-
29
- wordlist.each_mutation { |word| word }
30
- end
31
- end
32
-
33
- bm.report('each_mutation (2)') do
34
- Wordlist::FlatFile.new(path) do |wordlist|
35
- wordlist.mutate /o/i, '0'
36
- wordlist.mutate /a/i, '@'
37
-
38
- wordlist.each_mutation { |word| word }
39
- end
40
- end
41
-
42
- bm.report('each_mutation (3)') do
43
- Wordlist::FlatFile.new(path) do |wordlist|
44
- wordlist.mutate /o/i, '0'
45
- wordlist.mutate /a/i, '@'
46
- wordlist.mutate /e/i, '3'
47
-
48
- wordlist.each_mutation { |word| word }
49
- end
50
- end
51
- end
52
-
53
- Benchmark.bm do |bm|
54
- mutator = Wordlist::Mutator.new(/o/i, '0')
55
-
56
- bm.report('Mutator#each') do
57
- mutator.each('lololololoLOLOLOLOLO') { |word| }
58
- end
59
- end