# File 'lib/evil_faker/base.rb', line 29defallreturn@all||=@subtypes.flat_map{|s|send(s)}if@subtypes@all||=Dir.glob(File.join(DATA_DIR,"*","#{@group}.txt")).sort.flat_mapdo|path|File.readlines(path,chomp:true)endend
.group(name) ⇒ Object
Declares this namespace's corpus, read from groups//.txt.
11
12
13
# File 'lib/evil_faker/base.rb', line 11defgroup(name)@group=nameend
.sample(count = nil) ⇒ Object
37
38
39
40
41
# File 'lib/evil_faker/base.rb', line 37defsample(count=nil)returnall.sample(count)ifcountall.sampleend
.subtype(name) ⇒ Object
Declares a sub-group living in groups///.txt.
Defines a method name that reads and concatenates it across every
source that has a file at that path (multiple sources can contribute
strings to the same subtype, e.g. blns/injection/sql.txt and
payloads_all_the_things/injection/sql.txt both feed Injection.sql).
20
21
22
23
24
25
26
27
# File 'lib/evil_faker/base.rb', line 20defsubtype(name)(@subtypes||=[])<<namedefine_singleton_method(name)dosubtype_cache[name]||=Dir.glob(File.join(DATA_DIR,"*",@group.to_s,"#{name}.txt")).sort.flat_map{|path|File.readlines(path,chomp:true)}endend