ronin-wordlists 0.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.document +4 -0
  3. data/.github/workflows/ruby.yml +43 -0
  4. data/.gitignore +14 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +18 -0
  7. data/.ruby-version +1 -0
  8. data/.yardopts +1 -0
  9. data/COPYING.txt +165 -0
  10. data/ChangeLog.md +10 -0
  11. data/Gemfile +37 -0
  12. data/README.md +180 -0
  13. data/Rakefile +45 -0
  14. data/bin/ronin-wordlists +34 -0
  15. data/data/completions/ronin-wordlists +107 -0
  16. data/data/completions/ronin-wordlists.yml +7 -0
  17. data/data/wordlists.yml +260 -0
  18. data/gemspec.yml +40 -0
  19. data/lib/ronin/wordlists/cache_dir.rb +257 -0
  20. data/lib/ronin/wordlists/cli/command.rb +40 -0
  21. data/lib/ronin/wordlists/cli/commands/completion.rb +61 -0
  22. data/lib/ronin/wordlists/cli/commands/download.rb +109 -0
  23. data/lib/ronin/wordlists/cli/commands/list.rb +79 -0
  24. data/lib/ronin/wordlists/cli/commands/purge.rb +60 -0
  25. data/lib/ronin/wordlists/cli/commands/remove.rb +74 -0
  26. data/lib/ronin/wordlists/cli/commands/search.rb +145 -0
  27. data/lib/ronin/wordlists/cli/commands/update.rb +98 -0
  28. data/lib/ronin/wordlists/cli/wordlist_dir_option.rb +64 -0
  29. data/lib/ronin/wordlists/cli/wordlist_index.rb +178 -0
  30. data/lib/ronin/wordlists/cli/wordlist_option.rb +66 -0
  31. data/lib/ronin/wordlists/cli.rb +56 -0
  32. data/lib/ronin/wordlists/exceptions.rb +47 -0
  33. data/lib/ronin/wordlists/mixin.rb +106 -0
  34. data/lib/ronin/wordlists/root.rb +28 -0
  35. data/lib/ronin/wordlists/search_paths.rb +153 -0
  36. data/lib/ronin/wordlists/version.rb +26 -0
  37. data/lib/ronin/wordlists/wordlist_dir.rb +194 -0
  38. data/lib/ronin/wordlists/wordlist_file.rb +141 -0
  39. data/lib/ronin/wordlists/wordlist_metadata.rb +43 -0
  40. data/lib/ronin/wordlists/wordlist_repo.rb +167 -0
  41. data/lib/ronin/wordlists.rb +96 -0
  42. data/man/ronin-wordlists-completion.1 +76 -0
  43. data/man/ronin-wordlists-completion.1.md +78 -0
  44. data/man/ronin-wordlists-download.1 +47 -0
  45. data/man/ronin-wordlists-download.1.md +48 -0
  46. data/man/ronin-wordlists-list.1 +42 -0
  47. data/man/ronin-wordlists-list.1.md +44 -0
  48. data/man/ronin-wordlists-purge.1 +39 -0
  49. data/man/ronin-wordlists-purge.1.md +39 -0
  50. data/man/ronin-wordlists-remove.1 +43 -0
  51. data/man/ronin-wordlists-remove.1.md +44 -0
  52. data/man/ronin-wordlists-search.1 +37 -0
  53. data/man/ronin-wordlists-search.1.md +37 -0
  54. data/man/ronin-wordlists-update.1 +43 -0
  55. data/man/ronin-wordlists-update.1.md +44 -0
  56. data/man/ronin-wordlists.1 +65 -0
  57. data/man/ronin-wordlists.1.md +64 -0
  58. data/ronin-wordlists.gemspec +62 -0
  59. data/scripts/setup +58 -0
  60. metadata +154 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 55aa1d06ac34a5ac5bf0a7f414a3432463558bdb678a4dbe679e74b33dc93e40
