ronin-repos 0.1.0 → 0.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.document +0 -1
  3. data/.github/workflows/ruby.yml +16 -1
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +21 -0
  6. data/ChangeLog.md +28 -1
  7. data/Gemfile +11 -5
  8. data/README.md +19 -5
  9. data/Rakefile +12 -2
  10. data/bin/ronin-repos +6 -7
  11. data/data/completions/ronin-repos +139 -0
  12. data/data/completions/ronin-repos.yml +10 -0
  13. data/data/templates/repo/README.md.erb +1 -1
  14. data/gemspec.yml +11 -2
  15. data/lib/ronin/repos/cache_dir.rb +6 -7
  16. data/lib/ronin/repos/class_dir.rb +21 -14
  17. data/lib/ronin/repos/cli/command.rb +5 -3
  18. data/lib/ronin/repos/cli/commands/completion.rb +61 -0
  19. data/lib/ronin/repos/cli/commands/install.rb +7 -3
  20. data/lib/ronin/repos/cli/commands/list.rb +15 -18
  21. data/lib/ronin/repos/cli/commands/new.rb +7 -3
  22. data/lib/ronin/repos/cli/commands/purge.rb +17 -2
  23. data/lib/ronin/repos/cli/commands/remove.rb +1 -1
  24. data/lib/ronin/repos/cli/commands/show.rb +93 -0
  25. data/lib/ronin/repos/cli/commands/update.rb +2 -2
  26. data/lib/ronin/repos/cli.rb +5 -4
  27. data/lib/ronin/repos/exceptions.rb +4 -4
  28. data/lib/ronin/repos/repository.rb +33 -4
  29. data/lib/ronin/repos/root.rb +1 -1
  30. data/lib/ronin/repos/version.rb +2 -2
  31. data/lib/ronin/repos.rb +19 -5
  32. data/man/ronin-repos-completion.1 +76 -0
  33. data/man/ronin-repos-completion.1.md +78 -0
  34. data/man/ronin-repos-install.1 +27 -37
  35. data/man/ronin-repos-install.1.md +22 -15
  36. data/man/ronin-repos-list.1 +27 -33
  37. data/man/ronin-repos-list.1.md +22 -15
  38. data/man/ronin-repos-new.1 +17 -18
  39. data/man/ronin-repos-new.1.md +34 -0
  40. data/man/ronin-repos-purge.1 +26 -33
  41. data/man/ronin-repos-purge.1.md +20 -13
  42. data/man/ronin-repos-remove.1 +23 -35
  43. data/man/ronin-repos-remove.1.md +18 -14
  44. data/man/ronin-repos-show.1 +48 -0
  45. data/man/ronin-repos-show.1.md +48 -0
  46. data/man/ronin-repos-update.1 +26 -36
  47. data/man/ronin-repos-update.1.md +22 -15
  48. data/man/ronin-repos.1 +43 -31
  49. data/man/ronin-repos.1.md +35 -11
  50. data/ronin-repos.gemspec +4 -3
  51. data/scripts/setup +58 -0
  52. metadata +19 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30c76d7743b473b4df8d834209051aa7643aafade9edcc3e3f12e8b344741e7f
4
- data.tar.gz: a4c58c0869e1b44a4c5da6589760f86cf261af3dcfe6478a8cff01efe1bab9c1
3
+ metadata.gz: b43c676948f9c9db4f57ccea422578e0704a9d7fb1514753b7493fa6e199c27f
4
+ data.tar.gz: 5fb086f975e9f32d318ecffea62277b925637e7cb1ae5a0489bee86be5fcc052
5
5
  SHA512:
6
- metadata.gz: 92a8b69b652f962de02fd63b9fbc8e71636c669126e0ab96e769e4aa9894aa70689bc275001e6ddfe214606977618b003daf3de8dfb7966c1feff4e96a910221
7
- data.tar.gz: fa460921d3bf47e09714d3fdfeb01d392739ef96366df19f2f6262df1c8df4d37f8eef05bc6f7ac56f0815b76fc8e0c6efd37e23111b788c29db4c3fdc5aa651
6
+ metadata.gz: 6a91bc01c3266d23b53f27270537fafe9d2c71db686f83e13aac733ac8fc5ee23a18c2c5c4b736ca42297baff252fe376ef5560c9eae1f99c6a41a024213f8ea
7
+ data.tar.gz: 85450d4e6c41a38b7272d440f95d0fad05bb8cd3bad14e7ded9e10f6348f22d789c86abc562febb6b63bc008669debf497c150d16cccc725f65c331f9de4becc
data/.document CHANGED
@@ -2,4 +2,3 @@ lib/**/*.rb
2
2
  -
