evil_faker 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +62 -0
  3. data/GENERATORS.md +164 -0
  4. data/LICENSE.txt +21 -0
  5. data/NOTICE.md +196 -0
  6. data/README.md +156 -0
  7. data/Rakefile +12 -0
  8. data/lib/evil_faker/base.rb +50 -0
  9. data/lib/evil_faker/data/blns.txt +742 -0
  10. data/lib/evil_faker/data/groups/blns/emoji/emoji.txt +10 -0
  11. data/lib/evil_faker/data/groups/blns/emoji/emoticons.txt +12 -0
  12. data/lib/evil_faker/data/groups/blns/emoji/regional.txt +3 -0
  13. data/lib/evil_faker/data/groups/blns/exploits/cves.txt +4 -0
  14. data/lib/evil_faker/data/groups/blns/exploits/human.txt +1 -0
  15. data/lib/evil_faker/data/groups/blns/exploits/ios.txt +3 -0
  16. data/lib/evil_faker/data/groups/blns/exploits/irc.txt +1 -0
  17. data/lib/evil_faker/data/groups/blns/filenames.txt +14 -0
  18. data/lib/evil_faker/data/groups/blns/injection/command.txt +6 -0
  19. data/lib/evil_faker/data/groups/blns/injection/file_inclusion.txt +2 -0
  20. data/lib/evil_faker/data/groups/blns/injection/interpolation.txt +9 -0
  21. data/lib/evil_faker/data/groups/blns/injection/jinja2.txt +2 -0
  22. data/lib/evil_faker/data/groups/blns/injection/script.txt +236 -0
  23. data/lib/evil_faker/data/groups/blns/injection/server_code.txt +9 -0
  24. data/lib/evil_faker/data/groups/blns/injection/sql.txt +8 -0
  25. data/lib/evil_faker/data/groups/blns/injection/xxe.txt +1 -0
  26. data/lib/evil_faker/data/groups/blns/numeric/numeric.txt +71 -0
  27. data/lib/evil_faker/data/groups/blns/numeric/unicode_numbers.txt +2 -0
  28. data/lib/evil_faker/data/groups/blns/profanity.txt +22 -0
  29. data/lib/evil_faker/data/groups/blns/reserved.txt +19 -0
  30. data/lib/evil_faker/data/groups/blns/rtl.txt +7 -0
  31. data/lib/evil_faker/data/groups/blns/terminal.txt +3 -0
  32. data/lib/evil_faker/data/groups/blns/unicode/accents.txt +4 -0
  33. data/lib/evil_faker/data/groups/blns/unicode/bom.txt +2 -0
  34. data/lib/evil_faker/data/groups/blns/unicode/controls.txt +3 -0
  35. data/lib/evil_faker/data/groups/blns/unicode/font.txt +8 -0
  36. data/lib/evil_faker/data/groups/blns/unicode/lowercase.txt +2 -0
  37. data/lib/evil_faker/data/groups/blns/unicode/quotes.txt +11 -0
  38. data/lib/evil_faker/data/groups/blns/unicode/scripts.txt +2 -0
  39. data/lib/evil_faker/data/groups/blns/unicode/special.txt +4 -0
  40. data/lib/evil_faker/data/groups/blns/unicode/symbols.txt +12 -0
  41. data/lib/evil_faker/data/groups/blns/unicode/trick.txt +5 -0
  42. data/lib/evil_faker/data/groups/blns/unicode/two_byte.txt +10 -0
  43. data/lib/evil_faker/data/groups/blns/unicode/upsidedown.txt +2 -0
  44. data/lib/evil_faker/data/groups/blns/unicode/whitespace.txt +1 -0
  45. data/lib/evil_faker/data/groups/blns/zalgo.txt +5 -0
  46. data/lib/evil_faker/data/groups/fuzzdb/email/invalid.txt +26 -0
  47. data/lib/evil_faker/data/groups/fuzzdb/email/valid.txt +32 -0
  48. data/lib/evil_faker/data/groups/fuzzdb/emoji/emoji.txt +8 -0
  49. data/lib/evil_faker/data/groups/fuzzdb/emoji/emoticons.txt +11 -0
  50. data/lib/evil_faker/data/groups/fuzzdb/emoji/regional.txt +3 -0
  51. data/lib/evil_faker/data/groups/fuzzdb/exploits/ios.txt +1 -0
  52. data/lib/evil_faker/data/groups/fuzzdb/headers/mimetypes.txt +1864 -0
  53. data/lib/evil_faker/data/groups/fuzzdb/headers/protocol.txt +357 -0
  54. data/lib/evil_faker/data/groups/fuzzdb/injection/command.txt +1115 -0
  55. data/lib/evil_faker/data/groups/fuzzdb/injection/directory_traversal.txt +536 -0
  56. data/lib/evil_faker/data/groups/fuzzdb/injection/file_inclusion.txt +906 -0
  57. data/lib/evil_faker/data/groups/fuzzdb/injection/file_upload_bypass.txt +371 -0
  58. data/lib/evil_faker/data/groups/fuzzdb/injection/format_strings.txt +67 -0
  59. data/lib/evil_faker/data/groups/fuzzdb/injection/generic.txt +584 -0
  60. data/lib/evil_faker/data/groups/fuzzdb/injection/integer_overflow.txt +12 -0
  61. data/lib/evil_faker/data/groups/fuzzdb/injection/json.txt +89 -0
  62. data/lib/evil_faker/data/groups/fuzzdb/injection/ldap.txt +35 -0
  63. data/lib/evil_faker/data/groups/fuzzdb/injection/magic_hashes.txt +24 -0
  64. data/lib/evil_faker/data/groups/fuzzdb/injection/nosql.txt +17 -0
  65. data/lib/evil_faker/data/groups/fuzzdb/injection/open_redirect.txt +37 -0
  66. data/lib/evil_faker/data/groups/fuzzdb/injection/rfi.txt +2241 -0
  67. data/lib/evil_faker/data/groups/fuzzdb/injection/script.txt +930 -0
  68. data/lib/evil_faker/data/groups/fuzzdb/injection/server_side_include.txt +78 -0
  69. data/lib/evil_faker/data/groups/fuzzdb/injection/source_disclosure.txt +18 -0
  70. data/lib/evil_faker/data/groups/fuzzdb/injection/sql.txt +661 -0
  71. data/lib/evil_faker/data/groups/fuzzdb/injection/ssrf.txt +56 -0
  72. data/lib/evil_faker/data/groups/fuzzdb/injection/type_confusion.txt +329 -0
  73. data/lib/evil_faker/data/groups/fuzzdb/injection/xpath.txt +13 -0
  74. data/lib/evil_faker/data/groups/fuzzdb/injection/xxe.txt +65 -0
  75. data/lib/evil_faker/data/groups/fuzzdb/routes/debug_params.txt +157 -0
  76. data/lib/evil_faker/data/groups/fuzzdb/routes/directory_indexing.txt +15 -0
  77. data/lib/evil_faker/data/groups/fuzzdb/routes/local_paths.txt +26 -0
  78. data/lib/evil_faker/data/groups/fuzzdb/rtl.txt +5 -0
  79. data/lib/evil_faker/data/groups/fuzzdb/terminal.txt +3 -0
  80. data/lib/evil_faker/data/groups/fuzzdb/unicode/bad_chars.txt +15 -0
  81. data/lib/evil_faker/data/groups/fuzzdb/unicode/special.txt +31 -0
  82. data/lib/evil_faker/data/groups/fuzzdb/unicode/trick.txt +5 -0
  83. data/lib/evil_faker/data/groups/fuzzdb/unicode/two_byte.txt +9 -0
  84. data/lib/evil_faker/data/groups/fuzzdb/unicode/upsidedown.txt +2 -0
  85. data/lib/evil_faker/data/groups/intruder_payloads/filenames.txt +124 -0
  86. data/lib/evil_faker/data/groups/intruder_payloads/injection/command.txt +445 -0
  87. data/lib/evil_faker/data/groups/intruder_payloads/injection/directory_traversal.txt +2578 -0
  88. data/lib/evil_faker/data/groups/intruder_payloads/injection/file_inclusion.txt +698 -0
  89. data/lib/evil_faker/data/groups/intruder_payloads/injection/generic.txt +1401 -0
  90. data/lib/evil_faker/data/groups/intruder_payloads/injection/overflow.txt +36 -0
  91. data/lib/evil_faker/data/groups/intruder_payloads/injection/script.txt +61 -0
  92. data/lib/evil_faker/data/groups/intruder_payloads/injection/server_side_include.txt +18 -0
  93. data/lib/evil_faker/data/groups/intruder_payloads/injection/sql.txt +753 -0
  94. data/lib/evil_faker/data/groups/intruder_payloads/injection/xxe.txt +66 -0
  95. data/lib/evil_faker/data/groups/intruder_payloads/unicode/bad_chars.txt +1 -0
  96. data/lib/evil_faker/data/groups/payloads_all_the_things/headers/cache_deception.txt +1125 -0
  97. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/command.txt +496 -0
  98. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/directory_traversal.txt +22607 -0
  99. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/file_inclusion.txt +4787 -0
  100. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/ldap.txt +60 -0
  101. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/nosql.txt +26 -0
  102. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/open_redirect.txt +305 -0
  103. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/script.txt +2165 -0
  104. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/sql.txt +1354 -0
  105. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/ssti.txt +105 -0
  106. data/lib/evil_faker/data/groups/payloads_all_the_things/injection/xxe.txt +102 -0
  107. data/lib/evil_faker/data/groups/payloads_all_the_things/routes/admin_interfaces.txt +52 -0
  108. data/lib/evil_faker/groups/email.rb +11 -0
  109. data/lib/evil_faker/groups/emoji.rb +12 -0
  110. data/lib/evil_faker/groups/exploits.rb +13 -0
  111. data/lib/evil_faker/groups/filenames.rb +8 -0
  112. data/lib/evil_faker/groups/headers.rb +12 -0
  113. data/lib/evil_faker/groups/injection.rb +35 -0
  114. data/lib/evil_faker/groups/numeric.rb +11 -0
  115. data/lib/evil_faker/groups/profanity.rb +8 -0
  116. data/lib/evil_faker/groups/reserved.rb +8 -0
  117. data/lib/evil_faker/groups/routes.rb +13 -0
  118. data/lib/evil_faker/groups/rtl.rb +8 -0
  119. data/lib/evil_faker/groups/terminal.rb +8 -0
  120. data/lib/evil_faker/groups/unicode.rb +23 -0
  121. data/lib/evil_faker/groups/zalgo.rb +8 -0
  122. data/lib/evil_faker/source_base.rb +30 -0
  123. data/lib/evil_faker/sources/blns.rb +8 -0
  124. data/lib/evil_faker/sources/fuzzdb.rb +8 -0
  125. data/lib/evil_faker/sources/intruder_payloads.rb +8 -0
  126. data/lib/evil_faker/sources/payloads_all_the_things.rb +8 -0
  127. data/lib/evil_faker/version.rb +5 -0
  128. data/lib/evil_faker.rb +13 -0
  129. data/scripts/blns_build_corpus.rb +159 -0
  130. data/scripts/fuzzdb_build_corpus.rb +166 -0
  131. data/scripts/generate_namespaces.rb +87 -0
  132. data/scripts/intruder_payloads_build_corpus.rb +112 -0
  133. data/scripts/payloads_all_the_things_build_corpus.rb +74 -0
  134. data/sig/evil_faker.rbs +4 -0
  135. metadata +181 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f92729244c15292d094d362e74347ddbc761399e6498705c7bafff8679486b0b
