ronin-core 0.1.0 → 0.1.2

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/.rubocop.yml +13 -150
  3. data/ChangeLog.md +18 -1
  4. data/Gemfile +3 -1
  5. data/Rakefile +1 -1
  6. data/examples/ruby_shell.rb +5 -0
  7. data/examples/test_shell.rb +41 -0
  8. data/lib/ronin/core/class_registry.rb +15 -10
  9. data/lib/ronin/core/cli/command.rb +11 -11
  10. data/lib/ronin/core/cli/command_shell/command.rb +8 -5
  11. data/lib/ronin/core/cli/command_shell.rb +9 -9
  12. data/lib/ronin/core/cli/generator/options/author.rb +4 -5
  13. data/lib/ronin/core/cli/generator/options/description.rb +2 -2
  14. data/lib/ronin/core/cli/generator/options/reference.rb +2 -2
  15. data/lib/ronin/core/cli/generator/options/summary.rb +2 -2
  16. data/lib/ronin/core/cli/generator.rb +10 -7
  17. data/lib/ronin/core/cli/logging.rb +5 -2
  18. data/lib/ronin/core/cli/options/param.rb +4 -4
  19. data/lib/ronin/core/cli/options/values/arches.rb +2 -2
  20. data/lib/ronin/core/cli/options/values/oses.rb +2 -2
  21. data/lib/ronin/core/cli/printing/arch.rb +2 -2
  22. data/lib/ronin/core/cli/printing/metadata.rb +2 -2
  23. data/lib/ronin/core/cli/printing/os.rb +5 -2
  24. data/lib/ronin/core/cli/printing/params.rb +6 -6
  25. data/lib/ronin/core/cli/ruby_shell.rb +16 -4
  26. data/lib/ronin/core/cli/shell.rb +14 -6
  27. data/lib/ronin/core/git.rb +2 -2
  28. data/lib/ronin/core/home.rb +2 -2
  29. data/lib/ronin/core/metadata/authors/author.rb +5 -2
  30. data/lib/ronin/core/metadata/authors.rb +8 -5
  31. data/lib/ronin/core/metadata/description.rb +8 -5
  32. data/lib/ronin/core/metadata/id.rb +7 -4
  33. data/lib/ronin/core/metadata/references.rb +13 -6
  34. data/lib/ronin/core/metadata/summary.rb +10 -7
  35. data/lib/ronin/core/metadata/version.rb +8 -5
  36. data/lib/ronin/core/params/exceptions.rb +2 -2
  37. data/lib/ronin/core/params/mixin.rb +15 -15
  38. data/lib/ronin/core/params/param.rb +2 -2
  39. data/lib/ronin/core/params/types/boolean.rb +2 -2
  40. data/lib/ronin/core/params/types/enum.rb +7 -3
  41. data/lib/ronin/core/params/types/float.rb +2 -2
  42. data/lib/ronin/core/params/types/integer.rb +2 -2
  43. data/lib/ronin/core/params/types/numeric.rb +3 -3
  44. data/lib/ronin/core/params/types/regexp.rb +2 -2
  45. data/lib/ronin/core/params/types/string.rb +2 -2
  46. data/lib/ronin/core/params/types/type.rb +2 -2
  47. data/lib/ronin/core/params/types/uri.rb +2 -2
  48. data/lib/ronin/core/params/types.rb +6 -3
  49. data/lib/ronin/core/params.rb +2 -2
  50. data/lib/ronin/core/version.rb +3 -3
  51. data/ronin-core.gemspec +5 -3
  52. metadata +3 -2
@@ -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
  #
@@ -29,36 +29,36 @@ module Ronin
29
29
  # ## Examples
30
30
  #
31
31
  # class BaseClass
32
- #
32
+ #
33
33
  # include Ronin::Core::Params::Mixin
34
- #
34
+ #
35
35
  # end
36
36
  #
37
37
  # class MyModule < BaseClass
38
- #
38
+ #
39
39
  # param :str, desc: 'A basic string param'
40
- #
40
+ #
41
41
  # param :feature_flag, Boolean, desc: 'A boolean param'
42
- #
42
+ #
43
43
  # param :enum, Enum[:one, :two, :three],
44
44
  # desc: 'An enum param'
45
45
  #
46
46
  # param :num1, Integer, desc: 'An integer param'
47
- #
47
+ #
48
48
  # param :num2, Integer, default: 42,
49
49
  # desc: 'A param with a default value'
50
- #
50
+ #
51
51
  # param :num3, Integer, default: ->{ rand(42) },
52
52
  # desc: 'A param with a dynamic default value'
53
- #
53
+ #
54
54
  # param :float, Float, 'Floating point param'