4
+ data.tar.gz: 82ce199f4649d16d7382fc0d099fe62f32d6dd3af0e7bde376068a40de7cafb5
5
+ SHA512:
6
+ metadata.gz: 2377377f8f9e3c53b3a32484134eb18431c73bc06a25840b9b5455f46862de5dc13396cea237b00aff90bd9322c22ccb808523d9b06cc31119ef0ed562f6d79e
7
+ data.tar.gz: fec942e72678ab0ec0c42a9a58c5953fbd490d1f18ec41c16da51ef2736cb8fb0a59fc6e1c890de2cdbfa518d379ed493c6b7933ba2e818507ca9f2d3fc88ed4
data/.document ADDED
@@ -0,0 +1,4 @@
1
+ lib/**/*.rb
2
+ -
3
+ ChangeLog.md
4
+ COPYING.txt
@@ -0,0 +1,43 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - '3.0'
13
+ - '3.1'
14
+ - '3.2'
15
+ - '3.3'
16
+ - jruby
17
+ # - truffleruby
18
+ name: Ruby ${{ matrix.ruby }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - name: Install dependencies
27
+ run: bundle install --jobs 4 --retry 3
28
+ - name: Run tests
29
+ run: bundle exec rake test
30
+
31
+ # rubocop linting
32
+ rubocop:
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - name: Set up Ruby
37
+ uses: ruby/setup-ruby@v1
38
+ with:
39
+ ruby-version: 3.0
40
+ - name: Install dependencies
41
+ run: bundle install --jobs 4 --retry 3
42
+ - name: Run rubocop
43
+ run: bundle exec rubocop --parallel
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /coverage
2
+ /data/completions/ronin-wordlists
3
+ /doc
4
+ /pkg
5
+ /man/*.[1-9]
6
+ /vendor/bundle
7
+ /Gemfile.lock
8
+ /.bundle
9
+ /.yardoc
10
+ .DS_Store
11
+ *.db
12
+ *.log
13
+ *.swp
14
+ *~
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+ TargetRubyVersion: 3.1
5
+
6
+ inherit_gem:
7
+ rubocop-ronin: rubocop.yml
8
+
9
+ #
10
+ # ronin-wordlists specific exceptions
11
+ #
12
+
13
+ # make an exception for when we need to test the #each method directly
14
+ Style/MapIntoArray:
15
+ Exclude:
16
+ - 'spec/cache_dir_spec.rb'
17
+ - 'spec/search_paths_spec.rb'
18
+ - 'spec/wordlist_dir_spec.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.1
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup markdown --title 'Ronin::Wordlists Documentation' --protected
data/COPYING.txt ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/ChangeLog.md ADDED
@@ -0,0 +1,10 @@
1
+ ### 0.1.0 / 2024-XX-XX
2
+
3
+ * Initial release:
4
+ * Installs, updates, and manages wordlist files and Git repositories.
5
+ * Contains a curated list of popular wordlists and their download URLs.
6
+ * Allows looking wordlists up by name, instead of explicit path.
7
+ * Supports searching for wordlists in `/usr/share/wordlists` (Kali Linux),
8
+ `/usr/local/wordlists`, and `~/.cache/ronin-wordlists/wordlists`
9
+ directories.
10
+
data/Gemfile ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
5
+
6
+ platform :jruby do
7
+ gem 'jruby-openssl', '~> 0.7'
8
+ end
9
+
10
+ # gem 'wordlist', '~> 1.1', github: 'postmodern/wordlist.rb'
11
+
12
+ # Ronin dependencies
13
+ # gem 'ronin-core', '~> 0.2', github: "ronin-rb/ronin-core",
14
+ # branch: 'main'
15
+
16
+ group :development do
17
+ gem 'rake'
18
+ gem 'rubygems-tasks', '~> 0.2'
19
+
20
+ gem 'rspec', '~> 3.0'
21
+ gem 'simplecov', '~> 0.20'
22
+
23
+ gem 'kramdown', '~> 2.0'
24
+ gem 'kramdown-man', '~> 1.0'
25
+
26
+ gem 'redcarpet', platform: :mri
27
+ gem 'yard', '~> 0.9'
28
+ gem 'yard-spellcheck', require: false
29
+
30
+ gem 'dead_end', require: false
31
+ gem 'sord', require: false, platform: :mri
32
+ gem 'stackprof', require: false, platform: :mri
33
+ gem 'rubocop', require: false, platform: :mri
34
+ gem 'rubocop-ronin', require: false, platform: :mri
35
+
36
+ gem 'command_kit-completion', '~> 0.2', require: false
37
+ end
data/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # ronin-wordlists
2
+
3
+ [![CI](https://github.com/ronin-rb/ronin-wordlists/actions/workflows/ruby.yml/badge.svg)](https://github.com/ronin-rb/ronin-wordlists/actions/workflows/ruby.yml)
4
+ [![Code Climate](https://codeclimate.com/github/ronin-rb/ronin-wordlists.svg)](https://codeclimate.com/github/ronin-rb/ronin-wordlists)
5
+
6
+ * [Website](https://ronin-rb.dev/)
7
+ * [Source](https://github.com/ronin-rb/ronin-wordlists)
8
+ * [Issues](https://github.com/ronin-rb/ronin-wordlists/issues)
9
+ * [Documentation](https://ronin-rb.dev/docs/ronin-wordlists/frames)
10
+ * [Discord](https://discord.gg/6WAb3PsVX9) |
11
+ [Mastodon](https://infosec.exchange/@ronin_rb)
12
+
13
+ ## Description
14
+
15
+ ronin-wordlists is a library and tool for managing wordlists. ronin-wordlists
16
+ can install and update wordlists, and contains a curated list of popular
17
+ wordlists and their download URLs.
18
+
19
+ ## Features
20
+
21
+ * Installs, updates, and manages wordlist files and Git repositories.
22
+ * Contains a curated list of popular wordlists and their download URLs.
23
+ * Allows looking wordlists up by name, instead of explicit path.
24
+ * Supports searching for wordlists in `/usr/share/wordlists` (Kali Linux),
25
+ `/usr/local/wordlists`, and `~/.cache/ronin-wordlists/wordlists` directories.
26
+
27
+ ## Synopsis
28
+
29
+ ```
30
+ $ ronin-wordlists
31
+ Usage: ronin-wordlists [options]
32
+
33
+ Options:
34
+ -V, --version Prints the version and exits
35
+ -h, --help Print help information
36
+
37
+ Arguments:
38
+ [COMMAND] The command name to run
39
+ [ARGS ...] Additional arguments for the command
40
+
41
+ Commands:
42
+ completion
43
+ download, install
44
+ help
45
+ list, ls
46
+ purge
47
+ remove, rm
48
+ search
49
+ update, up
50
+ ```
51
+
52
+ List popular wordlists available for download or installation:
53
+
54
+ ```shell
55
+ $ ronin-wordlists search
56
+ [ alexa-top-1000 ]
57
+
58
+ * URL: https://github.com/urbanadventurer/WhatWeb/blob/master/plugin-development/alexa-top-1000.txt
59
+ * Categories: dns, domains
60
+ * Summary: The Alexa Top 1000 domain names.
61
+
62
+ [ subdomains ]
63
+
64
+ * URL: https://raw.githubusercontent.com/rbsec/dnscan/master/subdomains.txt
65
+ * Categories: dns, subdomains
66
+ * Summary: List of common subdomain names used by the dnscan util.
67
+
68
+ ...
69
+ ```
70
+
71
+ Download a known wordlist:
72
+
73
+ ```shell
74
+ ronin-wordlists download rockyou
75
+ ```
76
+
77
+ Download a wordlist from a URL:
78
+
79
+ ```shell
80
+ ronin-wordlists download https://example.com/path/to/wordlist.gz
81
+ ```
82
+
83
+ Update all downloaded wordlists:
84
+
85
+ ```shell
86
+ ronin-wordlists update
87
+ ```
88
+
89
+ Update a specific wordlist:
90
+
91
+ ```shell
92
+ ronin-wordlists update SecLists
93
+ ```
94
+
95
+ ## Examples
96
+
97
+ Open a wordlist by name:
98
+
99
+ ```ruby
100
+ require 'ronin/wordlists'
101
+
102
+ wordlist = Ronin::Wordlists.open('alexa-top-1000')
103
+ # =>
104
+ # #<Wordlist::File:0x00007f7b548bf840
105
+ # @format=:txt,
106
+ # @path="/home/ronin/.cache/ronin-wordlists/wordlists/alexa-top-1000.txt">
107
+
108
+ wordlist.each do |word|
109
+ # ...
110
+ end
111
+ ```
112
+
113
+ Download a custom wordlist into `~/.cache/ronin-wordlists/wordlists`:
114
+
115
+ ```ruby
116
+ Ronin::Wordlists.download('https://...')
117
+ ```
118
+
119
+ List installed wordlists:
120
+
121
+ ```ruby
122
+ Ronin::Wordlists.list
123
+ # => #<Set: {"alexa-top-1000.txt", "rockyou.txt", ...}>
124
+ ```
125
+
126
+ ## Requirements
127
+
128
+ * [Ruby] >= 3.0.0
129
+ * [wordlist] ~> 1.1
130
+ * [ronin-core] ~> 0.2
131
+
132
+ ## Install
133
+
134
+ ```shell
135
+ gem install ronin-wordlists
136
+ ```
137
+
138
+ ### Gemfile
139
+
140
+ ```ruby
141
+ gem 'ronin-wordlists', '~> 0.1'
142
+ ```
143
+
144
+ ### gemspec
145
+
146
+ ```ruby
147
+ gem.add_dependency 'ronin-wordlists', '~> 0.1'
148
+ ```
149
+
150
+ ## Development
151
+
152
+ 1. [Fork It!](https://github.com/ronin-rb/ronin-wordlists/fork)
153
+ 2. Clone It!
154
+ 3. `cd ronin-wordlists/`
155
+ 4. `./scripts/setup`
156
+ 5. `git checkout -b my_feature`
157
+ 6. Code It!
158
+ 7. `bundle exec rake spec`
159
+ 8. `git push origin my_feature`
160
+
161
+ ## License
162
+
163
+ Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
164
+
165
+ ronin-wordlists is free software: you can redistribute it and/or modify
166
+ it under the terms of the GNU Lesser General Public License as published
167
+ by the Free Software Foundation, either version 3 of the License, or
168
+ (at your option) any later version.
169
+
170
+ ronin-wordlists is distributed in the hope that it will be useful,
171
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
172
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
173
+ GNU Lesser General Public License for more details.
174
+
175
+ You should have received a copy of the GNU Lesser General Public License
176
+ along with ronin-wordlists. If not, see <https://www.gnu.org/licenses/>.
177
+
178
+ [Ruby]: https://www.ruby-lang.org
179
+ [wordlist]: https://github.com/postmodern/wordlist.rb#readme
180
+ [ronin-core]: https://github.com/ronin-rb/ronin-core#readme
data/Rakefile ADDED
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+ require 'rubygems'
3
+
4
+ begin
5
+ require 'bundler'
6
+ rescue LoadError => e
7
+ warn e.message
8
+ warn "Run `gem install bundler` to install Bundler"
9
+ exit(-1)
10
+ end
11
+
12
+ begin
13
+ Bundler.setup(:development)
14
+ rescue Bundler::BundlerError => e
15
+ warn e.message
16
+ warn "Run `bundle install` to install missing gems"
17
+ exit e.status_code
18
+ end
19
+
20
+ require 'rake'
21
+
22
+ require 'rubygems/tasks'
23
+ Gem::Tasks.new(sign: {checksum: true, pgp: true})
24
+
25
+ require 'rspec/core/rake_task'
26
+ RSpec::Core::RakeTask.new
27
+ task :test => :spec
28
+ task :default => :spec
29
+
30
+ require 'yard'
31
+ YARD::Rake::YardocTask.new
32
+ task :docs => :yard
33
+
34
+ require 'kramdown/man/task'
35
+ Kramdown::Man::Task.new
36
+
37
+ require 'command_kit/completion/task'
38
+ CommandKit::Completion::Task.new(
39
+ class_file: 'ronin/wordlists/cli',
40
+ class_name: 'Ronin::Wordlists::CLI',
41
+ input_file: 'data/completions/ronin-wordlists.yml',
42
+ output_file: 'data/completions/ronin-wordlists'
43
+ )
44
+
45
+ task :setup => %w[man command_kit:completion]
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # ronin-wordlists - A library for managing wordlists.
5
+ #
6
+ # Copyright (c) 2023 Hal Brodigan (postmodern.mod3@gmail.com)
7
+ #
8
+ # ronin-wordlists is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-wordlists is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-wordlists. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ root = File.expand_path(File.join(__dir__,'..'))
23
+ if File.file?(File.join(root,'Gemfile.lock'))
24
+ Dir.chdir(root) do
25
+ require 'bundler/setup'
26
+ rescue LoadError => e
27
+ warn e.message
28
+ warn "Run `gem install bundler` to install Bundler"
29
+ exit(-1)
30
+ end
31
+ end
32
+
33
+ require 'ronin/wordlists/cli'
34
+ Ronin::Wordlists::CLI.start
@@ -0,0 +1,107 @@
1
+ # ronin-wordlists completion -*- shell-script -*-
2
+
3
+ # This bash completions script was generated by
4
+ # completely (https://github.com/dannyben/completely)
5
+ # Modifying it manually is not recommended
6
+
7
+ _ronin-wordlists_completions_filter() {
8
+ local words="$1"
9
+ local cur=${COMP_WORDS[COMP_CWORD]}
10
+ local result=()
11
+
12
+ if [[ "${cur:0:1}" == "-" ]]; then
13
+ echo "$words"
14
+
15
+ else
16
+ for word in $words; do
17
+ [[ "${word:0:1}" != "-" ]] && result+=("$word")
18
+ done
19
+
20
+ echo "${result[*]}"
21
+
22
+ fi
23
+ }
24
+
25
+ _ronin-wordlists_completions() {
26
+ local cur=${COMP_WORDS[COMP_CWORD]}
27
+ local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")
28
+ local compline="${compwords[*]}"
29
+
30
+ case "$compline" in
31
+ 'download'*'--wordlist-dir')
32
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
33
+ ;;
34
+
35
+ 'remove'*'--wordlist-dir')
36
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
37
+ ;;
38
+
39
+ 'purge'*'--wordlist-dir')
40
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
41
+ ;;
42
+
43
+ 'list'*'--wordlist-dir')
44
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
45
+ ;;
46
+
47
+ 'download'*'-d')
48
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
49
+ ;;
50
+
51
+ 'completion'*)
52
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "--print --install --uninstall")" -- "$cur" )
53
+ ;;
54
+
55
+ 'remove'*'-d')
56
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
57
+ ;;
58
+
59
+ 'download'*)
60
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "--wordlist-dir -d")" -- "$cur" )
61
+ ;;
62
+
63
+ 'purge'*'-d')
64
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
65
+ ;;
66
+
67
+ 'list'*'-d')
68
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
69
+ ;;
70
+
71
+ 'remove'*)
72
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "--wordlist-dir -d $(ronin-wordlists list)")" -- "$cur" )
73
+ ;;
74
+
75
+ 'search'*)
76
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "--category -c")" -- "$cur" )
77
+ ;;
78
+
79
+ 'update'*)
80
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "$(ronin-wordlists list)")" -- "$cur" )
81
+ ;;
82
+
83
+ 'purge'*)
84
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "--wordlist-dir -d")" -- "$cur" )
85
+ ;;
86
+
87
+ 'list'*)
88
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "--wordlist-dir -d")" -- "$cur" )
89
+ ;;
90
+
91
+ 'rm'*)
92
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "$(ronin-wordlists list)")" -- "$cur" )
93
+ ;;
94
+
95
+ 'up'*)
96
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "$(ronin-wordlists list)")" -- "$cur" )
97
+ ;;
98
+
99
+ *)
100
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-wordlists_completions_filter "--version -V help completion download list purge remove search update install ls up rm")" -- "$cur" )
101
+ ;;
102
+
103
+ esac
104
+ } &&
105
+ complete -F _ronin-wordlists_completions ronin-wordlists
106
+
107
+ # ex: filetype=sh