ronin-core 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -150
- data/ChangeLog.md +9 -1
- data/Gemfile +3 -1
- data/Rakefile +1 -1
- data/examples/ruby_shell.rb +5 -0
- data/examples/test_shell.rb +41 -0
- data/lib/ronin/core/class_registry.rb +15 -10
- data/lib/ronin/core/cli/command.rb +11 -11
- data/lib/ronin/core/cli/command_shell/command.rb +8 -5
- data/lib/ronin/core/cli/command_shell.rb +9 -9
- data/lib/ronin/core/cli/generator/options/author.rb +4 -5
- data/lib/ronin/core/cli/generator/options/description.rb +2 -2
- data/lib/ronin/core/cli/generator/options/reference.rb +2 -2
- data/lib/ronin/core/cli/generator/options/summary.rb +2 -2
- data/lib/ronin/core/cli/generator.rb +10 -7
- data/lib/ronin/core/cli/logging.rb +5 -2
- data/lib/ronin/core/cli/options/param.rb +4 -4
- data/lib/ronin/core/cli/options/values/arches.rb +2 -2
- data/lib/ronin/core/cli/options/values/oses.rb +2 -2
- data/lib/ronin/core/cli/printing/arch.rb +2 -2
- data/lib/ronin/core/cli/printing/metadata.rb +2 -2
- data/lib/ronin/core/cli/printing/os.rb +5 -2
- data/lib/ronin/core/cli/printing/params.rb +6 -6
- data/lib/ronin/core/cli/ruby_shell.rb +3 -2
- data/lib/ronin/core/cli/shell.rb +14 -6
- data/lib/ronin/core/git.rb +2 -2
- data/lib/ronin/core/home.rb +2 -2
- data/lib/ronin/core/metadata/authors/author.rb +5 -2
- data/lib/ronin/core/metadata/authors.rb +8 -5
- data/lib/ronin/core/metadata/description.rb +8 -5
- data/lib/ronin/core/metadata/id.rb +7 -4
- data/lib/ronin/core/metadata/references.rb +13 -6
- data/lib/ronin/core/metadata/summary.rb +10 -7
- data/lib/ronin/core/metadata/version.rb +8 -5
- data/lib/ronin/core/params/exceptions.rb +2 -2
- data/lib/ronin/core/params/mixin.rb +15 -15
- data/lib/ronin/core/params/param.rb +2 -2
- data/lib/ronin/core/params/types/boolean.rb +2 -2
- data/lib/ronin/core/params/types/enum.rb +7 -3
- data/lib/ronin/core/params/types/float.rb +2 -2
- data/lib/ronin/core/params/types/integer.rb +2 -2
- data/lib/ronin/core/params/types/numeric.rb +3 -3
- data/lib/ronin/core/params/types/regexp.rb +2 -2
- data/lib/ronin/core/params/types/string.rb +2 -2
- data/lib/ronin/core/params/types/type.rb +2 -2
- data/lib/ronin/core/params/types/uri.rb +2 -2
- data/lib/ronin/core/params/types.rb +6 -3
- data/lib/ronin/core/params.rb +2 -2
- data/lib/ronin/core/version.rb +3 -3
- data/ronin-core.gemspec +5 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 632034dea1307157efadc601fa99bfb2b1eaf3cf81506392f2a68733d68645d4
|
4
|
+
data.tar.gz: 32f82f08f6692163e22f55ecc37666e2cc1655e37127bd578009fed61a3b4cbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cba7b2829ba506c61c028d6961a5040b026640a3f60d46f2cdbf96649b6de4385a07d171835ab19e687837e9936bc757a832cd58ca71217e2d186433fdfcb3ab
|
7
|
+
data.tar.gz: 64684f9aa1a7e46348b1596ed941b2056c0262806c5310a17991f6e2e43de179dd9d9988315f55a03be079f26b3f8452ec3f009ef09a3f58d236f9b4e8a238f0
|
data/.rubocop.yml
CHANGED
@@ -3,158 +3,21 @@ AllCops:
|
|
3
3
|
SuggestExtensions: false
|
4
4
|
TargetRubyVersion: 3.1
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
#
|
9
|
-
|
10
|
-
Layout/FirstArrayElementIndentation: { Exclude: ['spec/**/*'] }
|
11
|
-
Layout/LineLength: { Enabled: false }
|
12
|
-
Layout/SpaceAroundEqualsInParameterDefault: { EnforcedStyle: no_space }
|
13
|
-
Lint/ConstantDefinitionInBlock: { Exclude: ['spec/**/*'] }
|
14
|
-
Metrics: { Enabled: false }
|
15
|
-
Style/SymbolArray: { EnforcedStyle: brackets }
|
16
|
-
Style/IfInsideElse: { Enabled: false } # Offense count: 1
|
17
|
-
Style/PercentLiteralDelimiters:
|
18
|
-
Enabled: true
|
19
|
-
PreferredDelimiters:
|
20
|
-
default: '{}'
|
21
|
-
'%i': '[]'
|
22
|
-
'%I': '[]'
|
23
|
-
'%w': '[]'
|
24
|
-
'%W': '[]'
|
25
|
-
Style/UnlessElse: { Enabled: false }
|
26
|
-
Bundler/OrderedGems: { Enabled: false }
|
27
|
-
Style/CaseEquality: { Exclude: ['lib/ronin/web/server/conditions.rb'] }
|
28
|
-
Style/Next: { Enabled: false }
|
29
|
-
Style/HashSyntax: { Enabled: false }
|
30
|
-
Naming/BlockForwarding: { Enabled: false }
|
31
|
-
Lint/ReturnInVoidContext: { Enabled: false }
|
32
|
-
Gemspec/DeprecatedAttributeAssignment: { Enabled: false }
|
33
|
-
Style/MixinUsage: { Enabled: false }
|
34
|
-
Naming/VariableNumber: { Enabled: false }
|
35
|
-
Naming/PredicateName: { Enabled: false }
|
36
|
-
Style/FetchEnvVar: { Enabled: false }
|
37
|
-
Layout/RescueEnsureAlignment: { Enabled: false }
|
38
|
-
Layout/BeginEndAlignment: { Enabled: false }
|
39
|
-
Layout/EmptyLineAfterMagicComment: { Enabled: false }
|
40
|
-
|
41
|
-
#
|
42
|
-
# rules that are in flux
|
43
|
-
#
|
44
|
-
|
45
|
-
# consider enabling these and autocorrecting?
|
46
|
-
# Layout/SpaceAfterComma
|
47
|
-
# Layout/SpaceAroundKeyword
|
48
|
-
# Layout/SpaceBeforeComma
|
49
|
-
# Layout/SpaceInsideHashLiteralBraces
|
50
|
-
# Layout/SpaceInsideParens
|
51
|
-
# Layout/TrailingWhitespace
|
52
|
-
# Lint/UnreachableLoop
|
53
|
-
# Lint/UnusedBlockArgument
|
54
|
-
# Style/ClassCheck
|
55
|
-
# Style/Documentation
|
56
|
-
# Style/ExpandPathArguments
|
57
|
-
# Style/GlobalStdStream
|
58
|
-
# Style/HashSyntax
|
59
|
-
# Style/KeywordParametersOrder
|
60
|
-
# Style/MethodCallWithoutArgsParentheses
|
61
|
-
# Style/MutableConstant
|
62
|
-
# Style/QuotedSymbols: { EnforcedStyle: double_quotes }
|
63
|
-
# Style/RedundantReturn
|
64
|
-
# Style/SafeNavigation
|
65
|
-
# Style/SpecialGlobalVars
|
66
|
-
# Style/StringLiterals: { EnforcedStyle: double_quotes }
|
67
|
-
# Style/WordArray
|
68
|
-
|
69
|
-
# these have been fixed
|
70
|
-
# Gemspec/DuplicatedAssignment: { Enabled: false } # Offense count: 1
|
71
|
-
# Layout/ElseAlignment: { Enabled: false } # Offense count: 1
|
72
|
-
# Layout/EndAlignment: { Enabled: false } # Offense count: 1
|
73
|
-
# Lint/DuplicateMethods: { Enabled: false } # Offense count: 1
|
74
|
-
# Lint/UselessAssignment: { Enabled: false } # Offense count: 1
|
75
|
-
# Style/Encoding: { Enabled: false } # Offense count: 2
|
76
|
-
# Style/RedundantBegin: { Enabled: false } # Offense count: 2
|
77
|
-
# Style/RedundantInterpolation: { Enabled: false } # Offense count: 1
|
78
|
-
# Style/TrailingCommaInArrayLiteral: { Enabled: false } # Offense count: 1
|
6
|
+
inherit_gem:
|
7
|
+
rubocop-ronin: rubocop.yml
|
79
8
|
|
80
9
|
#
|
81
|
-
#
|
82
|
-
# bundle exec rubocop --auto-gen-config --exclude-limit 1
|
10
|
+
# ronin-core specific exceptions
|
83
11
|
#
|
12
|
+
Lint/MissingSuper: { Exclude: ['lib/ronin/core/params/types/*.rb'] }
|
13
|
+
Style/CaseEquality: { Exclude: ['lib/ronin/web/server/conditions.rb'] }
|
14
|
+
Style/EmptyMethod:
|
15
|
+
Exclude:
|
16
|
+
- 'lib/ronin/core/cli/shell.rb'
|
17
|
+
- 'spec/**/*'
|
84
18
|
|
85
|
-
|
86
|
-
Layout/AssignmentIndentation: { Enabled: false } # Offense count: 11
|
87
|
-
Layout/EmptyLinesAroundClassBody: { Enabled: false } # Offense count: 76
|
88
|
-
Layout/HashAlignment: { Enabled: false } # Offense count: 28
|
89
|
-
Layout/SpaceAfterComma: { Enabled: false } # Offense count: 141
|
90
|
-
Layout/SpaceInsideHashLiteralBraces: { Enabled: false } # Offense count: 57
|
91
|
-
Layout/TrailingWhitespace: { Enabled: false } # Offense count: 50
|
92
|
-
Naming/RescuedExceptionsVariableName: { Enabled: false } # Offense count: 11
|
93
|
-
Style/BlockDelimiters: { Enabled: false } # Offense count: 17
|
94
|
-
Style/ClassCheck: { Enabled: false } # Offense count: 10
|
95
|
-
Style/ClassEqualityComparison: { Enabled: false } # Offense count: 16
|
96
|
-
Style/FrozenStringLiteralComment: { Enabled: false } # Offense count: 77
|
97
|
-
Style/GlobalStdStream: { Enabled: false } # Offense count: 13
|
98
|
-
Style/GuardClause: { Enabled: false } # Offense count: 10
|
99
|
-
Style/IfUnlessModifier: { Enabled: false } # Offense count: 13
|
100
|
-
Style/MethodCallWithoutArgsParentheses: { Enabled: false } # Offense count: 10
|
101
|
-
Style/SpecialGlobalVars: { Enabled: false } # Offense count: 28
|
102
|
-
Style/StringLiterals: { Enabled: false } # Offense count: 774
|
103
|
-
Lint/ElseLayout: { Enabled: false } # Offense count: 22
|
104
|
-
|
105
|
-
# < 10 violations
|
106
|
-
Layout/EmptyLinesAroundModuleBody: { Enabled: false } # Offense count: 5
|
107
|
-
Layout/ExtraSpacing: { Enabled: false } # Offense count: 6
|
108
|
-
Layout/FirstHashElementIndentation: { Enabled: false } # Offense count: 4
|
109
|
-
Layout/ParameterAlignment: { Enabled: false } # Offense count: 9
|
110
|
-
Layout/SpaceAroundKeyword: { Enabled: false } # Offense count: 7
|
111
|
-
Layout/SpaceBeforeComma: { Enabled: false } # Offense count: 4
|
112
|
-
Layout/SpaceInsideParens: { Enabled: false } # Offense count: 4
|
113
|
-
Lint/EmptyClass: { Enabled: false } # Offense count: 3
|
114
|
-
Lint/SuppressedException: { Enabled: false } # Offense count: 4
|
115
|
-
Lint/UnusedMethodArgument: { Enabled: false } # Offense count: 5
|
116
|
-
Style/AccessorGrouping: { Enabled: false } # Offense count: 7
|
117
|
-
Style/Documentation: { Enabled: false } # Offense count: 3
|
118
|
-
Style/ExpandPathArguments: { Enabled: false } # Offense count: 8
|
119
|
-
Style/KeywordParametersOrder: { Enabled: false } # Offense count: 8
|
120
|
-
Style/Lambda: { Enabled: false } # Offense count: 3
|
121
|
-
Style/MutableConstant: { Enabled: false } # Offense count: 4
|
122
|
-
Style/RaiseArgs: { Enabled: false } # Offense count: 4
|
123
|
-
Style/RedundantReturn: { Enabled: false } # Offense count: 7
|
124
|
-
Style/SafeNavigation: { Enabled: false } # Offense count: 5
|
125
|
-
Style/StringConcatenation: { Enabled: false } # Offense count: 8
|
126
|
-
Style/WordArray: { Enabled: false } # Offense count: 4
|
127
|
-
|
128
|
-
# 1 or 2 violations
|
129
|
-
Layout/ArgumentAlignment: { Enabled: false } # Offense count: 1
|
130
|
-
Layout/BlockAlignment: { Enabled: false } # Offense count: 1
|
131
|
-
Layout/IndentationWidth: { Enabled: false } # Offense count: 2
|
132
|
-
Layout/SpaceAroundOperators: { Enabled: false } # Offense count: 1
|
133
|
-
Layout/SpaceBeforeBlockBraces: { Enabled: false } # Offense count: 1
|
134
|
-
Lint/MissingSuper: { Enabled: false } # Offense count: 2
|
135
|
-
Lint/RescueException: { Enabled: false } # Offense count: 1
|
136
|
-
Lint/UnreachableLoop: { Enabled: false } # Offense count: 1
|
137
|
-
Lint/UnusedBlockArgument: { Enabled: false } # Offense count: 1
|
138
|
-
Naming/MethodParameterName: { Enabled: false } # Offense count: 1
|
139
|
-
Style/EmptyMethod: { Enabled: false } # Offense count: 2
|
140
|
-
Style/HashConversion: { Enabled: false } # Offense count: 1
|
141
|
-
Style/MultilineMemoization: { Enabled: false } # Offense count: 1
|
142
|
-
Style/NumericPredicate: { Enabled: false } # Offense count: 1
|
143
|
-
Style/OptionalArguments: { Enabled: false } # Offense count: 1
|
144
|
-
Style/ParenthesesAroundCondition: { Enabled: false } # Offense count: 1
|
145
|
-
Style/PreferredHashMethods: { Enabled: false } # Offense count: 1
|
146
|
-
Style/QuotedSymbols: { Enabled: false } # Offense count: 1
|
147
|
-
Style/RedundantException: { Enabled: false } # Offense count: 1
|
148
|
-
Style/RedundantRegexpEscape: { Enabled: false } # Offense count: 1
|
149
|
-
Style/RegexpLiteral: { Enabled: false } # Offense count: 1
|
150
|
-
Style/RescueStandardError: { Enabled: false } # Offense count: 1
|
151
|
-
Style/SoleNestedConditional: { Enabled: false } # Offense count: 1
|
152
|
-
Style/TrailingCommaInHashLiteral: { Enabled: false } # Offense count: 2
|
153
|
-
|
154
|
-
# rubocop cannot tell that rubygems_mfa_required is enabled in gemspec.yml
|
155
|
-
Gemspec/RequireMFA: { Enabled: false }
|
156
|
-
|
157
|
-
# make an exception for our gemspec code
|
158
|
-
Gemspec/DuplicatedAssignment:
|
19
|
+
Style/GlobalStdStream:
|
159
20
|
Exclude:
|
160
|
-
- 'ronin
|
21
|
+
- 'lib/ronin/core/cli/ruby_shell.rb'
|
22
|
+
- 'spec/cli/ruby_shell_spec.rb'
|
23
|
+
|
data/ChangeLog.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
### 0.1.
|
1
|
+
### 0.1.1 / 2023-03-01
|
2
|
+
|
3
|
+
#### CLI
|
4
|
+
|
5
|
+
* Allow {Ronin::Core::CLI::Shell} and {Ronin::Core::CLI::CommandShell} to
|
6
|
+
rescue interrupts while a shell command is running, and not exit from the
|
7
|
+
shell.
|
8
|
+
|
9
|
+
### 0.1.0 / 2023-02-01
|
2
10
|
|
3
11
|
* Initial release:
|
4
12
|
* Provides access to the XDG directories (`~/.config/`, `~/.cache/`,
|
data/Gemfile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
source 'https://rubygems.org'
|
2
3
|
|
3
4
|
gemspec
|
@@ -26,5 +27,6 @@ group :development do
|
|
26
27
|
gem 'dead_end', require: false
|
27
28
|
gem 'sord', require: false, platform: :mri
|
28
29
|
gem 'stackprof', require: false, platform: :mri
|
29
|
-
gem 'rubocop', require: false
|
30
|
+
gem 'rubocop', require: false, platform: :mri
|
31
|
+
gem 'rubocop-ronin', require: false, platform: :mri
|
30
32
|
end
|
data/Rakefile
CHANGED
data/examples/ruby_shell.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
|
6
|
+
require 'ronin/core/cli/command_shell'
|
7
|
+
|
8
|
+
#
|
9
|
+
# An example interactive CLI shell.
|
10
|
+
#
|
11
|
+
class TestShell < Ronin::Core::CLI::CommandShell
|
12
|
+
|
13
|
+
shell_name 'test'
|
14
|
+
|
15
|
+
command :foo, summary: 'Command with no arguments'
|
16
|
+
def foo
|
17
|
+
puts "no args"
|
18
|
+
end
|
19
|
+
|
20
|
+
command :bar, usage: 'ARG',
|
21
|
+
completions: %w[arg1 arg2],
|
22
|
+
summary: 'Command with one argument'
|
23
|
+
def bar(arg)
|
24
|
+
puts "arg=#{arg}"
|
25
|
+
end
|
26
|
+
|
27
|
+
command :baz, usage: '[ARG]',
|
28
|
+
summary: 'Command with optional argument'
|
29
|
+
def baz(arg=nil)
|
30
|
+
puts "arg=#{arg}"
|
31
|
+
end
|
32
|
+
|
33
|
+
command :qux, usage: '[ARGS...]',
|
34
|
+
summary: 'Command with repeating arguments'
|
35
|
+
def qux(*args)
|
36
|
+
puts "args=#{args.join(' ')}"
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
TestShell.start
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -26,11 +26,11 @@ module Ronin
|
|
26
26
|
# `lib/ronin/exploits.rb`:
|
27
27
|
#
|
28
28
|
# require 'ronin/core/class_registry'
|
29
|
-
#
|
29
|
+
#
|
30
30
|
# module Ronin
|
31
31
|
# module Exploits
|
32
32
|
# include Ronin::Core::ClassRegistry
|
33
|
-
#
|
33
|
+
#
|
34
34
|
# class_dir "#{__dir__}/classes"
|
35
35
|
# end
|
36
36
|
# end
|
@@ -40,11 +40,11 @@ module Ronin
|
|
40
40
|
# module Ronin
|
41
41
|
# module Exploits
|
42
42
|
# class Exploit
|
43
|
-
#
|
43
|
+
#
|
44
44
|
# def self.register(name)
|
45
45
|
# Exploits.register(name,self)
|
46
46
|
# end
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# end
|
49
49
|
# end
|
50
50
|
# end
|
@@ -52,13 +52,13 @@ module Ronin
|
|
52
52
|
# `lib/ronin/exploits/my_exploit.rb`:
|
53
53
|
#
|
54
54
|
# require 'ronin/exploits/exploit'
|
55
|
-
#
|
55
|
+
#
|
56
56
|
# module Ronin
|
57
57
|
# module Exploits
|
58
58
|
# class MyExploit < Exploit
|
59
|
-
#
|
59
|
+
#
|
60
60
|
# register 'my_exploit'
|
61
|
-
#
|
61
|
+
#
|
62
62
|
# end
|
63
63
|
# end
|
64
64
|
# end
|
@@ -79,6 +79,9 @@ module Ronin
|
|
79
79
|
namespace.extend ClassMethods
|
80
80
|
end
|
81
81
|
|
82
|
+
#
|
83
|
+
# Class-methods.
|
84
|
+
#
|
82
85
|
module ClassMethods
|
83
86
|
#
|
84
87
|
# Gets or sets the class directory path.
|
@@ -88,7 +91,7 @@ module Ronin
|
|
88
91
|
#
|
89
92
|
# @return [String]
|
90
93
|
# The class directory path.
|
91
|
-
#
|
94
|
+
#
|
92
95
|
# @raise [NotImplementedError]
|
93
96
|
# The `class_dir` method was not defined in the module.
|
94
97
|
#
|
@@ -188,7 +191,9 @@ module Ronin
|
|
188
191
|
end
|
189
192
|
|
190
193
|
previous_entries = registry.keys
|
194
|
+
|
191
195
|
require(file)
|
196
|
+
|
192
197
|
new_entries = registry.keys - previous_entries
|
193
198
|
|
194
199
|
if new_entries.empty?
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -38,9 +38,9 @@ module Ronin
|
|
38
38
|
# module Foo
|
39
39
|
# class CLI
|
40
40
|
# class Command < Core::CLI::Command
|
41
|
-
#
|
41
|
+
#
|
42
42
|
# man_dir File.join(__dir__,'..','..','..','..','man')
|
43
|
-
#
|
43
|
+
#
|
44
44
|
# end
|
45
45
|
# end
|
46
46
|
# end
|
@@ -50,26 +50,26 @@ module Ronin
|
|
50
50
|
#
|
51
51
|
# # lib/ronin/foo/cli/commands/list.rb
|
52
52
|
# require 'ronin/foo/cli/command'
|
53
|
-
#
|
53
|
+
#
|
54
54
|
# module Ronin
|
55
55
|
# module Foo
|
56
56
|
# class CLI
|
57
57
|
# module Commands
|
58
58
|
# class List < Command
|
59
|
-
#
|
59
|
+
#
|
60
60
|
# usage '[options] [NAME]'
|
61
|
-
#
|
61
|
+
#
|
62
62
|
# argument :name, required: false,
|
63
63
|
# desc: 'Optional name to list'
|
64
|
-
#
|
64
|
+
#
|
65
65
|
# description 'Lists all things'
|
66
|
-
#
|
66
|
+
#
|
67
67
|
# man_page 'ronin-foo-list.1'
|
68
|
-
#
|
68
|
+
#
|
69
69
|
# def run(name=nil)
|
70
70
|
# # ...
|
71
71
|
# end
|
72
|
-
#
|
72
|
+
#
|
73
73
|
# end
|
74
74
|
# end
|
75
75
|
# end
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -22,6 +22,9 @@ module Ronin
|
|
22
22
|
module Core
|
23
23
|
module CLI
|
24
24
|
class CommandShell < Shell
|
25
|
+
#
|
26
|
+
# Represents a defined command within a {CommandShell} class.
|
27
|
+
#
|
25
28
|
class Command
|
26
29
|
|
27
30
|
# The command's name.
|
@@ -77,10 +80,10 @@ module Ronin
|
|
77
80
|
# Multi-line help information for the command.
|
78
81
|
#
|
79
82
|
def initialize(name, method_name: name,
|
80
|
-
usage:
|
83
|
+
usage: nil,
|
81
84
|
completions: nil,
|
82
|
-
summary:
|
83
|
-
help:
|
85
|
+
summary: ,
|
86
|
+
help: summary)
|
84
87
|
@name = name
|
85
88
|
@method_name = method_name
|
86
89
|
@usage = usage
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -30,9 +30,9 @@ module Ronin
|
|
30
30
|
# ## Example
|
31
31
|
#
|
32
32
|
# class HTTPShell < Ronin::Core::CLI::Shell
|
33
|
-
#
|
33
|
+
#
|
34
34
|
# shell_name 'http'
|
35
|
-
#
|
35
|
+
#
|
36
36
|
# command :get, usage: 'PATH [HEADERS...]',
|
37
37
|
# summary: 'Sends a GET request'
|
38
38
|
# def get(path,*headers)
|
@@ -44,9 +44,9 @@ module Ronin
|
|
44
44
|
# def post(path,data,*headers)
|
45
45
|
# # ...
|
46
46
|
# end
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# end
|
49
|
-
#
|
49
|
+
#
|
50
50
|
# HTTPShell.start
|
51
51
|
# # http> get /foo
|
52
52
|
#
|
@@ -260,7 +260,7 @@ module Ronin
|
|
260
260
|
command_string.length
|
261
261
|
}.max
|
262
262
|
|
263
|
-
command_table.each
|
263
|
+
command_table.each do |command_string,summary|
|
264
264
|
puts " #{command_string.ljust(max_command_string)}\t#{summary}"
|
265
265
|
end
|
266
266
|
end
|
@@ -300,11 +300,11 @@ module Ronin
|
|
300
300
|
|
301
301
|
method(name).parameters.each do |(type,arg)|
|
302
302
|
case type
|
303
|
-
when :req
|
303
|
+
when :req
|
304
304
|
minimum += 1
|
305
305
|
maximum += 1
|
306
306
|
when :opt then maximum += 1
|
307
|
-
when :rest then maximum
|
307
|
+
when :rest then maximum = Float::INFINITY
|
308
308
|
end
|
309
309
|
end
|
310
310
|
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -28,7 +28,6 @@ module Ronin
|
|
28
28
|
# for the generator command.
|
29
29
|
#
|
30
30
|
module Author
|
31
|
-
|
32
31
|
#
|
33
32
|
# The default author name.
|
34
33
|
#
|
@@ -59,7 +58,7 @@ module Ronin
|
|
59
58
|
value: {
|
60
59
|
type: String,
|
61
60
|
usage: 'NAME',
|
62
|
-
default: ->{ default_name }
|
61
|
+
default: -> { default_name }
|
63
62
|
},
|
64
63
|
desc: 'The name of the author' do |author|
|
65
64
|
@author_name = author
|
@@ -69,7 +68,7 @@ module Ronin
|
|
69
68
|
value: {
|
70
69
|
type: String,
|
71
70
|
usage: 'EMAIL',
|
72
|
-
default: ->{ default_email }
|
71
|
+
default: -> { default_email }
|
73
72
|
},
|
74
73
|
desc: 'The email address of the author' do |email|
|
75
74
|
@author_email = email
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
7
7
|
# by the Free Software Foundation, either version 3 of the License, or
|
8
8
|
# (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ronin-core is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU Lesser General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
@@ -31,17 +31,17 @@ module Ronin
|
|
31
31
|
# ## Example
|
32
32
|
#
|
33
33
|
# class Gen < Command
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# include Core::Generator
|
36
|
-
#
|
36
|
+
#
|
37
37
|
# template_dir File.join(ROOT,'data','templates')
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# argument :path, desc: 'The path of the script to genereate'
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# def run(path)
|
42
42
|
# erb 'script.rb.erb', path
|
43
43
|
# end
|
44
|
-
#
|
44
|
+
#
|
45
45
|
# end
|
46
46
|
#
|
47
47
|
module Generator
|
@@ -59,6 +59,9 @@ module Ronin
|
|
59
59
|
command.extend ClassMethods
|
60
60
|
end
|
61
61
|
|
62
|
+
#
|
63
|
+
# Class-methods.
|
64
|
+
#
|
62
65
|
module ClassMethods
|
63
66
|
#
|
64
67
|
# Gets or sets the template directory.
|