4
+ data.tar.gz: 4eb27cf343e7f1a58c4e5eed2fbb4dd4d4e1d4c611f66376cde6967a3396d220
5
+ SHA512:
6
+ metadata.gz: 406c5ad76d8bf2a68f7b189f9be5f736f53022d49ecc7c980adf0f81162ae825df0d85176c1a7328a84ce38e86deb1bd2d77c7507dcdb3d1b8d9407fa3710237
7
+ data.tar.gz: b372aafdbb272862d556c318b760526ffa69291315e9af72827e8b51a6d56aac5f02203c4efd63e7d2a5b9438ebaa1589c5ccb028cb8e2d05cad7132407d02f9
data/CHANGELOG.md ADDED
@@ -0,0 +1,62 @@
1
+ ## [Unreleased]
2
+
3
+ - Second corpus source vendored: `swisskyrepo/PayloadsAllTheThings` (MIT),
4
+ limited to the folders that ship real payload lists (an `Intruder`/
5
+ `Intruders` directory), not the repo's many Markdown write-ups.
6
+ - Third corpus source vendored: `1N3/IntruderPayloads`. **No license is
7
+ declared on that repo** (no LICENSE file, `license: null` via the GitHub
8
+ API, not mentioned in its README) -- vendored anyway per explicit call, but
9
+ unlike BLNS/PayloadsAllTheThings this one has no MIT grant backing it. See
10
+ NOTICE.md.
11
+ - `Injection` gains 8 new subtypes: `nosql`, `ldap`, `ssti`,
12
+ `directory_traversal`, `open_redirect`, `server_side_include`, `overflow`,
13
+ `generic`. Existing subtypes `sql`, `script`, `xxe`, `command`,
14
+ `file_inclusion` now merge strings from all three sources.
15
+ - `Unicode` gains `bad_chars`.
16
+ - `Filenames` (flat) now also merges malicious upload filenames from
17
+ IntruderPayloads' `Uploads/` folder (the payload there *is* the filename,
18
+ not file content).
19
+ - Two new namespaces from PayloadsAllTheThings folders that aren't injection
20
+ payloads: `Routes.admin_interfaces` (Spring Boot Actuator routes) and
21
+ `Headers.cache_deception` (HTTP header names for cache deception/param
22
+ mining).
23
+ - `Base` now reads a subtype/group from every source under `data/groups/*`
24
+ and concatenates them, instead of being hardcoded to `blns/`.
25
+ - Renamed the source-specific import scripts to a consistent
26
+ `<source>_build_corpus.rb` pattern: `build_corpus.rb` -> `scripts/blns_build_corpus.rb`,
27
+ plus new `scripts/payloads_all_the_things_build_corpus.rb` and
28
+ `scripts/intruder_payloads_build_corpus.rb`. `scripts/generate_namespaces.rb`
29
+ (shared, not source-specific) keeps its name.
30
+ - Fourth corpus source vendored: `fuzzdb-project/fuzzdb`, limited to `attack/`
31
+ (its recon wordlist folders are out of scope). **Also has no declared
32
+ license**, same gap as IntruderPayloads. See NOTICE.md. Heavy overlap with
33
+ PayloadsAllTheThings is expected (that source's SQL/traversal/command lists
34
+ were themselves originally copied from fuzzdb) and was accepted rather than
35
+ de-duplicated across sources.
36
+ - `Injection` gains 11 more subtypes: `xpath`, `integer_overflow`, `rfi`,
37
+ `ssrf`, `json`, `format_strings`, `magic_hashes`, `source_disclosure`,
38
+ `file_upload_bypass`, `type_confusion`. `directory_traversal`, `ldap`,
39
+ `nosql`, `open_redirect` and `server_side_include` now also merge fuzzdb
40
+ strings.
41
+ - New `EvilFaker::Email` namespace (`valid`/`invalid`): Faker-style parity for
42
+ emails, but edge cases instead of realistic ones.
43
+ - `Routes` gains `debug_params`, `directory_indexing`, `local_paths`.
44
+ `Headers` gains `protocol`, `mimetypes`.
45
+ - `Terminal`, `Rtl`, `Exploits.ios`, and `Unicode.special/two_byte/upsidedown/
46
+ trick/bad_chars`, `Emoji.emoji/emoticons/regional` now also merge fuzzdb
47
+ strings.
48
+ - `scripts/fuzzdb_build_corpus.rb` vendors the new source.
49
+
50
+ ## [0.1.0] - 2026-07-23
51
+
52
+ - Initial release.
53
+ - Adversarial string corpus vendored from the Big List of Naughty Strings (MIT),
54
+ split into 11 namespaces: `Reserved`, `Numeric`, `Unicode`, `Emoji`, `Rtl`,
55
+ `Zalgo`, `Injection`, `Exploits`, `Filenames`, `Profanity`, `Terminal`.
56
+ - Common generator API on every namespace: `.all`, `.sample`, `.sample(n)`,
57
+ `.size` and `Enumerable`.
58
+ - Subtypes for namespaces that bundle several kinds of input, e.g.
59
+ `Injection.sql`, `Injection.script`, `Unicode.quotes`. Subtypes share the same
60
+ API as namespaces.
61
+ - Reproducible output via `EvilFaker.random = Random.new(seed)`.
62
+ - `scripts/build_corpus.rb` regenerates the per-namespace corpus from `blns.txt`.
data/GENERATORS.md ADDED
@@ -0,0 +1,164 @@
1
+ # Generators
2
+
3
+ Every namespace responds to `.all`, `.sample`, and `.sample(n)`. Namespaces
4
+ with subtypes expose those with the same API. Everything below is real
5
+ output — run it yourself and you'll get something different, `sample` is
6
+ random (see [Forcing an exact value](README.md#forcing-an-exact-value) in
7
+ the README if you need something specific and reproducible).
8
+
9
+ <details>
10
+ <summary><strong>EvilFaker::Injection</strong> — 26 subtypes, 46,520 strings total</summary>
11
+
12
+ ```ruby
13
+ EvilFaker::Injection.sql.sample #=> "')) or sleep(5)='"
14
+ EvilFaker::Injection.script.sample #=> "'><script>alert(21);</script x='"
15
+ EvilFaker::Injection.xxe.sample #=> "x' or name()='username' or 'x'='y"
16
+ EvilFaker::Injection.command.sample #=> "sleep 5"
17
+ EvilFaker::Injection.server_code.sample #=> "@{[system \"touch /tmp/blns.fail\"]}"
18
+ EvilFaker::Injection.interpolation.sample #=> "$ENV{'HOME'}"
19
+ EvilFaker::Injection.file_inclusion.sample #=> "\\xampp\\FileZillaFTP\\Logs\\error.log"
20
+ EvilFaker::Injection.jinja2.sample #=> "{% print 'x' * 64 * 1024**3 %}"
21
+ EvilFaker::Injection.nosql.sample #=> "1, $where: '1 == 1'"
22
+ EvilFaker::Injection.ldap.sample #=> "*))%00"
23
+ EvilFaker::Injection.ssti.sample #=> "{{ request }}"
24
+ EvilFaker::Injection.directory_traversal.sample #=> "%c0%fe%c0%fe%25c0%25af...etc%25c0%25afpasswd"
25
+ EvilFaker::Injection.open_redirect.sample #=> "http://www.whitelisteddomain.tld@472.314.470.462"
26
+ EvilFaker::Injection.xpath.sample #=> "x' or 1=1 or 'x'='y"
27
+ EvilFaker::Injection.rfi.sample #=> "/ocs/include/theme.inc.php?fullpath=XXpathXX?"
28
+ EvilFaker::Injection.ssrf.sample #=> "017700000001"
29
+ EvilFaker::Injection.json.sample #=> "{\"_constructor\":\"null\"}"
30
+ EvilFaker::Injection.format_strings.sample #=> "%x%x%x%x"
31
+ EvilFaker::Injection.integer_overflow.sample #=> "0x3fffffff"
32
+ EvilFaker::Injection.type_confusion.sample #=> "%bd"
33
+ EvilFaker::Injection.magic_hashes.sample #=> "00e05651056780370631793326323796"
34
+ EvilFaker::Injection.source_disclosure.sample #=> "."
35
+ EvilFaker::Injection.file_upload_bypass.sample #=> "pm......"
36
+ EvilFaker::Injection.server_side_include.sample #=> "<!--#echo var=\"script_url\" -->"
37
+ EvilFaker::Injection.overflow.sample #=> "0x100000"
38
+ EvilFaker::Injection.generic.sample #=> "(SELECT * FROM (SELECT(SLEEP(5)))ecMj)--"
39
+ ```
40
+
41
+ `sql`, `script`, `xxe`, `command`, `file_inclusion`, `directory_traversal`,
42
+ `ldap`, `nosql`, `open_redirect` and `server_side_include` merge multiple
43
+ vendored sources into one list (see the README's
44
+ [Where the data comes from](README.md#where-the-data-comes-from)); the rest
45
+ come from whichever single source introduced them.
46
+
47
+ </details>
48
+
49
+ <details>
50
+ <summary><strong>EvilFaker::Unicode</strong> — 14 subtypes</summary>
51
+
52
+ Encoding/rendering edge cases, not necessarily attacks.
53
+
54
+ ```ruby
55
+ EvilFaker::Unicode.special.sample #=> "<>?:\"{}|_+"
56
+ EvilFaker::Unicode.controls.sample #=> "\u0080\u0081...\u009F" (C1 control range)
57
+ EvilFaker::Unicode.whitespace.sample #=> "\t\v\f \u0085...\u2028\u2029 \u3000"
58
+ EvilFaker::Unicode.bom.sample #=> "￾"
59
+ EvilFaker::Unicode.symbols.sample #=> "¡™£¢∞§¶•ªº–≠"
60
+ EvilFaker::Unicode.accents.sample #=> "⁰⁴⁵"
61
+ EvilFaker::Unicode.quotes.sample #=> "<foo val=”bar“ />"
62
+ EvilFaker::Unicode.two_byte.sample #=> "사회과학원 어학연구소"
63
+ EvilFaker::Unicode.lowercase.sample #=> "Ⱥ"
64
+ EvilFaker::Unicode.scripts.sample #=> "᚛ᚄᚓᚐᚋᚒᚄ ᚑᚄᚂᚑᚏᚅ᚜"
65
+ EvilFaker::Unicode.trick.sample #=> "test⁠test‫"
66
+ EvilFaker::Unicode.upsidedown.sample #=> "00˙Ɩ$-"
67
+ EvilFaker::Unicode.font.sample #=> "𝐓𝐡𝐞 𝐪𝐮𝐢𝐜𝐤 𝐛𝐫𝐨𝐰𝐧 𝐟𝐨𝐱..."
68
+ EvilFaker::Unicode.bad_chars.sample #=> "₀₁₂"
69
+ ```
70
+
71
+ </details>
72
+
73
+ <details>
74
+ <summary><strong>EvilFaker::Routes</strong> — 4 subtypes</summary>
75
+
76
+ Recon-ish wordlists (admin routes, debug params, directory listings, local
77
+ log paths) — not adversarial payloads, but realistic values for testing
78
+ routing/auth-guard behavior.
79
+
80
+ ```ruby
81
+ EvilFaker::Routes.admin_interfaces.sample #=> "actuator/threaddump"
82
+ EvilFaker::Routes.debug_params.sample #=> "\"admin\":true"
83
+ EvilFaker::Routes.directory_indexing.sample #=> "/cgi-bin/test-cgi?*"
84
+ EvilFaker::Routes.local_paths.sample #=> "/usr/local/apache/logs/access_log"
85
+ ```
86
+
87
+ </details>
88
+
89
+ <details>
90
+ <summary><strong>EvilFaker::Headers</strong> — 3 subtypes</summary>
91
+
92
+ HTTP header names, protocol methods and MIME types, for testing
93
+ header-parsing code paths.
94
+
95
+ ```ruby
96
+ EvilFaker::Headers.cache_deception.sample #=> "onerror-die"
97
+ EvilFaker::Headers.protocol.sample #=> "DEBUG"
98
+ EvilFaker::Headers.mimetypes.sample #=> "application/xenc+xml"
99
+ ```
100
+
101
+ </details>
102
+
103
+ <details>
104
+ <summary><strong>EvilFaker::Emoji</strong> — 3 subtypes</summary>
105
+
106
+ ```ruby
107
+ EvilFaker::Emoji.emoji.sample #=> "❤️ 💔 💌 💕 💞 💓 💗..."
108
+ EvilFaker::Emoji.emoticons.sample #=> "( ͡° ͜ʖ ͡°)"
109
+ EvilFaker::Emoji.regional.sample #=> "🇺🇸🇷🇺🇸🇦"
110
+ ```
111
+
112
+ </details>
113
+
114
+ <details>
115
+ <summary><strong>EvilFaker::Exploits</strong> — 4 subtypes</summary>
116
+
117
+ Named/historical exploit strings rather than a general category.
118
+
119
+ ```ruby
120
+ EvilFaker::Exploits.cves.sample #=> "() { 0; }; touch /tmp/blns.shellshock1.fail;"
121
+ EvilFaker::Exploits.human.sample #=> "If you're reading this, you've been in a coma..."
122
+ EvilFaker::Exploits.ios.sample #=> "జ్ఞ‌ా"
123
+ EvilFaker::Exploits.irc.sample #=> "DCC SEND STARTKEYLOGGER 0 0 0"
124
+ ```
125
+
126
+ </details>
127
+
128
+ <details>
129
+ <summary><strong>EvilFaker::Numeric</strong> — 2 subtypes</summary>
130
+
131
+ ```ruby
132
+ EvilFaker::Numeric.numeric.sample #=> "1.000.000,00"
133
+ EvilFaker::Numeric.unicode_numbers.sample #=> "123"
134
+ ```
135
+
136
+ </details>
137
+
138
+ <details>
139
+ <summary><strong>EvilFaker::Email</strong> — 2 subtypes</summary>
140
+
141
+ Faker-style parity for emails, but edge cases instead of realistic ones:
142
+ syntactically valid addresses that break naive regexes, and invalid ones
143
+ that get accepted anyway by permissive validators.
144
+
145
+ ```ruby
146
+ EvilFaker::Email.valid.sample #=> "Jacco/van=Tuijl@address.com"
147
+ EvilFaker::Email.invalid.sample #=> ".email@address.com"
148
+ ```
149
+
150
+ </details>
151
+
152
+ <details>
153
+ <summary><strong>Flat namespaces</strong> — no subtypes, just <code>.all</code> / <code>.sample</code></summary>
154
+
155
+ ```ruby
156
+ EvilFaker::Reserved.sample #=> "(null)"
157
+ EvilFaker::Filenames.sample #=> "simple-backdoor.php"
158
+ EvilFaker::Profanity.sample #=> "Lightwater Country Park"
159
+ EvilFaker::Rtl.sample #=> "הָיְתָהtestالصفحات التّحول"
160
+ EvilFaker::Zalgo.sample #=> "Z̮̞̠͙͔ͅḀ̗̞͈̻̗Ḷ͙͎̯̹̞͓G̻O̭̗̮"
161
+ EvilFaker::Terminal.sample #=> "The quic\b\b\b\b\b\bk brown fo\a\a\a\a\a\a\a\a\a\a\ax... [Beeeep]"
162
+ ```
163
+
164
+ </details>
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 AFornio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/NOTICE.md ADDED
@@ -0,0 +1,196 @@
1
+ # Attributions
2
+
3
+ ## Big List of Naughty Strings (BLNS)
4
+
5
+ The adversarial string corpus vendored under `lib/evil_faker/data/` is derived from
6
+ the **Big List of Naughty Strings**, curated by **Max Woolf (@minimaxir)** and
7
+ contributors.
8
+
9
+ - Source: https://github.com/minimaxir/big-list-of-naughty-strings
10
+ - License: MIT
11
+
12
+ The MIT license text below applies to the BLNS data.
13
+
14
+ ```
15
+ The MIT License (MIT)
16
+
17
+ Copyright (c) 2015-2020 Max Woolf
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in
27
+ all copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35
+ THE SOFTWARE.
36
+ ```
37
+
38
+ ## PayloadsAllTheThings
39
+
40
+ The adversarial string corpus vendored under
41
+ `lib/evil_faker/data/groups/payloads_all_the_things/` is derived from
42
+ **PayloadsAllTheThings**, curated by **Swissky (@swisskyrepo)** and
43
+ contributors. Only the folders that ship a real `Intruder`/`Intruders`
44
+ directory of plain-text payloads were vendored; the rest of the repo is
45
+ Markdown documentation, not data.
46
+
47
+ - Source: https://github.com/swisskyrepo/PayloadsAllTheThings
48
+ - License: MIT
49
+
50
+ Origin of each vendored file (`lib/evil_faker/data/groups/payloads_all_the_things/<path>`):
51
+
52
+ | Vendored as | Upstream path |
53
+ |---|---|
54
+ | `injection/sql.txt` | `SQL Injection/Intruder/*.txt` |
55
+ | `injection/nosql.txt` | `NoSQL Injection/Intruder/*.txt` |
56
+ | `injection/ldap.txt` | `LDAP Injection/Intruder/*.txt` |
57
+ | `injection/script.txt` | `XSS Injection/Intruders/*.txt` |
58
+ | `injection/xxe.txt` | `XXE Injection/Intruders/*.txt` |
59
+ | `injection/ssti.txt` | `Server Side Template Injection/Intruder/*.txt` |
60
+ | `injection/command.txt` | `Command Injection/Intruder/*.txt` |
61
+ | `injection/file_inclusion.txt` | `File Inclusion/Intruders/*.txt` |
62
+ | `injection/directory_traversal.txt` | `Directory Traversal/Intruder/*.txt` |
63
+ | `injection/open_redirect.txt` | `Open Redirect/Intruder/*.txt` |
64
+ | `routes/admin_interfaces.txt` | `Insecure Management Interface/Intruder/springboot_actuator.txt` |
65
+ | `headers/cache_deception.txt` | `Web Cache Deception/Intruders/param_miner_lowercase_headers.txt` |
66
+
67
+ The MIT license text below applies to the PayloadsAllTheThings data.
68
+
69
+ ```
70
+ MIT License
71
+
72
+ Copyright (c) 2019 Swissky
73
+
74
+ Permission is hereby granted, free of charge, to any person obtaining a copy
75
+ of this software and associated documentation files (the "Software"), to deal
76
+ in the Software without restriction, including without limitation the rights
77
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
78
+ copies of the Software, and to permit persons to whom the Software is
79
+ furnished to do so, subject to the following conditions:
80
+
81
+ The above copyright notice and this permission notice shall be included in all
82
+ copies or substantial portions of the Software.
83
+
84
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
85
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
86
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
87
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
88
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
89
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
90
+ SOFTWARE.
91
+ ```
92
+
93
+ ## IntruderPayloads
94
+
95
+ The adversarial string corpus vendored under
96
+ `lib/evil_faker/data/groups/intruder_payloads/` is derived from
97
+ **IntruderPayloads**, curated by **1N3** and contributors.
98
+
99
+ - Source: https://github.com/1N3/IntruderPayloads
100
+ - **License: none declared.** The repo has no `LICENSE` file, doesn't mention
101
+ a license in its README, and the GitHub API reports `license: null`. There
102
+ is no MIT (or other) grant backing this data, unlike BLNS and
103
+ PayloadsAllTheThings above. It was vendored anyway on explicit instruction
104
+ despite this gap -- flagging it here so the gap is visible, not silently
105
+ assumed away. Revisit before any public release of this gem if that's a
106
+ concern (e.g. contact the author for explicit permission, or drop this
107
+ source).
108
+
109
+ Only `FuzzLists/` (plain-text payload lists) and `Uploads/` (malicious
110
+ upload filenames) were vendored. `BurpAttacks/` (binary `.burp` ZIP exports),
111
+ `Plugins/` (`.jar` files) and `BurpBountyPayloads/` (JSON scanner-rule
112
+ configs with 1-2 payloads each behind a lot of unrelated metadata) were
113
+ skipped.
114
+
115
+ Origin of each vendored file (`lib/evil_faker/data/groups/intruder_payloads/<path>`):
116
+
117
+ | Vendored as | Upstream path(s) |
118
+ |---|---|
119
+ | `injection/sql.txt` | `FuzzLists/sqli-error-based.txt`, `sqli-time-based.txt`, `sqli-union-select.txt`, `sqli_escape_chars.txt`, `auth_bypass.txt` |
120
+ | `injection/script.txt` | `FuzzLists/xss_escape_chars.txt`, `xss_find_inject.txt`, `xss_funny_stored.txt`, `xss_grep.txt`, `xss_swf_fuzz.txt` |
121
+ | `injection/file_inclusion.txt` | `FuzzLists/lfi.txt` |
122
+ | `injection/directory_traversal.txt` | `FuzzLists/traversal.txt`, `traversal-short.txt` |
123
+ | `injection/xxe.txt` | `FuzzLists/xml-attacks.txt` |
124
+ | `injection/command.txt` | `FuzzLists/command_exec.txt` |
125
+ | `injection/server_side_include.txt` | `FuzzLists/ssi_quick.txt` |
126
+ | `injection/overflow.txt` | `FuzzLists/overflow.txt`, `overflow-dos.txt` |
127
+ | `injection/generic.txt` | `FuzzLists/basic_fuzz.txt`, `full_fuzz.txt`, `quick_fuzz.txt` |
128
+ | `unicode/bad_chars.txt` | `FuzzLists/bad_chars.txt` |
129
+ | `filenames.txt` (merged into flat `EvilFaker::Filenames`) | `Uploads/` (directory entry names themselves are the payload) |
130
+
131
+ Every source line containing the literal token `INJECTX` (a Burp Intruder
132
+ substitution placeholder, meaningless without the second payload it would be
133
+ spliced with) was dropped rather than vendored as-is.
134
+
135
+ ## fuzzdb
136
+
137
+ The adversarial string corpus vendored under
138
+ `lib/evil_faker/data/groups/fuzzdb/` is derived from **fuzzdb**, curated by the
139
+ **fuzzdb-project** and contributors.
140
+
141
+ - Source: https://github.com/fuzzdb-project/fuzzdb
142
+ - **License: none declared.** Same gap as IntruderPayloads above -- no
143
+ `LICENSE` file, `license: null` via the GitHub API. Vendored anyway on
144
+ explicit instruction. Revisit before any public release of this gem if
145
+ that's a concern.
146
+
147
+ Only `attack/` was vendored (adversarial field payloads); `discovery/`,
148
+ `wordlists-misc/`, `wordlists-user-passwd/`, `web-backdoors/`, `docs/` and
149
+ `regex/` are recon wordlists/tooling, out of scope for this gem. Within
150
+ `attack/`, `file-upload/malicious-images/` (real binary POC files, including
151
+ an EICAR test string) and `xss/JHADDIX_XSS_WITH_CONTEXT.doc.txt` (prose
152
+ write-up, not one payload per line) were skipped.
153
+
154
+ Heavy overlap with the PayloadsAllTheThings data is expected and accepted:
155
+ that source's SQL/traversal/command lists were themselves originally copied
156
+ from fuzzdb (several files share the exact upstream filename, e.g.
157
+ `traversals-8-deep-exotic-encoding.txt`). Vendored anyway per explicit
158
+ instruction to prioritize coverage over de-duplication across sources.
159
+
160
+ Origin of each vendored file (`lib/evil_faker/data/groups/fuzzdb/<path>`):
161
+
162
+ | Vendored as | Upstream path(s) |
163
+ |---|---|
164
+ | `injection/sql.txt` | `attack/sql-injection/detect,exploit,payloads-sql-blind/*.txt` |
165
+ | `injection/script.txt` | `attack/xss/*.txt` (minus the doc.txt), `attack/html_js_fuzz/*.txt` |
166
+ | `injection/xxe.txt` | `attack/xml/xml-attacks.txt` |
167
+ | `injection/command.txt` | `attack/os-cmd-execution/*.txt`, `attack/string-expansion/shell-expansion.txt` |
168
+ | `injection/file_inclusion.txt` | `attack/lfi/*.txt` |
169
+ | `injection/directory_traversal.txt` | `attack/path-traversal/*.txt` |
170
+ | `injection/open_redirect.txt` | `attack/redirect/*.txt` |
171
+ | `injection/nosql.txt` | `attack/no-sql-injection/mongodb.txt` |
172
+ | `injection/ldap.txt` | `attack/ldap/ldap-injection.txt` |
173
+ | `injection/server_side_include.txt` | `attack/server-side-include/server-side-includes-generic.txt` |
174
+ | `injection/generic.txt` | `attack/all-attacks/*.txt` |
175
+ | `injection/xpath.txt` | `attack/xpath/xpath-injection.txt` |
176
+ | `injection/integer_overflow.txt` | `attack/integer-overflow/integer-overflows.txt` |
177
+ | `injection/rfi.txt` | `attack/rfi/rfi.txt` |
178
+ | `injection/ssrf.txt` | `attack/ip/localhost.txt` |
179
+ | `injection/json.txt` | `attack/json/JSON_Fuzzing.txt` |
180
+ | `injection/format_strings.txt` | `attack/format-strings/format-strings.txt` |
181
+ | `injection/magic_hashes.txt` | `attack/authentication/php_magic_hashes.fuzz.txt` |
182
+ | `injection/source_disclosure.txt` | `attack/disclosure-source/*.txt` |
183
+ | `injection/file_upload_bypass.txt` | `attack/file-upload/*.txt` (minus `malicious-images/`) |
184
+ | `injection/type_confusion.txt` | `attack/control-chars/HexValsAllBytes.txt`, `NullByteRepresentations.txt`, `true.txt` |
185
+ | `routes/debug_params.txt` | `attack/business-logic/*.txt` |
186
+ | `routes/directory_indexing.txt` | `attack/disclosure-directory/directory-indexing-generic.txt`, `attack/os-dir-indexing/directory-indexing.txt` |
187
+ | `routes/local_paths.txt` | `attack/disclosure-localpaths/unix/*.txt` |
188
+ | `headers/protocol.txt` | `attack/http-protocol/*.txt` (minus README/html) |
189
+ | `headers/mimetypes.txt` | `attack/mimetypes/MimeTypes.txt` |
190
+ | `email/valid.txt` | `attack/email/valid-email-addresses.txt` |
191
+ | `email/invalid.txt` | `attack/email/invalid-email-addresses.txt` |
192
+ | merged into flat `EvilFaker::Terminal` | `attack/control-chars/terminal-escape-codes.txt` |
193
+ | merged into `EvilFaker::Exploits.ios` | `attack/control-chars/imessage.txt` |
194
+ | merged into `EvilFaker::Unicode.special/two_byte/upsidedown/trick/bad_chars` | `attack/unicode/specialchars.txt`, `two-byte-chars.txt`, `upsidedown.txt`, `corrupted.txt`, `naughty-unicode.txt` |
195
+ | merged into `EvilFaker::Emoji.emoji/emoticons/regional` | `attack/unicode/emoji.txt`, `japanese-emoticon.txt`, `regionalindicators.txt` |
196
+ | merged into flat `EvilFaker::Rtl` | `attack/unicode/right-to-left.txt` |
data/README.md ADDED
@@ -0,0 +1,156 @@
1
+ <div align="center">
2
+
3
+ # EvilFaker 💎
4
+
5
+ **Adversarial input for Ruby — like Faker, but evil.**
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/evil_faker.svg)](https://badge.fury.io/rb/evil_faker)
8
+ [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%203.2.0-red.svg)](https://www.ruby-lang.org)
9
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)
10
+
11
+ </div>
12
+
13
+ Faker gives you data that looks real. EvilFaker gives you data that fights back:
14
+ the strings that have historically broken software.
15
+
16
+ ```ruby
17
+ EvilFaker::Injection.sql.sample #=> "' OR 1=1 -- 1"
18
+ EvilFaker::Zalgo.sample #=> "Ṱ̺̺̕o͞ ̷i̲̬͇̪͙n̝̗͕v̟̜̘̦͟o̶̙̰̠kè͚̮̺̪̹̱̤"
19
+ EvilFaker::Unicode.quotes.sample #=> "<foo val=“bar” />"
20
+ EvilFaker::Emoji.sample #=> "👨‍🦰"
21
+ ```
22
+
23
+ Emoji that get truncated by a `utf8` MySQL column. Right-to-left overrides that
24
+ flip your layout. Zalgo that overflows its line. Reserved Windows filenames.
25
+ SQL, XSS, XXE, LDAP, SSTI, and 20 other kinds of injection payload.
26
+
27
+ ## Installation
28
+
29
+ ```ruby
30
+ # Gemfile
31
+ group :development, :test do
32
+ gem "evil_faker"
33
+ end
34
+ ```
35
+
36
+ ## Quickstart
37
+
38
+ Every namespace answers to the same three methods:
39
+
40
+ ```ruby
41
+ EvilFaker::Reserved.all # every string in the group (Array)
42
+ EvilFaker::Reserved.sample # one at random
43
+ EvilFaker::Reserved.sample(3) # three at random
44
+ ```
45
+
46
+ Namespaces that bundle several kinds of input expose **subtypes**, same API:
47
+
48
+ ```ruby
49
+ EvilFaker::Injection.sql # only the SQL payloads
50
+ EvilFaker::Injection.script # only the XSS payloads
51
+ EvilFaker::Injection.sql.sample
52
+ ```
53
+
54
+ The full list of namespaces, subtypes, and real sample output lives in
55
+ **[GENERATORS.md](GENERATORS.md)** so this README stays readable.
56
+
57
+ ## Where the data comes from
58
+
59
+ EvilFaker doesn't generate strings on the fly — it vendors them from four
60
+ public wordlists that have been breaking real software for years:
61
+
62
+ | Source | Contributes |
63
+ |---|---|
64
+ | [Big List of Naughty Strings](https://github.com/minimaxir/big-list-of-naughty-strings) — Max Woolf | Emoji, RTL overrides, zalgo, unicode edge cases, base injection payloads |
65
+ | [PayloadsAllTheThings](https://github.com/swisskyrepo/PayloadsAllTheThings) — Swissky & contributors | Deep SQL/XSS/XXE/SSTI/LDAP/NoSQL payloads, admin routes, cache-deception headers |
66
+ | [IntruderPayloads](https://github.com/1N3/IntruderPayloads) — 1N3 & contributors | More SQL/XSS/traversal/command payloads, malicious upload filenames |
67
+ | [fuzzdb](https://github.com/fuzzdb-project/fuzzdb) — fuzzdb-project | XPath, RFI, SSRF, JSON, format strings, magic hashes, valid/invalid emails |
68
+
69
+ When more than one source has data for the same group, `.all` and every
70
+ subtype method return **all of it, concatenated** — nothing gets dropped in
71
+ favor of another source. `EvilFaker::Injection.sql`, for example, merges four
72
+ separate files into 2,776 lines (8 from BLNS, 661 from fuzzdb, 753 from
73
+ IntruderPayloads, 1,354 from PayloadsAllTheThings).
74
+
75
+ The one thing that doesn't happen automatically is cross-source dedup: each
76
+ source de-dupes its own file at vendor time, but two sources that happen to
77
+ share the same payload aren't checked against each other (fuzzdb and
78
+ PayloadsAllTheThings overlap a lot, since the latter originally copied
79
+ several fuzzdb files). Call `.uniq` yourself if that matters for your case.
80
+
81
+ Per-file origin and license details live in [NOTICE.md](NOTICE.md) — worth a
82
+ read before you ship this anywhere public, since two of the four sources
83
+ (IntruderPayloads, fuzzdb) don't declare a license upstream.
84
+
85
+ ## Usage patterns
86
+
87
+ ### In your specs
88
+
89
+ ```ruby
90
+ RSpec.describe "GET /search", type: :request do
91
+ EvilFaker::Injection.sql.each do |payload|
92
+ it "survives #{payload.inspect}" do
93
+ get "/search", params: { q: payload }
94
+
95
+ expect(response).to have_http_status(:ok) # no 500
96
+ expect(User.count).to eq(3) # table still there
97
+ end
98
+ end
99
+ end
100
+ ```
101
+
102
+ Sample large groups so the suite stays fast:
103
+
104
+ ```ruby
105
+ EvilFaker::Injection.script.sample(10).each do |xss|
106
+ it "escapes #{xss.inspect}" do
107
+ # ...
108
+ end
109
+ end
110
+ ```
111
+
112
+ ### In a factory
113
+
114
+ ```ruby
115
+ factory :evil_faker_user, parent: :user do
116
+ name { EvilFaker::Unicode.sample }
117
+ bio { EvilFaker::Zalgo.sample }
118
+ end
119
+ ```
120
+
121
+ ### Forcing an exact value
122
+
123
+ `sample` is random and unseeded — don't rely on it in a spec that needs to be
124
+ reproducible. Use the Array you already have instead:
125
+
126
+ ```ruby
127
+ EvilFaker::Injection.sql.first
128
+ EvilFaker::Injection.sql.find { |s| s.include?("DROP") }
129
+ ```
130
+
131
+ ## Development
132
+
133
+ ```bash
134
+ bin/setup # install dependencies
135
+ bundle exec rspec # run the tests
136
+ bundle exec rubocop # lint
137
+ bin/console # IRB with evil_faker loaded
138
+ ruby scripts/blns_build_corpus.rb # regenerate groups/blns from blns.txt
139
+ ruby scripts/payloads_all_the_things_build_corpus.rb # regenerate groups/payloads_all_the_things (needs gh CLI)
140
+ ruby scripts/intruder_payloads_build_corpus.rb # regenerate groups/intruder_payloads (needs gh CLI)
141
+ ruby scripts/fuzzdb_build_corpus.rb # regenerate groups/fuzzdb (needs gh CLI)
142
+ ruby scripts/generate_namespaces.rb # regenerate lib/evil_faker/groups from data/groups
143
+ ```
144
+
145
+ `Base` discovers sources off the filesystem, not off a hardcoded list —
146
+ adding a fifth source is just adding a `groups/<source>/` folder with files
147
+ in the right shape and re-running `generate_namespaces.rb`.
148
+
149
+ ## Credits
150
+
151
+ MIT-licensed corpus data from the four sources above, credits and full
152
+ license text in [NOTICE.md](NOTICE.md).
153
+
154
+ ## License
155
+
156
+ MIT. See [LICENSE.txt](LICENSE.txt).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EvilFaker
4
+ # Base class for every namespace: reads its corpus from data/groups and
5
+ # exposes .all/.sample, plus .subtype for namespaces split into sub-groups.
6
+ class Base
7
+ DATA_DIR = File.expand_path("data/groups", __dir__)
8
+
9
+ class << self
10
+ # Declares this namespace's corpus, read from groups/<source>/<name>.txt.
11
+ def group(name)
12
+ @group = name
13
+ end
14
+
15
+ # Declares a sub-group living in groups/<source>/<group>/<name>.txt.
16
+ # Defines a method `name` that reads and concatenates it across every
17
+ # source that has a file at that path (multiple sources can contribute
18
+ # strings to the same subtype, e.g. blns/injection/sql.txt and
19
+ # payloads_all_the_things/injection/sql.txt both feed Injection.sql).
20
+ def subtype(name)
21
+ (@subtypes ||= []) << name
22
+ define_singleton_method(name) do
23
+ subtype_cache[name] ||= Dir.glob(
24
+ File.join(DATA_DIR, "*", @group.to_s, "#{name}.txt")
25
+ ).sort.flat_map { |path| File.readlines(path, chomp: true) }
26
+ end
27
+ end
28
+
29
+ def all
30
+ return @all ||= @subtypes.flat_map { |s| send(s) } if @subtypes
31
+
32
+ @all ||= Dir.glob(File.join(DATA_DIR, "*", "#{@group}.txt")).sort.flat_map do |path|
33
+ File.readlines(path, chomp: true)
34
+ end
35
+ end
36
+
37
+ def sample(count = nil)
38
+ return all.sample(count) if count
39
+
40
+ all.sample
41
+ end
42
+
43
+ private
44
+
45
+ def subtype_cache
46
+ @subtype_cache ||= {}
47
+ end
48
+ end
49
+ end
50
+ end