55
55
  #
56
56
  # param :url, URI, desc: 'URL param'
57
57
  #
58
58
  # param :pattern, Regexp, desc: 'Regular Expression param'
59
- #
59
+ #
60
60
  # end
61
- #
61
+ #
62
62
  # mod = MyModule.new(params: {num1: 1, enum: :two})
63
63
  # mod.params
64
64
  # # => {:num2=>42, :num3=>25, :num1=>1, :enum=>:two}
@@ -197,7 +197,7 @@ module Ronin
197
197
  end
198
198
 
199
199
  # The param values.
200
- #
200
+ #
201
201
  # @return [Hash{Symbol => Object}]
202
202
  #
203
203
  # @api public
@@ -220,7 +220,7 @@ module Ronin
220
220
  #
221
221
  def initialize(*arguments, params: nil, **kwargs, &block)
222
222
  if params then self.params = params
223
- else initialize_params()
223
+ else initialize_params
224
224
  end
225
225
 
226
226
  super(*arguments,**kwargs,&block)
@@ -281,7 +281,7 @@ module Ronin
281
281
  #
282
282
  def params=(new_params)
283
283
  # re-initialize the params each time they are set en-mass
284
- initialize_params()
284
+ initialize_params
285
285
 
286
286
  new_params.each do |name,value|
287
287
  set_param(name,value)
@@ -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
  #
@@ -51,7 +51,11 @@ module Ronin
51
51
  end
52
52
 
53
53
  @values = values
54
- @map = Hash[values.map { |value| [value.to_s, value] }]
54
+ @map = {}
55
+
56
+ values.each do |value|
57
+ @map[value.to_s] = value
58
+ end
55
59
  end
56
60
 
57
61
  #
@@ -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
  #
@@ -30,7 +30,7 @@ module Ronin
30
30
  # The optional minimum value.
31
31
  #
32
32
  # @return [::Integer, nil]
33
- #
33
+ #
34
34
  # @api private
35
35
  attr_reader :min
36
36
 
@@ -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
  #
@@ -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,6 +28,9 @@ require 'ronin/core/params/types/enum'
28
28
  module Ronin
29
29
  module Core
30
30
  module Params
31
+ #
32
+ # Contains all {Types} classes.
33
+ #
31
34
  module Types
32
35
  # Mapping of ruby core classes to param types.
33
36
  TYPE_ALIASES = {
@@ -35,7 +38,7 @@ module Ronin
35
38
  ::Integer => Types::Integer,
36
39
  ::Float => Types::Float,
37
40
  ::Regexp => Types::Regexp,
38
- ::URI => Types::URI,
41
+ ::URI => Types::URI
39
42
  }
40
43
 
41
44
  #
@@ -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
  #
@@ -19,6 +19,6 @@
19
19
  module Ronin
20
20
  module Core
21
21
  # ronin-core version
22
- VERSION = '0.1.0'
22
+ VERSION = '0.1.2'
23
23
  end
24
24
  end
data/ronin-core.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  Gem::Specification.new do |gem|
@@ -20,10 +22,10 @@ Gem::Specification.new do |gem|
20
22
  gem.homepage = gemspec['homepage']
21
23
  gem.metadata = gemspec['metadata'] if gemspec['metadata']
22
24
 
23
- glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
+ glob = ->(patterns) { gem.files & Dir[*patterns] }
24
26
 
25
27
  gem.files = `git ls-files`.split($/)
26
- gem.files = glob[gemspec['files']] if gemspec['files']
28
+ gem.files = glob[gemspec['files']] if gemspec['files']
27
29
  gem.files += Array(gemspec['generated_files'])
28
30
  # exclude test files from the packages gem
29
31
  gem.files -= glob[gemspec['test_files'] || 'spec/{**/}*']
@@ -44,7 +46,7 @@ Gem::Specification.new do |gem|
44
46
  gem.required_rubygems_version = gemspec['required_rubygems_version']
45
47
  gem.post_install_message = gemspec['post_install_message']
46
48
 
47
- split = lambda { |string| string.split(/,\s*/) }
49
+ split = ->(string) { string.split(/,\s*/) }
48
50
 
49
51
  if gemspec['dependencies']
50
52
  gemspec['dependencies'].each do |name,versions|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-01 00:00:00.000000000 Z
11
+ date: 2023-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reline
@@ -90,6 +90,7 @@ files:
90
90
  - README.md
91
91
  - Rakefile
92
92
  - examples/ruby_shell.rb
93
+ - examples/test_shell.rb
93
94
  - gemspec.yml
94
95
  - lib/ronin/core/class_registry.rb
95
96
  - lib/ronin/core/cli/command.rb