ronin-repos 0.1.0 → 0.2.0.rc1
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.
- checksums.yaml +4 -4
- data/.document +0 -1
- data/.github/workflows/ruby.yml +16 -1
- data/.gitignore +1 -0
- data/.rubocop.yml +21 -0
- data/ChangeLog.md +28 -1
- data/Gemfile +11 -5
- data/README.md +19 -5
- data/Rakefile +12 -2
- data/bin/ronin-repos +6 -7
- data/data/completions/ronin-repos +139 -0
- data/data/completions/ronin-repos.yml +10 -0
- data/data/templates/repo/README.md.erb +1 -1
- data/gemspec.yml +11 -2
- data/lib/ronin/repos/cache_dir.rb +6 -7
- data/lib/ronin/repos/class_dir.rb +21 -14
- data/lib/ronin/repos/cli/command.rb +5 -3
- data/lib/ronin/repos/cli/commands/completion.rb +61 -0
- data/lib/ronin/repos/cli/commands/install.rb +7 -3
- data/lib/ronin/repos/cli/commands/list.rb +15 -18
- data/lib/ronin/repos/cli/commands/new.rb +7 -3
- data/lib/ronin/repos/cli/commands/purge.rb +17 -2
- data/lib/ronin/repos/cli/commands/remove.rb +1 -1
- data/lib/ronin/repos/cli/commands/show.rb +93 -0
- data/lib/ronin/repos/cli/commands/update.rb +2 -2
- data/lib/ronin/repos/cli.rb +5 -4
- data/lib/ronin/repos/exceptions.rb +4 -4
- data/lib/ronin/repos/repository.rb +33 -4
- data/lib/ronin/repos/root.rb +1 -1
- data/lib/ronin/repos/version.rb +2 -2
- data/lib/ronin/repos.rb +19 -5
- data/man/ronin-repos-completion.1 +76 -0
- data/man/ronin-repos-completion.1.md +78 -0
- data/man/ronin-repos-install.1 +27 -37
- data/man/ronin-repos-install.1.md +22 -15
- data/man/ronin-repos-list.1 +27 -33
- data/man/ronin-repos-list.1.md +22 -15
- data/man/ronin-repos-new.1 +17 -18
- data/man/ronin-repos-new.1.md +34 -0
- data/man/ronin-repos-purge.1 +26 -33
- data/man/ronin-repos-purge.1.md +20 -13
- data/man/ronin-repos-remove.1 +23 -35
- data/man/ronin-repos-remove.1.md +18 -14
- data/man/ronin-repos-show.1 +48 -0
- data/man/ronin-repos-show.1.md +48 -0
- data/man/ronin-repos-update.1 +26 -36
- data/man/ronin-repos-update.1.md +22 -15
- data/man/ronin-repos.1 +43 -31
- data/man/ronin-repos.1.md +35 -11
- data/ronin-repos.gemspec +4 -3
- data/scripts/setup +58 -0
- metadata +19 -7
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright (c) 2021-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
|
+
#
|
5
|
+
# ronin-repos is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published
|
7
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# ronin-repos is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
16
|
+
# along with ronin-repos. If not, see <https://www.gnu.org/licenses/>.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'ronin/repos/root'
|
20
|
+
require 'ronin/core/cli/completion_command'
|
21
|
+
|
22
|
+
module Ronin
|
23
|
+
module Repos
|
24
|
+
class CLI
|
25
|
+
module Commands
|
26
|
+
#
|
27
|
+
# Manages the shell completion rules for `ronin-repos`.
|
28
|
+
#
|
29
|
+
# ## Usage
|
30
|
+
#
|
31
|
+
# ronin-repos completion [options]
|
32
|
+
#
|
33
|
+
# ## Options
|
34
|
+
#
|
35
|
+
# --print Prints the shell completion file
|
36
|
+
# --install Installs the shell completion file
|
37
|
+
# --uninstall Uninstalls the shell completion file
|
38
|
+
# -h, --help Print help information
|
39
|
+
#
|
40
|
+
# ## Examples
|
41
|
+
#
|
42
|
+
# ronin-repos completion --print
|
43
|
+
# ronin-repos completion --install
|
44
|
+
# ronin-repos completion --uninstall
|
45
|
+
#
|
46
|
+
# @since 0.2.0
|
47
|
+
#
|
48
|
+
class Completion < Core::CLI::CompletionCommand
|
49
|
+
|
50
|
+
completion_file File.join(ROOT,'data','completions','ronin-repos')
|
51
|
+
|
52
|
+
man_dir File.join(ROOT,'man')
|
53
|
+
man_page 'ronin-repos-completion.1'
|
54
|
+
|
55
|
+
description 'Manages the shell completion rules for ronin-repos'
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
require 'ronin/repos/cli/command'
|
20
20
|
|
21
|
+
require 'ronin/core/cli/logging'
|
22
|
+
|
21
23
|
module Ronin
|
22
24
|
module Repos
|
23
25
|
class CLI
|
@@ -40,6 +42,8 @@ module Ronin
|
|
40
42
|
#
|
41
43
|
class Install < Command
|
42
44
|
|
45
|
+
include Core::CLI::Logging
|
46
|
+
|
43
47
|
usage '[options] URI'
|
44
48
|
|
45
49
|
argument :uri, required: true,
|
@@ -58,8 +62,8 @@ module Ronin
|
|
58
62
|
#
|
59
63
|
def run(uri)
|
60
64
|
log_info "Installing repository from #{uri} ..."
|
61
|
-
cache_dir.
|
62
|
-
rescue CommandFailed => error
|
65
|
+
cache_dir.install(uri)
|
66
|
+
rescue CommandNotInstalled, CommandFailed => error
|
63
67
|
print_error(error.message)
|
64
68
|
exit(-1)
|
65
69
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -27,7 +27,7 @@ module Ronin
|
|
27
27
|
#
|
28
28
|
# ## Usage
|
29
29
|
#
|
30
|
-
# ronin-repos list [options] [
|
30
|
+
# ronin-repos list [options] [NAME]
|
31
31
|
#
|
32
32
|
# ## Options
|
33
33
|
#
|
@@ -36,15 +36,15 @@ module Ronin
|
|
36
36
|
#
|
37
37
|
# ## Arguments
|
38
38
|
#
|
39
|
-
# [
|
39
|
+
# [NAME] Optional repository name(s) to list
|
40
40
|
#
|
41
41
|
class List < Command
|
42
42
|
|
43
|
-
usage '[options] [
|
43
|
+
usage '[options] [NAME]'
|
44
44
|
|
45
45
|
argument :name, required: false,
|
46
|
-
usage: '
|
47
|
-
desc: 'Optional repository name to list'
|
46
|
+
usage: 'NAME',
|
47
|
+
desc: 'Optional repository name(s) to list'
|
48
48
|
|
49
49
|
description 'Lists all repositories in the cache directory'
|
50
50
|
|
@@ -57,19 +57,16 @@ module Ronin
|
|
57
57
|
# The optional repo name to list.
|
58
58
|
#
|
59
59
|
def run(name=nil)
|
60
|
-
if name
|
61
|
-
|
62
|
-
|
60
|
+
repos = if name
|
61
|
+
cache_dir.select do |repo|
|
62
|
+
repo.name.include?(name)
|
63
|
+
end
|
64
|
+
else
|
65
|
+
cache_dir.each
|
66
|
+
end
|
63
67
|
|
64
|
-
|
65
|
-
|
66
|
-
print_error(error.message)
|
67
|
-
exit(-1)
|
68
|
-
end
|
69
|
-
else
|
70
|
-
cache_dir.each do |repo|
|
71
|
-
puts " #{repo}"
|
72
|
-
end
|
68
|
+
repos.each do |repo|
|
69
|
+
puts " #{repo}"
|
73
70
|
end
|
74
71
|
end
|
75
72
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -54,7 +54,7 @@ module Ronin
|
|
54
54
|
|
55
55
|
description 'Creates a new git repository'
|
56
56
|
|
57
|
-
man_page 'ronin-repos.1'
|
57
|
+
man_page 'ronin-repos-new.1'
|
58
58
|
|
59
59
|
#
|
60
60
|
# Runs the `ronin-repos new` command.
|
@@ -63,10 +63,14 @@ module Ronin
|
|
63
63
|
# The path to the new repo directory to create.
|
64
64
|
#
|
65
65
|
def run(path)
|
66
|
-
@name
|
66
|
+
@name = File.basename(path)
|
67
67
|
@github_user = Core::Git.github_user || ENV['USER']
|
68
68
|
|
69
69
|
mkdir path
|
70
|
+
mkdir File.join(path,'exploits')
|
71
|
+
mkdir File.join(path,'payloads')
|
72
|
+
mkdir File.join(path,'recon')
|
73
|
+
mkdir File.join(path,'brute')
|
70
74
|
erb 'README.md.erb', File.join(path,'README.md')
|
71
75
|
|
72
76
|
Dir.chdir(path) do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -22,12 +22,27 @@ module Ronin
|
|
22
22
|
module Repos
|
23
23
|
class CLI
|
24
24
|
module Commands
|
25
|
+
#
|
26
|
+
# The `ronin-repos purge` command.
|
27
|
+
#
|
28
|
+
# ## Usage
|
29
|
+
#
|
30
|
+
# ronin-repos purge [options]
|
31
|
+
#
|
32
|
+
# ## Options
|
33
|
+
#
|
34
|
+
# -C, --cache-dir DIR Overrides the default cache directory
|
35
|
+
# -h, --help Print help information
|
36
|
+
#
|
25
37
|
class Purge < Command
|
26
38
|
|
27
39
|
description 'Removes all git repository from the cache directory'
|
28
40
|
|
29
|
-
man_page 'ronin-repos-
|
41
|
+
man_page 'ronin-repos-purge.1'
|
30
42
|
|
43
|
+
#
|
44
|
+
# Runs the `ronin-repos purge` command.
|
45
|
+
#
|
31
46
|
def run
|
32
47
|
cache_dir.purge
|
33
48
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright (c) 2021-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
|
+
#
|
5
|
+
# ronin-repos is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published
|
7
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# ronin-repos is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
16
|
+
# along with ronin-repos. If not, see <https://www.gnu.org/licenses/>.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'ronin/repos/cli/command'
|
20
|
+
|
21
|
+
require 'command_kit/printing/fields'
|
22
|
+
require 'command_kit/printing/lists'
|
23
|
+
|
24
|
+
module Ronin
|
25
|
+
module Repos
|
26
|
+
class CLI
|
27
|
+
module Commands
|
28
|
+
#
|
29
|
+
# Prints information about a specific repository in the cache directory.
|
30
|
+
#
|
31
|
+
# ## Usage
|
32
|
+
#
|
33
|
+
# ronin-repos show [options] REPO
|
34
|
+
#
|
35
|
+
# ## Options
|
36
|
+
#
|
37
|
+
# -C, --cache-dir DIR Overrides the default cache directory
|
38
|
+
# -h, --help Print help information
|
39
|
+
#
|
40
|
+
# ## Arguments
|
41
|
+
#
|
42
|
+
# REPO The repository to display
|
43
|
+
#
|
44
|
+
# @since 0.2.0
|
45
|
+
#
|
46
|
+
class Show < Command
|
47
|
+
|
48
|
+
include CommandKit::Printing::Fields
|
49
|
+
include CommandKit::Printing::Lists
|
50
|
+
|
51
|
+
usage '[options] [REPO]'
|
52
|
+
|
53
|
+
argument :name, required: true,
|
54
|
+
usage: 'REPO',
|
55
|
+
desc: 'The repository to display'
|
56
|
+
|
57
|
+
description 'Prints information about a repository in the cache directory'
|
58
|
+
|
59
|
+
man_page 'ronin-repos-show.1'
|
60
|
+
|
61
|
+
#
|
62
|
+
# Runs the `ronin-repos show` command.
|
63
|
+
#
|
64
|
+
# @param [String] name
|
65
|
+
# The repo name to display.
|
66
|
+
#
|
67
|
+
def run(name=nil)
|
68
|
+
repo = cache_dir[name]
|
69
|
+
|
70
|
+
puts "[ #{repo} ]"
|
71
|
+
puts
|
72
|
+
|
73
|
+
indent do
|
74
|
+
print_fields(
|
75
|
+
'Name' => repo.name,
|
76
|
+
'URI' => repo.url,
|
77
|
+
'Files' => nil
|
78
|
+
)
|
79
|
+
|
80
|
+
indent do
|
81
|
+
print_list(repo.list_files)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
rescue RepositoryNotFound => error
|
85
|
+
print_error(error.message)
|
86
|
+
exit(-1)
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -77,7 +77,7 @@ module Ronin
|
|
77
77
|
|
78
78
|
begin
|
79
79
|
repo.update
|
80
|
-
rescue CommandFailed => error
|
80
|
+
rescue CommandNotInstalled, CommandFailed => error
|
81
81
|
log_error("failed to update repository #{repo}: #{error.message}")
|
82
82
|
end
|
83
83
|
end
|
data/lib/ronin/repos/cli.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -41,9 +41,10 @@ module Ronin
|
|
41
41
|
command_name 'ronin-repos'
|
42
42
|
version Ronin::Repos::VERSION
|
43
43
|
|
44
|
-
command_aliases['ls']
|
45
|
-
command_aliases['up']
|
46
|
-
command_aliases['rm']
|
44
|
+
command_aliases['ls'] = 'list'
|
45
|
+
command_aliases['up'] = 'update'
|
46
|
+
command_aliases['rm'] = 'remove'
|
47
|
+
command_aliases['info'] = 'show'
|
47
48
|
|
48
49
|
end
|
49
50
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -21,13 +21,13 @@ module Ronin
|
|
21
21
|
class Exception < RuntimeError
|
22
22
|
end
|
23
23
|
|
24
|
-
class RepositoryNotFound < Exception
|
24
|
+
class RepositoryNotFound < Repos::Exception
|
25
25
|
end
|
26
26
|
|
27
|
-
class CommandNotInstalled < Exception
|
27
|
+
class CommandNotInstalled < Repos::Exception
|
28
28
|
end
|
29
29
|
|
30
|
-
class CommandFailed < Exception
|
30
|
+
class CommandFailed < Repos::Exception
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -19,6 +19,7 @@
|
|
19
19
|
require 'ronin/repos/exceptions'
|
20
20
|
|
21
21
|
require 'fileutils'
|
22
|
+
require 'time'
|
22
23
|
|
23
24
|
module Ronin
|
24
25
|
module Repos
|
@@ -66,7 +67,7 @@ module Ronin
|
|
66
67
|
# Clones a repository.
|
67
68
|
#
|
68
69
|
# @param [String, URI::HTTPS] uri
|
69
|
-
# The `https://` or `git@HOST:PATH` SSH URI
|
70
|
+
# The `https://` or `git@HOST:PATH` SSH URI
|
70
71
|
#
|
71
72
|
# @param [String] path
|
72
73
|
# The path to where the repository will be cloned to.
|
@@ -109,7 +110,7 @@ module Ronin
|
|
109
110
|
# path.
|
110
111
|
#
|
111
112
|
# @param [String, URI::HTTPS] uri
|
112
|
-
# The `https://` or `git@HOST:PATH` SSH URI
|
113
|
+
# The `https://` or `git@HOST:PATH` SSH URI
|
113
114
|
#
|
114
115
|
# @param [String] path
|
115
116
|
# The path to where the repository will be cloned to.
|
@@ -138,6 +139,34 @@ module Ronin
|
|
138
139
|
return repo
|
139
140
|
end
|
140
141
|
|
142
|
+
#
|
143
|
+
# The git URL of the repository.
|
144
|
+
#
|
145
|
+
# @return [String]
|
146
|
+
# The `git:` or `https://` URL for the repository.
|
147
|
+
#
|
148
|
+
# @since 0.2.0
|
149
|
+
#
|
150
|
+
def url
|
151
|
+
Dir.chdir(@path) do
|
152
|
+
`git remote get-url origin`.chomp
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# Determines when the repository was last updated.
|
158
|
+
#
|
159
|
+
# @return [Time]
|
160
|
+
# The timestamp of the last commit will be returned.
|
161
|
+
#
|
162
|
+
# @since 0.2.0
|
163
|
+
#
|
164
|
+
def last_updated_at
|
165
|
+
Dir.chdir(@path) do
|
166
|
+
Time.parse(`git log --date=iso8601 --pretty="%cd" -1`)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
141
170
|
#
|
142
171
|
# Pulls down new git commits.
|
143
172
|
#
|
@@ -304,7 +333,7 @@ module Ronin
|
|
304
333
|
#
|
305
334
|
def glob(pattern,&block)
|
306
335
|
path = join(pattern)
|
307
|
-
matches = Dir.glob(path)
|
336
|
+
matches = Dir.glob(path)
|
308
337
|
|
309
338
|
if block then matches.each(&block)
|
310
339
|
else matches
|
data/lib/ronin/repos/root.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
data/lib/ronin/repos/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -19,6 +19,6 @@
|
|
19
19
|
module Ronin
|
20
20
|
module Repos
|
21
21
|
# ronin-repos version
|
22
|
-
VERSION = '0.
|
22
|
+
VERSION = '0.2.0.rc1'
|
23
23
|
end
|
24
24
|
end
|
data/lib/ronin/repos.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021-
|
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
|
@@ -25,7 +25,21 @@ module Ronin
|
|
25
25
|
# @api public
|
26
26
|
#
|
27
27
|
module Repos
|
28
|
-
|
28
|
+
#
|
29
|
+
# The global repositories cache directory.
|
30
|
+
#
|
31
|
+
# @return [CacheDir]
|
32
|
+
# The global repositories cache directory (`~/.cache/ronin-repos`).
|
33
|
+
#
|
34
|
+
# @note This method lazy initializes {CacheDir} when first called.
|
35
|
+
#
|
36
|
+
# @api private
|
37
|
+
#
|
38
|
+
# @since 0.2.0
|
39
|
+
#
|
40
|
+
def self.cache_dir
|
41
|
+
@cache_dir ||= CacheDir.new
|
42
|
+
end
|
29
43
|
|
30
44
|
#
|
31
45
|
# Finds the first matching file.
|
@@ -42,7 +56,7 @@ module Ronin
|
|
42
56
|
# # => "/home/user/.cache/ronin-repos/foo-repo/wordlists/wordlist.txt"
|
43
57
|
#
|
44
58
|
def self.find_file(path)
|
45
|
-
|
59
|
+
cache_dir.find_file(path)
|
46
60
|
end
|
47
61
|
|
48
62
|
#
|
@@ -62,7 +76,7 @@ module Ronin
|
|
62
76
|
# # "/home/user/.cache/ronin-repos/bar-repo/wordlists/beers.txt"]
|
63
77
|
#
|
64
78
|
def self.glob(pattern,&block)
|
65
|
-
|
79
|
+
cache_dir.glob(pattern,&block)
|
66
80
|
end
|
67
81
|
|
68
82
|
#
|
@@ -75,7 +89,7 @@ module Ronin
|
|
75
89
|
# The matching files within all repositories.
|
76
90
|
#
|
77
91
|
def self.list_files(pattern='{**/}*.*')
|
78
|
-
|
92
|
+
cache_dir.list_files(pattern)
|
79
93
|
end
|
80
94
|
end
|
81
95
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
.\" Generated by kramdown-man 1.0.1
|
2
|
+
.\" https://github.com/postmodern/kramdown-man#readme
|
3
|
+
.TH ronin-repos-completion 1 "2024-01-01" Ronin Repos "User Manuals"
|
4
|
+
.SH NAME
|
5
|
+
.PP
|
6
|
+
ronin\-repos\-completion \- Manages shell completion rules for \fBronin\-repos\fR
|
7
|
+
.SH SYNOPSIS
|
8
|
+
.PP
|
9
|
+
\fBronin\-repos completion\fR \[lB]\fIoptions\fP\[rB]
|
10
|
+
.SH DESCRIPTION
|
11
|
+
.PP
|
12
|
+
The \fBronin\-repos completion\fR command can print, install, or uninstall shell
|
13
|
+
completion rules for the \fBronin\-repos\fR command\.
|
14
|
+
.PP
|
15
|
+
Supports installing completion rules for Bash or Zsh shells\.
|
16
|
+
Completion rules for the Fish shell is currently not supported\.
|
17
|
+
.SS ZSH SUPPORT
|
18
|
+
.PP
|
19
|
+
Zsh users will have to add the following lines to their \fB\[ti]\[sl]\.zshrc\fR file in
|
20
|
+
order to enable Zsh\[cq]s Bash completion compatibility layer:
|
21
|
+
.PP
|
22
|
+
.RS 4
|
23
|
+
.EX
|
24
|
+
autoload \-Uz \[pl]X compinit && compinit
|
25
|
+
autoload \-Uz \[pl]X bashcompinit && bashcompinit
|
26
|
+
.EE
|
27
|
+
.RE
|
28
|
+
.SH OPTIONS
|
29
|
+
.TP
|
30
|
+
\fB\-\-print\fR
|
31
|
+
Prints the shell completion file\.
|
32
|
+
.TP
|
33
|
+
\fB\-\-install\fR
|
34
|
+
Installs the shell completion file\.
|
35
|
+
.TP
|
36
|
+
\fB\-\-uninstall\fR
|
37
|
+
Uninstalls the shell completion file\.
|
38
|
+
.TP
|
39
|
+
\fB\-h\fR, \fB\-\-help\fR
|
40
|
+
Prints help information\.
|
41
|
+
.SH ENVIRONMENT
|
42
|
+
.TP
|
43
|
+
\fIPREFIX\fP
|
44
|
+
Specifies the root prefix for the file system\.
|
45
|
+
.TP
|
46
|
+
\fIHOME\fP
|
47
|
+
Specifies the home directory of the user\. Ronin will search for the
|
48
|
+
\fB\[ti]\[sl]\.cache\[sl]ronin\-repos\fR cache directory within the home directory\.
|
49
|
+
.TP
|
50
|
+
\fIXDG\[ru]DATA\[ru]HOME\fP
|
51
|
+
Specifies the data directory to use\. Defaults to \fB\[Do]HOME\[sl]\.local\[sl]share\fR\.
|
52
|
+
.SH FILES
|
53
|
+
.TP
|
54
|
+
\fB\[ti]\[sl]\.local\[sl]share\[sl]bash\-completion\[sl]completions\[sl]\fR
|
55
|
+
The user\-local installation directory for Bash completion files\.
|
56
|
+
.TP
|
57
|
+
\fB\[sl]usr\[sl]local\[sl]share\[sl]bash\-completion\[sl]completions\[sl]\fR
|
58
|
+
The system\-wide installation directory for Bash completions files\.
|
59
|
+
.TP
|
60
|
+
\fB\[sl]usr\[sl]local\[sl]share\[sl]zsh\[sl]site\-functions\[sl]\fR
|
61
|
+
The installation directory for Zsh completion files\.
|
62
|
+
.SH EXAMPLES
|
63
|
+
.TP
|
64
|
+
\fBronin\-repos completion \-\-print\fR
|
65
|
+
Prints the shell completion rules instead of installing them\.
|
66
|
+
.TP
|
67
|
+
\fBronin\-repos completion \-\-install\fR
|
68
|
+
Installs the shell completion rules for \fBronin\-repos\fR\.
|
69
|
+
.TP
|
70
|
+
\fBronin\-repos completion \-\-uninstall\fR
|
71
|
+
Uninstalls the shell completion rules for \fBronin\-repos\fR\.
|
72
|
+
.SH AUTHOR
|
73
|
+
.PP
|
74
|
+
Postmodern
|
75
|
+
.MT postmodern\.mod3\[at]gmail\.com
|
76
|
+
.ME
|