ronin-core 0.1.0.beta1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -0
  3. data/.rubocop.yml +13 -150
  4. data/.yardopts +1 -1
  5. data/ChangeLog.md +9 -1
  6. data/Gemfile +3 -1
  7. data/README.md +2 -1
  8. data/Rakefile +1 -1
  9. data/examples/ruby_shell.rb +5 -0
  10. data/examples/test_shell.rb +41 -0
  11. data/gemspec.yml +1 -1
  12. data/lib/ronin/core/class_registry.rb +18 -13
  13. data/lib/ronin/core/cli/command.rb +12 -12
  14. data/lib/ronin/core/cli/command_shell/command.rb +9 -6
  15. data/lib/ronin/core/cli/command_shell.rb +11 -11
  16. data/lib/ronin/core/cli/generator/options/author.rb +5 -6
  17. data/lib/ronin/core/cli/generator/options/description.rb +3 -3
  18. data/lib/ronin/core/cli/generator/options/reference.rb +3 -3
  19. data/lib/ronin/core/cli/generator/options/summary.rb +3 -3
  20. data/lib/ronin/core/cli/generator.rb +11 -8
  21. data/lib/ronin/core/cli/logging.rb +6 -3
  22. data/lib/ronin/core/cli/options/param.rb +5 -5
  23. data/lib/ronin/core/cli/options/values/arches.rb +3 -3
  24. data/lib/ronin/core/cli/options/values/oses.rb +3 -3
  25. data/lib/ronin/core/cli/printing/arch.rb +3 -3
  26. data/lib/ronin/core/cli/printing/metadata.rb +4 -4
  27. data/lib/ronin/core/cli/printing/os.rb +6 -3
  28. data/lib/ronin/core/cli/printing/params.rb +7 -7
  29. data/lib/ronin/core/cli/ruby_shell.rb +4 -3
  30. data/lib/ronin/core/cli/shell.rb +16 -8
  31. data/lib/ronin/core/git.rb +3 -3
  32. data/lib/ronin/core/home.rb +3 -3
  33. data/lib/ronin/core/metadata/authors/author.rb +6 -3
  34. data/lib/ronin/core/metadata/authors.rb +9 -6
  35. data/lib/ronin/core/metadata/description.rb +9 -6
  36. data/lib/ronin/core/metadata/id.rb +8 -5
  37. data/lib/ronin/core/metadata/references.rb +14 -7
  38. data/lib/ronin/core/metadata/summary.rb +11 -8
  39. data/lib/ronin/core/metadata/version.rb +9 -6
  40. data/lib/ronin/core/params/exceptions.rb +3 -3
  41. data/lib/ronin/core/params/mixin.rb +17 -17
  42. data/lib/ronin/core/params/param.rb +4 -4
  43. data/lib/ronin/core/params/types/boolean.rb +3 -3
  44. data/lib/ronin/core/params/types/enum.rb +8 -4
  45. data/lib/ronin/core/params/types/float.rb +3 -3
  46. data/lib/ronin/core/params/types/integer.rb +3 -3
  47. data/lib/ronin/core/params/types/numeric.rb +4 -4
  48. data/lib/ronin/core/params/types/regexp.rb +3 -3
  49. data/lib/ronin/core/params/types/string.rb +3 -3
  50. data/lib/ronin/core/params/types/type.rb +3 -3
  51. data/lib/ronin/core/params/types/uri.rb +3 -3
  52. data/lib/ronin/core/params/types.rb +7 -4
  53. data/lib/ronin/core/params.rb +3 -3
  54. data/lib/ronin/core/version.rb +4 -4
  55. data/ronin-core.gemspec +7 -4
  56. metadata +5 -90
  57. data/spec/class_registry_spec.rb +0 -224
  58. data/spec/cli/command_shell/command_spec.rb +0 -113
  59. data/spec/cli/command_shell_spec.rb +0 -1114
  60. data/spec/cli/command_spec.rb +0 -16
  61. data/spec/cli/fixtures/irb_command +0 -8
  62. data/spec/cli/fixtures/template/dir/file1.txt +0 -1
  63. data/spec/cli/fixtures/template/dir/file2.txt +0 -1
  64. data/spec/cli/fixtures/template/file.erb +0 -1
  65. data/spec/cli/fixtures/template/file.txt +0 -1
  66. data/spec/cli/generator/options/author_spec.rb +0 -121
  67. data/spec/cli/generator/options/description_spec.rb +0 -45
  68. data/spec/cli/generator/options/reference_spec.rb +0 -53
  69. data/spec/cli/generator/options/summary_spec.rb +0 -45
  70. data/spec/cli/generator_spec.rb +0 -244
  71. data/spec/cli/logging_spec.rb +0 -95
  72. data/spec/cli/options/param_spec.rb +0 -67
  73. data/spec/cli/options/values/arches_spec.rb +0 -62
  74. data/spec/cli/printing/arch_spec.rb +0 -130
  75. data/spec/cli/printing/metadata_spec.rb +0 -211
  76. data/spec/cli/printing/os_spec.rb +0 -64
  77. data/spec/cli/printing/params_spec.rb +0 -63
  78. data/spec/cli/ruby_shell.rb +0 -99
  79. data/spec/cli/shell_spec.rb +0 -211
  80. data/spec/fixtures/example_class_registry/base_class.rb +0 -9
  81. data/spec/fixtures/example_class_registry/classes/loaded_class.rb +0 -9
  82. data/spec/fixtures/example_class_registry/classes/name_mismatch.rb +0 -9
  83. data/spec/fixtures/example_class_registry/classes/no_module.rb +0 -4
  84. data/spec/fixtures/example_class_registry.rb +0 -8
  85. data/spec/git_spec.rb +0 -58
  86. data/spec/home_spec.rb +0 -64
  87. data/spec/metadata/authors/author_spec.rb +0 -335
  88. data/spec/metadata/authors_spec.rb +0 -126
  89. data/spec/metadata/description_spec.rb +0 -74
  90. data/spec/metadata/id_spec.rb +0 -92
  91. data/spec/metadata/references_spec.rb +0 -100
  92. data/spec/metadata/summary_spec.rb +0 -74
  93. data/spec/metadata/version_spec.rb +0 -72
  94. data/spec/params/mixin_spec.rb +0 -484
  95. data/spec/params/param_spec.rb +0 -164
  96. data/spec/params/types/boolean_spec.rb +0 -56
  97. data/spec/params/types/enum_spec.rb +0 -94
  98. data/spec/params/types/float_spec.rb +0 -107
  99. data/spec/params/types/integer_spec.rb +0 -155
  100. data/spec/params/types/numeric_spec.rb +0 -138
  101. data/spec/params/types/regexp_spec.rb +0 -64
  102. data/spec/params/types/string_spec.rb +0 -174
  103. data/spec/params/types/type_spec.rb +0 -14
  104. data/spec/params/types/uri_spec.rb +0 -62
  105. data/spec/spec_helper.rb +0 -11
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -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.
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -21,6 +21,9 @@ require 'command_kit/colors'
21
21
  module Ronin
