ronin-core 0.1.0.beta1 → 0.1.1
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/.github/workflows/ruby.yml +1 -0
- data/.rubocop.yml +13 -150
- data/.yardopts +1 -1
- data/ChangeLog.md +9 -1
- data/Gemfile +3 -1
- data/README.md +2 -1
- data/Rakefile +1 -1
- data/examples/ruby_shell.rb +5 -0
- data/examples/test_shell.rb +41 -0
- data/gemspec.yml +1 -1
- data/lib/ronin/core/class_registry.rb +18 -13
- data/lib/ronin/core/cli/command.rb +12 -12
- data/lib/ronin/core/cli/command_shell/command.rb +9 -6
- data/lib/ronin/core/cli/command_shell.rb +11 -11
- data/lib/ronin/core/cli/generator/options/author.rb +5 -6
- data/lib/ronin/core/cli/generator/options/description.rb +3 -3
- data/lib/ronin/core/cli/generator/options/reference.rb +3 -3
- data/lib/ronin/core/cli/generator/options/summary.rb +3 -3
- data/lib/ronin/core/cli/generator.rb +11 -8
- data/lib/ronin/core/cli/logging.rb +6 -3
- data/lib/ronin/core/cli/options/param.rb +5 -5
- data/lib/ronin/core/cli/options/values/arches.rb +3 -3
- data/lib/ronin/core/cli/options/values/oses.rb +3 -3
- data/lib/ronin/core/cli/printing/arch.rb +3 -3
- data/lib/ronin/core/cli/printing/metadata.rb +4 -4
- data/lib/ronin/core/cli/printing/os.rb +6 -3
- data/lib/ronin/core/cli/printing/params.rb +7 -7
- data/lib/ronin/core/cli/ruby_shell.rb +4 -3
- data/lib/ronin/core/cli/shell.rb +16 -8
- data/lib/ronin/core/git.rb +3 -3
- data/lib/ronin/core/home.rb +3 -3
- data/lib/ronin/core/metadata/authors/author.rb +6 -3
- data/lib/ronin/core/metadata/authors.rb +9 -6
- data/lib/ronin/core/metadata/description.rb +9 -6
- data/lib/ronin/core/metadata/id.rb +8 -5
- data/lib/ronin/core/metadata/references.rb +14 -7
- data/lib/ronin/core/metadata/summary.rb +11 -8
- data/lib/ronin/core/metadata/version.rb +9 -6
- data/lib/ronin/core/params/exceptions.rb +3 -3
- data/lib/ronin/core/params/mixin.rb +17 -17
- data/lib/ronin/core/params/param.rb +4 -4
- data/lib/ronin/core/params/types/boolean.rb +3 -3
- data/lib/ronin/core/params/types/enum.rb +8 -4
- data/lib/ronin/core/params/types/float.rb +3 -3
- data/lib/ronin/core/params/types/integer.rb +3 -3
- data/lib/ronin/core/params/types/numeric.rb +4 -4
- data/lib/ronin/core/params/types/regexp.rb +3 -3
- data/lib/ronin/core/params/types/string.rb +3 -3
- data/lib/ronin/core/params/types/type.rb +3 -3
- data/lib/ronin/core/params/types/uri.rb +3 -3
- data/lib/ronin/core/params/types.rb +7 -4
- data/lib/ronin/core/params.rb +3 -3
- data/lib/ronin/core/version.rb +4 -4
- data/ronin-core.gemspec +7 -4
- metadata +5 -90
- data/spec/class_registry_spec.rb +0 -224
- data/spec/cli/command_shell/command_spec.rb +0 -113
- data/spec/cli/command_shell_spec.rb +0 -1114
- data/spec/cli/command_spec.rb +0 -16
- data/spec/cli/fixtures/irb_command +0 -8
- data/spec/cli/fixtures/template/dir/file1.txt +0 -1
- data/spec/cli/fixtures/template/dir/file2.txt +0 -1
- data/spec/cli/fixtures/template/file.erb +0 -1
- data/spec/cli/fixtures/template/file.txt +0 -1
- data/spec/cli/generator/options/author_spec.rb +0 -121
- data/spec/cli/generator/options/description_spec.rb +0 -45
- data/spec/cli/generator/options/reference_spec.rb +0 -53
- data/spec/cli/generator/options/summary_spec.rb +0 -45
- data/spec/cli/generator_spec.rb +0 -244
- data/spec/cli/logging_spec.rb +0 -95
- data/spec/cli/options/param_spec.rb +0 -67
- data/spec/cli/options/values/arches_spec.rb +0 -62
- data/spec/cli/printing/arch_spec.rb +0 -130
- data/spec/cli/printing/metadata_spec.rb +0 -211
- data/spec/cli/printing/os_spec.rb +0 -64
- data/spec/cli/printing/params_spec.rb +0 -63
- data/spec/cli/ruby_shell.rb +0 -99
- data/spec/cli/shell_spec.rb +0 -211
- data/spec/fixtures/example_class_registry/base_class.rb +0 -9
- data/spec/fixtures/example_class_registry/classes/loaded_class.rb +0 -9
- data/spec/fixtures/example_class_registry/classes/name_mismatch.rb +0 -9
- data/spec/fixtures/example_class_registry/classes/no_module.rb +0 -4
- data/spec/fixtures/example_class_registry.rb +0 -8
- data/spec/git_spec.rb +0 -58
- data/spec/home_spec.rb +0 -64
- data/spec/metadata/authors/author_spec.rb +0 -335
- data/spec/metadata/authors_spec.rb +0 -126
- data/spec/metadata/description_spec.rb +0 -74
- data/spec/metadata/id_spec.rb +0 -92
- data/spec/metadata/references_spec.rb +0 -100
- data/spec/metadata/summary_spec.rb +0 -74
- data/spec/metadata/version_spec.rb +0 -72
- data/spec/params/mixin_spec.rb +0 -484
- data/spec/params/param_spec.rb +0 -164
- data/spec/params/types/boolean_spec.rb +0 -56
- data/spec/params/types/enum_spec.rb +0 -94
- data/spec/params/types/float_spec.rb +0 -107
- data/spec/params/types/integer_spec.rb +0 -155
- data/spec/params/types/numeric_spec.rb +0 -138
- data/spec/params/types/regexp_spec.rb +0 -64
- data/spec/params/types/string_spec.rb +0 -174
- data/spec/params/types/type_spec.rb +0 -14
- data/spec/params/types/uri_spec.rb +0 -62
- data/spec/spec_helper.rb +0 -11
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/.github/workflows/ruby.yml
CHANGED
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/.yardopts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
--markup markdown --title 'Ronin
|
|
1
|
+
--markup markdown --title 'Ronin::Core Documentation' --protected
|
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/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/ronin-rb/ronin-core/actions/workflows/ruby.yml)
|
|
4
4
|
[](https://codeclimate.com/github/ronin-rb/ronin-core)
|
|
5
|
+
[](https://badge.fury.io/rb/ronin-core)
|
|
5
6
|
|
|
6
7
|
* [Website](https://ronin-rb.dev/)
|
|
7
8
|
* [Source](https://github.com/ronin-rb/ronin-core)
|
|
@@ -274,7 +275,7 @@ http> post /foo var=bar
|
|
|
274
275
|
|
|
275
276
|
## License
|
|
276
277
|
|
|
277
|
-
Copyright (c) 2021-
|
|
278
|
+
Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3@gmail.com)
|
|
278
279
|
|
|
279
280
|
ronin-core is free software: you can redistribute it and/or modify
|
|
280
281
|
it under the terms of the GNU Lesser General Public License as published
|
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
|
data/gemspec.yml
CHANGED
|
@@ -11,7 +11,7 @@ homepage: https://ronin-rb.dev/
|
|
|
11
11
|
has_yard: true
|
|
12
12
|
|
|
13
13
|
metadata:
|
|
14
|
-
documentation_uri: https://
|
|
14
|
+
documentation_uri: https://ronin-rb.dev/docs/ronin-core
|
|
15
15
|
source_code_uri: https://github.com/ronin-rb/ronin-core
|
|
16
16
|
bug_tracker_uri: https://github.com/ronin-rb/ronin-core/issues
|
|
17
17
|
changelog_uri: https://github.com/ronin-rb/ronin-core/blob/main/ChangeLog.md
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2021-
|
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
4
4
|
#
|
|
5
5
|
# ronin-core 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
|
|
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
|
#
|
|
@@ -177,7 +180,7 @@ module Ronin
|
|
|
177
180
|
# file.
|
|
178
181
|
#
|
|
179
182
|
# @raise [LoadError]
|
|
180
|
-
# A load error
|
|
183
|
+
# A load error occurred while requiring the other files required by
|
|
181
184
|
# the class file.
|
|
182
185
|
#
|
|
183
186
|
def load_class_from_file(file)
|
|
@@ -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?
|
|
@@ -212,7 +217,7 @@ module Ronin
|
|
|
212
217
|
# a file/registered-name mismatch.
|
|
213
218
|
#
|
|
214
219
|
# @raise [LoadError]
|
|
215
|
-
# A load error
|
|
220
|
+
# A load error occurred while requiring the other files required by
|
|
216
221
|
# the class file.
|
|
217
222
|
#
|
|
218
223
|
def load_class(id)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2021-
|
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
4
4
|
#
|
|
5
5
|
# ronin-core 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
|
|
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
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2021-
|
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
4
4
|
#
|
|
5
5
|
# ronin-core 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
|
|
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
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2021-
|
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
4
4
|
#
|
|
5
5
|
# ronin-core 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
|
|
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
|
#
|
|
@@ -122,7 +122,7 @@ module Ronin
|
|
|
122
122
|
# The partial input being tab completed.
|
|
123
123
|
#
|
|
124
124
|
# @param [String] preposing
|
|
125
|
-
# The optional command name that
|
|
125
|
+
# The optional command name that precedes the argument that's being
|
|
126
126
|
# tab completed.
|
|
127
127
|
#
|
|
128
128
|
# @return [Array<String>, nil]
|
|
@@ -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
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2021-
|
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
4
4
|
#
|
|
5
5
|
# ronin-core 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
|
|
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
|