3
3
  ChangeLog.md
4
4
  COPYING.txt
5
- man/*.md
@@ -12,11 +12,12 @@ jobs:
12
12
  - '3.0'
13
13
  - '3.1'
14
14
  - '3.2'
15
+ - '3.3'
15
16
  - jruby
16
17
  - truffleruby
17
18
  name: Ruby ${{ matrix.ruby }}
18
19
  steps:
19
- - uses: actions/checkout@v2
20
+ - uses: actions/checkout@v4
20
21
  - name: Set up Ruby
21
22
  uses: ruby/setup-ruby@v1
22
23
  with:
@@ -26,3 +27,17 @@ jobs:
26
27
  run: bundle install --jobs 4 --retry 3
27
28
  - name: Run tests
28
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 CHANGED
@@ -1,4 +1,5 @@
1
1
  /coverage
2
+ /data/completions/ronin-repos
2
3
  /doc
3
4
  /pkg
4
5
  /man/*.[1-9]
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
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-repos specific exceptions
11
+ #
12
+
13
+ Lint/EmptyFile:
14
+ Exclude:
15
+ - 'spec/fixtures/class_dir/file1.rb'
16
+ - 'spec/fixtures/class_dir/file2.rb'
17
+ - 'spec/fixtures/class_dir/only_in_class_dir.rb'
18
+
19
+ Style/MapIntoArray:
20
+ Exclude:
21
+ - 'spec/cache_dir_spec.rb'
data/ChangeLog.md CHANGED
@@ -1,4 +1,31 @@
1
- ### 0.1.0 / 2023-XX-XX
1
+ ### 0.2.0 / 2024-XX-XX
2
+
3
+ * Added {Ronin::Repos::Repository#url}.
4
+ * Added {Ronin::Repos::Repository#last_updated_at}.
5
+ * Added {Ronin::Repos.cache_dir}.
6
+
7
+ #### CLI
8
+
9
+ * Added the `ronin-repos show` command.
10
+ * Changed `ronin-repos list` to fuzzy match repo names.
11
+ * Changed `ronin-repos new` to also create empty `exploits/`, `payloads/`,
12
+ `recon/`, and `brute/`.
13
+ * Added the `ronin-repos completion` command to install shell completion files
14
+ for all `ronin-repos` commands for Bash and Zsh shells.
15
+
16
+ ### 0.1.1 / 2023-06-09
17
+
18
+ * Fixed a bug in {Ronin::Repos::ClassDir::ClassMethods#list_files} where the
19
+ {Ronin::Repos::ClassDir::ClassMethods#repo_class_dir repo_class_dir} was not
20
+ being removed from paths.
21
+ * Documentation fixes and improvements.
22
+
23
+ #### CLI
24
+
25
+ * Multiple bug fixes to the `ronin-repos install` command.
26
+ * Add missing man-page for the `ronin-repos new` command.
27
+
28
+ ### 0.1.0 / 2023-02-01
2
29
 
3
30
  * Initial release:
4
31
  * Supports installing any [Git][git] repository.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -7,10 +9,10 @@ platform :jruby do
7
9
  end
8
10
 
9
11
  # Ronin dependencies:
10
- # gem 'ronin-core', '~> 0.1', github: "ronin-rb/ronin-core",
12
+ # gem 'ronin-core', '~> 0.2', github: 'ronin-rb/ronin-core',
11
13
  # branch: 'main'
12
14
 
13
- # gem 'command_kit', '~> 0.4', github: 'postmodern/command_kit.rb',
15
+ # gem 'command_kit', '~> 0.5', github: 'postmodern/command_kit.rb',
14
16
  # branch: 'main'
15
17
 
16
18
  group :development do
@@ -20,13 +22,17 @@ group :development do
20
22
  gem 'simplecov', '~> 0.20'
21
23
 
22
24
  gem 'kramdown', '~> 2.0'
23
- gem 'kramdown-man', '~> 0.1'
25
+ gem 'kramdown-man', '~> 1.0'
24
26
 
25
27
  gem 'redcarpet', platform: :mri
26
28
  gem 'yard', '~> 0.9'
27
29
  gem 'yard-spellcheck', require: false
28
30
 
29
31
  gem 'dead_end', require: false
30
- gem 'sord', require: false, platforms: :mri
31
- gem 'stackprof', require: false, platforms: :mri
32
+ gem 'sord', require: false, platform: :mri
33
+ gem 'stackprof', require: false, platform: :mri
34
+ gem 'rubocop', require: false, platform: :mri
35
+ gem 'rubocop-ronin', require: false, platform: :mri
36
+
37
+ gem 'command_kit-completion', '~> 0.2', require: false
32
38
  end
data/README.md CHANGED
@@ -9,13 +9,23 @@
9
9
  * [Issues](https://github.com/ronin-rb/ronin-repos/issues)
10
10
  * [Documentation](https://ronin-rb.dev/docs/ronin-repos/frames)
11
11
  * [Discord](https://discord.gg/6WAb3PsVX9) |
12
- [Twitter](https://twitter.com/ronin_rb) |
13
12
  [Mastodon](https://infosec.exchange/@ronin_rb)
14
13
 
15
14
  ## Description
16
15
 
17
16
  ronin-repos provides a repository system for installing, managing, and accessing
18
- third-party git repositories, which can contain code or other data.
17
+ third-party git repositories, that can contain additional Ruby code or other
18
+ data.
19
+
20
+ Third-party git repositories can be used to extend parts of Ronin. Other Ronin
21
+ libraries can then list and load additional third-party Ruby classes from
22
+ specific directories within the installed third-party repos:
23
+
24
+ * `exploits/` - may contain additional exploits for [ronin-exploits].
25
+ * `payloads/` - may contain additional payloads for [ronin-payloads].
26
+
27
+ **tl;dr** ronin-repos is essentially a decentralized plugin system for Ronin
28
+ using git repos.
19
29
 
20
30
  ronin-repos is part of the [ronin-rb] project, a toolkit for security research
21
31
  and development.
@@ -40,12 +50,14 @@ Arguments:
40
50
  [ARGS ...] Additional arguments for the command
41
51
 
42
52
  Commands:
53
+ completion
43
54
  help
44
55
  install
45
56
  list, ls
46
57
  new
47
58
  purge
48
59
  remove, rm
60
+ show, info
49
61
  update, up
50
62
  ```
51
63
 
@@ -111,7 +123,7 @@ Rnnin::Repos.glob("wordlists/*.txt")
111
123
  ## Requirements
112
124
 
113
125
  * [Ruby] >= 3.0.0
114
- * [ronin-core] ~> 0.1
126
+ * [ronin-core] ~> 0.2
115
127
 
116
128
  ## Install
117
129
 
@@ -130,7 +142,7 @@ gem 'ronin-repos', '~> 0.1'
130
142
  1. [Fork It!](https://github.com/ronin-rb/ronin-repos/fork)
131
143
  2. Clone It!
132
144
  3. `cd ronin-repos`
133
- 4. `bundle install`
145
+ 4. `./scripts/server`
134
146
  5. `git checkout -b my_feature`
135
147
  6. Code It!
136
148
  7. `bundle exec rake spec`
@@ -138,7 +150,7 @@ gem 'ronin-repos', '~> 0.1'
138
150
 
139
151
  ## License
140
152
 
141
- Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
153
+ Copyright (c) 2021-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
142
154
 
143
155
  ronin-repos is free software: you can redistribute it and/or modify
144
156
  it under the terms of the GNU Lesser General Public License as published
@@ -158,3 +170,5 @@ along with ronin-repos. If not, see <https://www.gnu.org/licenses/>.
158
170
  [Ruby]: https://www.ruby-lang.org
159
171
  [git]: https://git-scm.com/
160
172
  [ronin-core]: https://github.com/ronin-rb/ronin-core#readme
173
+ [ronin-exploits]: https://github.com/ronin-rb/ronin-exploits#readme
174
+ [ronin-payloads]: https://github.com/ronin-rb/ronin-payloads#readme
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
- require 'rubygems'
1
+ # frozen_string_literal: true
2
2
 
3
3
  begin
4
4
  require 'bundler'
5
5
  rescue LoadError => e
6
6
  warn e.message
7
7
  warn "Run `gem install bundler` to install Bundler"
8
- exit -1
8
+ exit(-1)
9
9
  end
10
10
 
11
11
  begin
@@ -32,3 +32,13 @@ task :docs => :yard
32
32
 
33
33
  require 'kramdown/man/task'
34
34
  Kramdown::Man::Task.new
35
+
36
+ require 'command_kit/completion/task'
37
+ CommandKit::Completion::Task.new(
38
+ class_file: 'ronin/repos/cli',
39
+ class_name: 'Ronin::Repos::CLI',
40
+ input_file: 'data/completions/ronin-repos.yml',
41
+ output_file: 'data/completions/ronin-repos'
42
+ )
43
+
44
+ task :setup => %w[man command_kit:completion]
data/bin/ronin-repos CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
4
5
  #
@@ -21,13 +22,11 @@
21
22
  root = File.expand_path(File.join(__dir__,'..'))
22
23
  if File.file?(File.join(root,'Gemfile.lock'))
23
24
  Dir.chdir(root) do
24
- begin
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
25
+ require 'bundler/setup'
26
+ rescue LoadError => e
27
+ warn e.message
28
+ warn "Run `gem install bundler` to install Bundler"
29
+ exit(-1)
31
30
  end
32
31
  end
33
32
 
@@ -0,0 +1,139 @@
1
+ # ronin-repos 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-repos_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-repos_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
+ 'install'*'--cache-dir')
32
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
33
+ ;;
34
+
35
+ 'remove'*'--cache-dir')
36
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
37
+ ;;
38
+
39
+ 'update'*'--cache-dir')
40
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
41
+ ;;
42
+
43
+ 'purge'*'--cache-dir')
44
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
45
+ ;;
46
+
47
+ 'list'*'--cache-dir')
48
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
49
+ ;;
50
+
51
+ 'show'*'--cache-dir')
52
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
53
+ ;;
54
+
55
+ 'new'*'--cache-dir')
56
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
57
+ ;;
58
+
59
+ 'completion'*)
60
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--print --install --uninstall")" -- "$cur" )
61
+ ;;
62
+
63
+ 'install'*'-C')
64
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
65
+ ;;
66
+
67
+ 'remove'*'-C')
68
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
69
+ ;;
70
+
71
+ 'update'*'-C')
72
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
73
+ ;;
74
+
75
+ 'purge'*'-C')
76
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
77
+ ;;
78
+
79
+ 'install'*)
80
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--cache-dir -C")" -- "$cur" )
81
+ ;;
82
+
83
+ 'list'*'-C')
84
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
85
+ ;;
86
+
87
+ 'show'*'-C')
88
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
89
+ ;;
90
+
91
+ 'new'*'-C')
92
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
93
+ ;;
94
+
95
+ 'remove'*)
96
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--cache-dir -C $(ronin-repos list)")" -- "$cur" )
97
+ ;;
98
+
99
+ 'update'*)
100
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--cache-dir -C $(ronin-repos list)")" -- "$cur" )
101
+ ;;
102
+
103
+ 'purge'*)
104
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--cache-dir -C")" -- "$cur" )
105
+ ;;
106
+
107
+ 'list'*)
108
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--cache-dir -C")" -- "$cur" )
109
+ ;;
110
+
111
+ 'show'*)
112
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--cache-dir -C $(ronin-repos list)")" -- "$cur" )
113
+ ;;
114
+
115
+ 'info'*)
116
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "$(ronin-repos list)")" -- "$cur" )
117
+ ;;
118
+
119
+ 'new'*)
120
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--cache-dir -C")" -- "$cur" )
121
+ ;;
122
+
123
+ 'rm'*)
124
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "$(ronin-repos list)")" -- "$cur" )
125
+ ;;
126
+
127
+ 'up'*)
128
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "$(ronin-repos list)")" -- "$cur" )
129
+ ;;
130
+
131
+ *)
132
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-repos_completions_filter "--version -V help completion install list new purge remove show update ls up rm info")" -- "$cur" )
133
+ ;;
134
+
135
+ esac
136
+ } &&
137
+ complete -F _ronin-repos_completions ronin-repos
138
+
139
+ # ex: filetype=sh
@@ -0,0 +1,10 @@
1
+ ---
2
+ ronin-repos remove: &remove
3
+ - $(ronin-repos list)
4
+ ronin-repos rm: *remove
5
+ ronin-repos show: &show
6
+ - $(ronin-repos list)
7
+ ronin-repos info: *show
8
+ ronin-repos update: &update
9
+ - $(ronin-repos list)
10
+ ronin-repos up: *update
@@ -5,7 +5,7 @@
5
5
  This git repository can be installed by the [ronin-repos] command:
6
6
 
7
7
  ```shell
8
- ronin-repos download https://github.com/<%= @github_user %>/<%= @name %>.git
8
+ ronin-repos install https://github.com/<%= @github_user %>/<%= @name %>.git
9
9
  ```
10
10
 
11
11
  [ronin-repos]: https://github.com/ronin-rb/ronin-repos#readme
data/gemspec.yml CHANGED
@@ -2,7 +2,13 @@ name: ronin-repos
2
2
  summary: Third-party git repository support for ronin.
3
3
  description:
4
4
  ronin-repos provides a repository system for installing, managing, and
5
- accessing third-party git repositories, which can contain code or other data.
5
+ accessing third-party git repositories, that can contain additional Ruby code
6
+ or other data. Other Ronin libraries, such as ronin-exploits or
7
+ ronin-payloads, can then list and load additional third-party Ruby classes
8
+ from specific directories within the installed third-party reposs.
9
+
10
+ ronin-repos is essentially a decentralized plugin system for Ronin using git
11
+ repos.
6
12
 
7
13
  license: LGPL-3.0
8
14
  authors: Postmodern
@@ -18,11 +24,14 @@ metadata:
18
24
  rubygems_mfa_required: 'true'
19
25
 
20
26
  generated_files:
27
+ - data/completions/ronin-repos
21
28
  - man/ronin-repos.1
29
+ - man/ronin-repos-completion.1
22
30
  - man/ronin-repos-install.1
23
31
  - man/ronin-repos-list.1
24
32
  - man/ronin-repos-new.1
25
33
  - man/ronin-repos-remove.1
34
+ - man/ronin-repos-show.1
26
35
  - man/ronin-repos-update.1
27
36
  - man/ronin-repos-purge.1
28
37
 
@@ -30,7 +39,7 @@ required_ruby_version: ">= 3.0.0"
30
39
 
31
40
  dependencies:
32
41
  # Library dependencies:
33
- ronin-core: ~> 0.1
42
+ ronin-core: ~> 0.2.0.rc1
34
43
 
35
44
  development_dependencies:
36
45
  bundler: ~> 2.0
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ # Copyright (c) 2021-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
4
4
  #
5
5
  # ronin-repos is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU Lesser General Public License as published
@@ -34,7 +34,7 @@ module Ronin
34
34
 
35
35
  include Enumerable
36
36
 
37
- # The ~/.cache/ronin-repos/ directory where all repos are stored.
37
+ # The `~/.cache/ronin-repos/` directory where all repos are stored.
38
38
  PATH = Core::Home.cache_dir('ronin-repos')
39
39
 
40
40
  # The path to the cache directory.
@@ -52,7 +52,7 @@ module Ronin
52
52
  @path = path
53
53
  end
54
54
 
55
- #
55
+ #
56
56
  # Accesses a repository from the cache directory.
57
57
  #
58
58
  # @param [String] name
@@ -129,10 +129,9 @@ module Ronin
129
129
  #
130
130
  def update
131
131
  each do |repo|
132
- begin
133
- repo.update
134
- rescue CommandFailed
135
- end
132
+ repo.update
133
+ rescue CommandFailed
134
+ # ignore any `git` errors when updating
136
135
  end
137
136
  end
138
137
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ # Copyright (c) 2021-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
4
4
  #
5
5
  # ronin-repos is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU Lesser General Public License as published
@@ -33,12 +33,12 @@ module Ronin
33
33
  #
34
34
  # require 'ronin/core/module_registry'
35
35
  # require 'ronin/repos/class_dir'
36
- #
36
+ #
37
37
  # module Ronin
38
38
  # module Exploits
39
39
  # include Ronin::Core::ClassRegistry
40
40
  # include Ronin::Repos::ClassDir
41
- #
41
+ #
42
42
  # class_dir "#{__dir__}/classes"
43
43
  # repo_class_dir "exploits"
44
44
  # end
@@ -49,11 +49,11 @@ module Ronin
49
49
  # module Ronin
50
50
  # module Exploits
51
51
  # class Exploit
52
- #
52
+ #
53
53
  # def self.register(name)
54
54
  # Exploits.register(name,self)
55
55
  # end
56
- #
56
+ #
57
57
  # end
58
58
  # end
59
59
  # end
@@ -61,13 +61,13 @@ module Ronin
61
61
  # `~/.cache/ronin-repos/repo1/exploits/my_exploit.rb`:
62
62
  #
63
63
  # require 'ronin/exploits/exploit'
64
- #
64
+ #
65
65
  # module Ronin
66
66
  # module Exploits
67
67
  # class MyExploit < Exploit
68
- #
68
+ #
69
69
  # register 'my_exploit'
70
- #
70
+ #
71
71
  # end
72
72
  # end
73
73
  # end
@@ -88,6 +88,9 @@ module Ronin
88
88
  namespace.extend ClassMethods
89
89
  end
90
90
 
91
+ #
92
+ # Class-methods.
93
+ #
91
94
  module ClassMethods
92
95
  #
93
96
  # Gets or sets the repository module directory name.
@@ -97,7 +100,7 @@ module Ronin
97
100
  #
98
101
  # @return [String]
99
102
  # The repository module directory name.
100
- #
103
+ #
101
104
  # @raise [NotImplementedError]
102
105
  # The `repo_class_dir` method was not defined in the module.
103
106
  #
@@ -117,16 +120,20 @@ module Ronin
117
120
  # {#repo_class_dir} across all installed repositories.
118
121
  #
119
122
  # @return [Array<String>]
120
- #
123
+ #
121
124
  def list_files
122
- modules = Set.new(super)
123
- pattern = File.join(repo_class_dir,"{**/}*.rb")
125
+ paths = Set.new(super)
126
+ pattern = File.join(repo_class_dir,"{**/}*.rb")
127
+
128
+ # the String#slice range to remove the repo_class_dir/ and .rb ext
129
+ slice_range = (repo_class_dir.length + 1)...-3
124
130
 
125
131
  Repos.list_files(pattern).each do |path|
126
- modules << path.chomp('.rb')
132
+ # NOTE: String#slice is faster than .delete_prefix + delete.suffix
133
+ paths << path.slice(slice_range)
127
134
  end
128
135
 
129
- return modules.to_a
136
+ return paths.to_a
130
137
  end
131
138
 
132
139
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ # Copyright (c) 2021-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
4
4
  #
5
5
  # ronin-repos is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU Lesser General Public License as published
@@ -24,6 +24,9 @@ require 'ronin/core/cli/command'
24
24
  module Ronin
25
25
  module Repos
26
26
  class CLI
27
+ #
28
+ # Base command for all `ronin-repos` commands.
29
+ #
27
30
  class Command < Core::CLI::Command
28
31
 
29
32
  man_dir File.join(ROOT,'man')
@@ -39,8 +42,7 @@ module Ronin
39
42
  @cache_dir = CacheDir.new(dir)
40
43
  end
41
44
 
42
-
43
- # The ronin-repos cache directory.
45
+ # The `ronin-repos` cache directory.
44
46
  #
45
47
  # @return [CacheDir]
46
48
  attr_reader :cache_dir