22
22
  module Core
23
23
  module CLI
24
+ #
25
+ # Helper methods for printing log messages.
26
+ #
24
27
  module Logging
25
28
  include CommandKit::Colors
26
29
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ # Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
4
4
  #
5
5
  # This file is part of ronin-core.
6
6
  #
@@ -8,12 +8,12 @@
8
8
  # it under the terms of the GNU Lesser General Public License as published
9
9
  # by the Free Software Foundation, either version 3 of the License, or
10
10
  # (at your option) any later version.
11
- #
11
+ #
12
12
  # ronin-core is distributed in the hope that it will be useful,
13
13
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
15
  # GNU Lesser General Public License for more details.
16
- #
16
+ #
17
17
  # You should have received a copy of the GNU Lesser General Public License
18
18
  # along with ronin-core. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
@@ -35,8 +35,8 @@ module Ronin
35
35
  def self.included(command)
36
36
  command.option :param, short: '-p',
37
37
  value: {
38
- type: /\A[^=]+=.+\z/,
39
- usage: 'NAME=VALUE',
38
+ type: /\A[^=]+=.+\z/,
39
+ usage: 'NAME=VALUE'
40
40
  },
41
41
  desc: 'Sets a param' do |str|
42
42
  name, value = str.split('=',2)
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -32,7 +32,7 @@ module Ronin
32
32
  include CommandKit::Printing::Lists
33
33
 
34
34
  #
35
- # Addss a `-v,--verbose` option to the command class.
35
+ # Adds a `-v,--verbose` option to the command class.
36
36
  #
37
37
  # @param [Class<Command>] command
38
38
  # The command class including {Metadata}.
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -20,6 +20,9 @@ module Ronin
20
20
  module Core
21
21
  module CLI
22
22
  module Printing
23
+ #
24
+ # Helper methods for printing Operating System (OS) names.
25
+ #
23
26
  module OS
24
27
  # Mapping of Operating System (OS) IDs to printable names.
25
28
  OS_NAMES = {
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -45,10 +45,10 @@ module Ronin
45
45
  rows = []
46
46
 
47
47
  klass.params.each do |name,param|
48
- param_type = param.type.class.name.split('::').last
49
- required = if param.required? then 'Yes'
50
- else 'No'
51
- end
48
+ param_type = param.type.class.name.split('::').last
49
+ required = if param.required? then 'Yes'
50
+ else 'No'
51
+ end
52
52
  default = param.default_value
53
53
  description = param.desc
54
54
 
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -121,6 +121,7 @@ module Ronin
121
121
  PROMPT_C: "#{prompt_prefix}* ",
122
122
  RETURN: "=> %s#{$/}"
123
123
  }
124
+
124
125
  IRB.conf[:PROMPT_MODE] = :RONIN
125
126
  end
126
127
  end
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -23,6 +23,9 @@ require 'reline'
23
23
  module Ronin
24
24
  module Core
25
25
  module CLI
26
+ #
27
+ # Base class for all interactive CLI shells.
28
+ #
26
29
  class Shell
27
30
 
28
31
  include CommandKit::Printing
@@ -61,7 +64,7 @@ module Ronin
61
64
  @prompt_sigil = new_sigil
62
65
  else
63
66
  @prompt_sigil ||= if superclass <= Shell
64
- superclass.prompt_sigil
67
+ superclass.prompt_sigil
65
68
  end
66
69
  end
67
70
  end
@@ -83,12 +86,12 @@ module Ronin
83
86
  def self.start(*arguments,**kwargs)
84
87
  shell = new(*arguments,**kwargs)
85
88
 
89
+ prev_completion_proc = Reline.completion_proc
86
90
  Reline.completion_proc = shell.method(:complete)
87
- use_history = true
88
91
 
89
92
  begin
90
93
  loop do
91
- line = Reline.readline("#{shell.prompt} ", use_history)
94
+ line = Reline.readline("#{shell.prompt} ", true)
92
95
 
93
96
  if line.nil? # Ctrl^D
94
97
  puts
@@ -100,6 +103,8 @@ module Ronin
100
103
  unless line.empty?
101
104
  begin
102
105
  shell.exec(line)
106
+ rescue Interrupt
107
+ # catch Ctrl^C but keep reading input
103
108
  rescue SystemExit
104
109
  break
105
110
  rescue => error
@@ -107,7 +112,10 @@ module Ronin
107
112
  end
108
113
  end
109
114
  end
110
- rescue Interrupt # catch Ctrl^C
115
+ rescue Interrupt
116
+ # catch Ctrl^C and return
117
+ ensure
118
+ Reline.completion_proc = prev_completion_proc
111
119
  end
112
120
  end
113
121
 
@@ -118,7 +126,7 @@ module Ronin
118
126
  # The partial input being tab completed.
119
127
  #
120
128
  # @param [String] preposing
121
- # The optional command name that preceeds the argument that's being
129
+ # The optional command name that precedes the argument that's being
122
130
  # tab completed.
123
131
  #
124
132
  # @return [Array<String>, nil]
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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
  #
@@ -20,6 +20,9 @@ module Ronin
20
20
  module Core
21
21
  module Metadata
22
22
  module Authors
23
+ #
24
+ # Represents author metadata.
25
+ #
23
26
  class Author
24
27
 
25
28
  # The author's name.
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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,12 +28,12 @@ module Ronin
28
28
  # ### Example
29
29
  #
30
30
  # class MyModule
31
- #
31
+ #
32
32
  # include Ronin::Core::Metadata::Authors
33
- #
33
+ #
34
34
  # author 'John Doe'
35
35
  # author 'John Smith', email: 'john.smith@example.com'
36
- #
36
+ #
37
37
  # end
38
38
  #
39
39
  # puts MyModule.authors
@@ -53,6 +53,9 @@ module Ronin
53
53
  base.extend ClassMethods
54
54
  end
55
55
 
56
+ #
57
+ # Class-methods.
58
+ #
56
59
  module ClassMethods
57
60
  #
58
61
  # The authors associated with the class.
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2021-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
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,9 +26,9 @@ module Ronin
26
26
  # ### Example
27
27
  #
28
28
  # class MyModule
29
- #
29
+ #
30
30
  # include Ronin::Core::Metadata::Description
31
- #
31
+ #
32
32
  # description <<~DESC
33
33
  # Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
34
34
  # eiusmod tempor incididunt ut labore et dolore magna aliqua.
@@ -41,7 +41,7 @@ module Ronin
41
41
  # proident, sunt in culpa qui officia deserunt mollit anim id est
42
42
  # laborum.
43
43
  # DESC
44
- #
44
+ #
45
45
  # end
46
46
  #
47
47
  module Description
@@ -57,6 +57,9 @@ module Ronin
57
57
  base.extend ClassMethods
58
58
  end
59
59
 
60
+ #
61
+ # Class-methods.
62
+ #
60
63
  module ClassMethods
61
64
  #
62
65
  # Gets or sets the description.