ronin 1.0.0 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/.yardopts +0 -1
  2. data/ChangeLog.md +67 -3
  3. data/Gemfile +20 -12
  4. data/README.md +3 -5
  5. data/gemspec.yml +5 -5
  6. data/lib/ronin/address.rb +8 -3
  7. data/lib/ronin/arch.rb +39 -14
  8. data/lib/ronin/author.rb +2 -0
  9. data/lib/ronin/auto_load.rb +67 -0
  10. data/lib/ronin/campaign.rb +15 -2
  11. data/lib/ronin/class_methods.rb +7 -1
  12. data/lib/ronin/config.rb +5 -0
  13. data/lib/ronin/credential.rb +14 -3
  14. data/lib/ronin/database/database.rb +38 -12
  15. data/lib/ronin/database/migrations.rb +3 -1
  16. data/lib/ronin/database/migrations/add_created_at_column_to_targets_table.rb +48 -0
  17. data/lib/ronin/database/migrations/add_updated_at_column_to_campaigns_table.rb +47 -0
  18. data/lib/ronin/database/migrations/create_licenses_table.rb +1 -1
  19. data/lib/ronin/database/migrations/create_passwords_table.rb +1 -1
  20. data/lib/ronin/database/migrations/{create_cached_files_table.rb → create_script_paths_table.rb} +4 -4
  21. data/lib/ronin/database/migrations/migration.rb +3 -6
  22. data/lib/ronin/database/migrations/migrations.rb +3 -3
  23. data/lib/ronin/email_address.rb +20 -3
  24. data/lib/ronin/environment.rb +0 -3
  25. data/lib/ronin/host_name.rb +20 -6
  26. data/lib/ronin/host_name_ip_address.rb +2 -3
  27. data/lib/ronin/installation.rb +92 -23
  28. data/lib/ronin/ip_address.rb +31 -8
  29. data/lib/ronin/ip_address_mac_address.rb +2 -3
  30. data/lib/ronin/license.rb +1 -1
  31. data/lib/ronin/mac_address.rb +6 -4
  32. data/lib/ronin/model/class_methods.rb +4 -0
  33. data/lib/ronin/model/has_authors/class_methods.rb +4 -0
  34. data/lib/ronin/model/has_authors/has_authors.rb +4 -0
  35. data/lib/ronin/model/has_description/class_methods.rb +2 -0
  36. data/lib/ronin/model/has_description/has_description.rb +2 -0
  37. data/lib/ronin/model/has_license/class_methods.rb +2 -0
  38. data/lib/ronin/model/has_license/has_license.rb +4 -0
  39. data/lib/ronin/model/has_name/class_methods.rb +2 -0
  40. data/lib/ronin/model/has_name/has_name.rb +4 -0
  41. data/lib/ronin/model/has_title/class_methods.rb +2 -0
  42. data/lib/ronin/model/has_title/has_title.rb +2 -0
  43. data/lib/ronin/model/has_unique_name/class_methods.rb +2 -0
  44. data/lib/ronin/model/has_unique_name/has_unique_name.rb +7 -1
  45. data/lib/ronin/model/has_version/class_methods.rb +4 -0
  46. data/lib/ronin/model/has_version/has_version.rb +2 -0
  47. data/lib/ronin/model/model.rb +2 -0
  48. data/lib/ronin/model/types.rb +1 -7
  49. data/lib/ronin/model/types/description.rb +2 -0
  50. data/lib/ronin/network/mixins/esmtp.rb +40 -25
  51. data/lib/ronin/network/mixins/http.rb +336 -73
  52. data/lib/ronin/network/mixins/imap.rb +38 -25
  53. data/lib/ronin/network/mixins/pop3.rb +34 -21
  54. data/lib/ronin/network/mixins/smtp.rb +40 -25
  55. data/lib/ronin/network/mixins/tcp.rb +66 -41
  56. data/lib/ronin/network/mixins/telnet.rb +43 -30
  57. data/lib/ronin/network/mixins/udp.rb +59 -40
  58. data/lib/ronin/open_port.rb +12 -5
  59. data/lib/ronin/organization.rb +1 -2
  60. data/lib/ronin/os.rb +10 -3
  61. data/lib/ronin/os_guess.rb +2 -3
  62. data/lib/ronin/password.rb +11 -3
  63. data/lib/ronin/port.rb +7 -2
  64. data/lib/ronin/{engine/exceptions/deploy_failed.rb → repositories.rb} +4 -6
  65. data/lib/ronin/repository.rb +110 -37
  66. data/lib/ronin/ronin.rb +4 -3
  67. data/lib/ronin/{engine.rb → script.rb} +2 -1
  68. data/lib/ronin/{engine → script}/buildable.rb +43 -29
  69. data/lib/ronin/script/class_methods.rb +84 -0
  70. data/lib/ronin/{engine → script}/deployable.rb +61 -40
  71. data/lib/ronin/{engine → script}/exceptions.rb +4 -3
  72. data/lib/ronin/script/exceptions/deploy_failed.rb +27 -0
  73. data/lib/ronin/{engine/exceptions/not_built.rb → script/exceptions/exception.rb} +2 -2
  74. data/lib/ronin/{engine/exceptions/verification_failed.rb → script/exceptions/not_built.rb} +4 -2
  75. data/lib/ronin/script/exceptions/test_failed.rb +27 -0
  76. data/lib/ronin/script/instance_methods.rb +217 -0
  77. data/lib/ronin/script/path.rb +277 -0
  78. data/lib/ronin/{engine/engine.rb → script/script.rb} +52 -15
  79. data/lib/ronin/{engine/verifiable.rb → script/testable.rb} +97 -68
  80. data/lib/ronin/service.rb +1 -2
  81. data/lib/ronin/service_credential.rb +1 -2
  82. data/lib/ronin/software.rb +3 -2
  83. data/lib/ronin/spec/database.rb +0 -4
  84. data/lib/ronin/target.rb +11 -3
  85. data/lib/ronin/tcp_port.rb +3 -2
  86. data/lib/ronin/udp_port.rb +2 -0
  87. data/lib/ronin/ui/cli/cli.rb +6 -0
  88. data/lib/ronin/ui/cli/command.rb +48 -12
  89. data/lib/ronin/ui/cli/commands/campaigns.rb +3 -3
  90. data/lib/ronin/ui/cli/commands/console.rb +2 -1
  91. data/lib/ronin/ui/cli/commands/creds.rb +3 -3
  92. data/lib/ronin/ui/cli/commands/database.rb +1 -17
  93. data/lib/ronin/ui/cli/commands/emails.rb +3 -3
  94. data/lib/ronin/ui/cli/commands/hosts.rb +3 -7
  95. data/lib/ronin/ui/cli/commands/ips.rb +3 -7
  96. data/lib/ronin/ui/cli/commands/repos.rb +5 -17
  97. data/lib/ronin/ui/cli/commands/urls.rb +3 -3
  98. data/lib/ronin/ui/cli/model_command.rb +82 -97
  99. data/lib/ronin/ui/cli/resources_command.rb +89 -0
  100. data/lib/ronin/ui/cli/script_command.rb +115 -0
  101. data/lib/ronin/ui/console.rb +17 -3
  102. data/lib/ronin/ui/output/helpers.rb +18 -0
  103. data/lib/ronin/ui/output/output.rb +20 -1
  104. data/lib/ronin/ui/output/terminal/color.rb +10 -0
  105. data/lib/ronin/ui/output/terminal/raw.rb +10 -0
  106. data/lib/ronin/ui/shell.rb +2 -0
  107. data/lib/ronin/url.rb +47 -12
  108. data/lib/ronin/url_query_param.rb +4 -0
  109. data/lib/ronin/url_scheme.rb +3 -3
  110. data/lib/ronin/user_name.rb +2 -0
  111. data/lib/ronin/version.rb +1 -1
  112. data/lib/ronin/web_credential.rb +6 -3
  113. data/spec/arch_spec.rb +3 -3
  114. data/spec/classes/my_script.rb +21 -0
  115. data/spec/helpers/repos/{test1 → installed}/ronin.yml +1 -1
  116. data/spec/helpers/repos/{hello/cache → installed/scripts}/.keep +0 -0
  117. data/spec/helpers/repos/local/lib/init.rb +1 -0
  118. data/spec/helpers/repos/{hello → local}/lib/stuff/another_test.rb +0 -0
  119. data/spec/helpers/repos/{hello → local}/lib/stuff/test.rb +0 -0
  120. data/spec/helpers/repos/{random → local}/ronin.yml +1 -1
  121. data/spec/helpers/repos/{random/cache → local/scripts}/.keep +0 -0
  122. data/spec/helpers/repos/{hello → remote}/ronin.yml +1 -1
  123. data/spec/helpers/repos/remote/scripts/.keep +0 -0
  124. data/spec/helpers/repos/{test2 → scripts}/ronin.yml +0 -0
  125. data/spec/helpers/repos/scripts/scripts/cached/cached.rb +10 -0
  126. data/spec/helpers/repos/scripts/scripts/cached/missing.rb +10 -0
  127. data/spec/helpers/repos/scripts/scripts/cached/modified.rb +10 -0
  128. data/spec/helpers/repos/scripts/scripts/cached/unmodified.rb +10 -0
  129. data/spec/helpers/repos/scripts/scripts/failures/exceptions.rb +11 -0
  130. data/spec/helpers/repos/{test2/cache/cacheable_model → scripts/scripts/failures}/load_errors.rb +3 -1
  131. data/spec/helpers/repos/{test2/cache/cacheable_model → scripts/scripts/failures}/name_errors.rb +1 -0
  132. data/spec/helpers/repos/scripts/scripts/failures/no_method_errors.rb +10 -0
  133. data/spec/helpers/repos/scripts/scripts/failures/syntax_errors.rb +11 -0
  134. data/spec/helpers/repos/scripts/scripts/failures/validation_errors.rb +11 -0
  135. data/spec/helpers/repos/scripts/scripts/my_scripts/test.rb +16 -0
  136. data/spec/model/spec_helper.rb +0 -2
  137. data/spec/repository_spec.rb +61 -81
  138. data/spec/ronin_spec.rb +2 -2
  139. data/spec/{engine → script}/buildable_spec.rb +9 -9
  140. data/spec/script/classes/buildable_class.rb +15 -0
  141. data/spec/script/classes/deployable_class.rb +13 -0
  142. data/spec/{engine/classes/engine_class.rb → script/classes/script_class.rb} +3 -3
  143. data/spec/{engine/classes/verifiable_class.rb → script/classes/testable_class.rb} +5 -5
  144. data/spec/{engine → script}/deployable_spec.rb +10 -10
  145. data/spec/{cached_file_spec.rb → script/path_spec.rb} +33 -72
  146. data/spec/script/script_spec.rb +130 -0
  147. data/spec/script/testable_spec.rb +117 -0
  148. data/spec/spec_helper.rb +15 -13
  149. metadata +114 -139
  150. data/lib/ronin/cached_file.rb +0 -247
  151. data/lib/ronin/engine/class_methods.rb +0 -135
  152. data/lib/ronin/engine/instance_methods.rb +0 -97
  153. data/lib/ronin/model/cacheable.rb +0 -21
  154. data/lib/ronin/model/cacheable/cacheable.rb +0 -273
  155. data/lib/ronin/model/cacheable/class_methods.rb +0 -60
  156. data/lib/ronin/ui/cli/engine_command.rb +0 -106
  157. data/spec/engine/classes/buildable_class.rb +0 -15
  158. data/spec/engine/classes/deployable_class.rb +0 -13
  159. data/spec/engine/engine_spec.rb +0 -55
  160. data/spec/engine/verifiable_spec.rb +0 -117
  161. data/spec/helpers/repos/hello/lib/init.rb +0 -1
  162. data/spec/helpers/repos/test1/cache/cacheable_model/one.rb +0 -15
  163. data/spec/helpers/repos/test2/cache/cacheable_model/exceptions.rb +0 -7
  164. data/spec/helpers/repos/test2/cache/cacheable_model/no_method_errors.rb +0 -9
  165. data/spec/helpers/repos/test2/cache/cacheable_model/syntax_errors.rb +0 -7
  166. data/spec/helpers/repos/test2/cache/cacheable_model/two.rb +0 -15
  167. data/spec/helpers/repos/test2/cache/cacheable_model/validation_errors.rb +0 -9
  168. data/spec/model/cacheable_spec.rb +0 -96
  169. data/spec/model/models/cacheable_model.rb +0 -13
data/.yardopts CHANGED
@@ -1,4 +1,3 @@
1
1
  --markup markdown --title 'Ronin Documentation' --protected
2
- --plugin yard-parameters
3
2
  --plugin yard-dm
4
3
  --plugin yard-dm-is-predefined
data/ChangeLog.md CHANGED
@@ -1,3 +1,67 @@
1
+ ### 1.1.0 / 2011-05-17
2
+
3
+ * Require env ~> 0.2.
4
+ * Require data_paths ~> 0.3.
5
+ * Require ronin-support ~> 0.2.
6
+ * Added `ronin/repositories`, for quickly loading all repositories.
7
+ * Added {Ronin::AutoLoad}.
8
+ * Added {Ronin::Arch.arm}.
9
+ * Added {Ronin::Arch.mips}.
10
+ * Added {Ronin::Arch.x86}.
11
+ * Added timestamps to {Ronin::Campaign}.
12
+ * Added the `created_at` timestamp to {Ronin::Target}.
13
+ * Added {Ronin::Network::Mixins::HTTP#http_status}.
14
+ * Added {Ronin::Network::Mixins::HTTP#http_ok?}.
15
+ * Added {Ronin::Network::Mixins::HTTP#http_server}.
16
+ * Added {Ronin::Network::Mixins::HTTP#http_powered_by}.
17
+ * Added `print_info` method calls to {Ronin::Network::Mixins::HTTP}.
18
+ * Added {Ronin::Script::InstanceMethods#run}.
19
+ * Added {Ronin::Script::Exception}.
20
+ * Added {Ronin::Script::Path#to_s}.
21
+ * Added {Ronin::Script::ClassMethods#load_from}.
22
+ * Added {Ronin::Repository#find_script}.
23
+ * Added {Ronin::UI::CLI::Command#setup}.
24
+ * Added {Ronin::UI::CLI::ResourcesCommand}.
25
+ * Added {Ronin::UI::CLI::ScriptCommand}.
26
+ * Added the `--database` option to {Ronin::UI::CLI::ModelCommand}.
27
+ * Renamed `Ronin::Engine` to {Ronin::Script}.
28
+ * Renamed `Ronin::Engine::Verifiable` to {Ronin::Script::Testable}.
29
+ * Renamed `Ronin::Engine#engine_name` to
30
+ {Ronin::Script::InstanceMethods#script_type}.
31
+ * Renamed `Ronin::Engine::InstanceMethods#load_original!` to
32
+ {Ronin::Script::InstanceMethods#load_script!}.
33
+ * Renamed `Ronin::CachedFile` to {Ronin::Script::Path}.
34
+ * Renamed `Ronin::UI::CLI::ModelCommand.model=` to
35
+ {Ronin::UI::CLI::ModelCommand.model}.
36
+ * Renamed `Ronin::UI::CLI::ModelCommand#model` to
37
+ {Ronin::UI::CLI::ModelCommand.query_model}.
38
+ * Renamed `Ronin::UI::CLI::ModelCommand#new_query` to
39
+ {Ronin::UI::CLI::ModelCommand#query}.
40
+ * Renamed `Ronin::UI::CLI::ModelCommand#print_resource` to
41
+ {Ronin::UI::CLI::ResourcesCommand#print_resource}.
42
+ * Renamed `Ronin::UI::CLI::ModelCommand#print_resources` to
43
+ {Ronin::UI::CLI::ResourcesCommand#print_resources}.
44
+ * Removed `Ronin::Engine#method_missing`.
45
+ * Extend `DataPaths::Finders` into {Ronin::Config}.
46
+ * Fixed a RubyGems deprecation in {Ronin::Installation}.
47
+ * Enabled verbose DataMapper logging if the `DEBUG` environment variable is
48
+ set.
49
+ * Fixed a bug in {Ronin::Database::Migrations::Migration#initialize}, where
50
+ `:needs` was being overridden.
51
+ * Ensure that {Ronin::Database::Migrations} preserves the order of loaded
52
+ migrations.
53
+ * Set the length of {Ronin::Password.clear_text} to 256.
54
+ * Set the length of {Ronin::License.url} to 256.
55
+ * Merged `Ronin::Model::Cacheable` into {Ronin::Script}.
56
+ * Repositories can now cache/load scripts from the `scripts/` directory.
57
+ * Set {Ronin::UI::Output.handler} to {Ronin::UI::Output::Terminal::Raw},
58
+ when `STDOUT` is not a tty.
59
+ * {Ronin::UI::CLI::ModelCommand#setup} now automatically calls
60
+ {Ronin::Database.setup}, before executing the command.
61
+ * Merged `query_method` into {Ronin::UI::CLI::ModelCommand#query}.
62
+ * Allow {Ronin::UI::CLI::ModelCommand.query_option} to map to Model
63
+ properties.
64
+
1
65
  ### 1.0.0 / 2011-03-25
2
66
 
3
67
  * Upgraded to the GPL-3 license.
@@ -52,7 +116,7 @@
52
116
  * Added {Ronin::Organization}.
53
117
  * Added {Ronin::Campaign}.
54
118
  * Added {Ronin::Target}.
55
- * Added {Ronin::Engine}.
119
+ * Added `Ronin::Engine`.
56
120
  * Added {Ronin::UI::Output::Terminal::Raw}.
57
121
  * Added {Ronin::UI::Output::Terminal::Color}.
58
122
  * Added the `ronin-repos` command for listing, adding, installing and
@@ -74,8 +138,8 @@
74
138
  * Renamed `Ronin::Product` to {Ronin::Software}.
75
139
  * Renamed `Ronin::UI::CommandLine` to {Ronin::UI::CLI}.
76
140
  * Renamed `Ronin::Platform::Overlay` to {Ronin::Repository}.
77
- * Renamed `Ronin::Platform::CachedFile` to {Ronin::CachedFile}.
78
- * Renamed `Ronin::Platform::Cacheable` to {Ronin::Model::Cacheable}.
141
+ * Renamed `Ronin::Platform::CachedFile` to `Ronin::CachedFile`.
142
+ * Renamed `Ronin::Platform::Cacheable` to `Ronin::Model::Cacheable`.
79
143
  * Removed `Ronin::Platform::Extension`.
80
144
  * Removed `Ronin::Platform`.
81
145
  * Moved the `ronin-add`, `ronin-install`, `ronin-list` and `ronin-uninstall`
data/Gemfile CHANGED
@@ -22,7 +22,7 @@ gemspec
22
22
  # gem 'dm-timestamps', DM_VERSION, :git => "#{DM_URI}/dm-timestamps.git"
23
23
 
24
24
  # Library dependencies
25
- # gem 'ronin-support', '~> 0.1.0', :git => "#{RONIN_URI}/ronin-support.git"
25
+ # gem 'ronin-support', '~> 0.2', :git => "#{RONIN_URI}/ronin-support.git"
26
26
 
27
27
  group :development do
28
28
  gem 'rake', '~> 0.8.7'
@@ -35,15 +35,23 @@ group :development do
35
35
  gem 'dm-visualizer', '~> 0.2.0'
36
36
  end
37
37
 
38
- group :test do
39
- adapters = (ENV['ADAPTER'] || ENV['ADAPTERS'])
40
- adapters = adapters.to_s.gsub(',',' ').split(' ') - ['in_memory']
41
-
42
- DM_ADAPTERS = %w[sqlite3 postgres mysql oracle sqlserver]
43
-
44
- unless (DM_ADAPTERS & adapters).empty?
45
- adapters.each do |adapter|
46
- gem "dm-#{adapter}-adapter", DM_VERSION, :git => "#{DM_URI}/dm-#{adapter}-adapter.git"
47
- end
48
- end
38
+ #
39
+ # To enable additional DataMapper adapters for development work or for
40
+ # testing purposes, simple set the ADAPTER or ADAPTERS environment
41
+ # variable:
42
+ #
43
+ # export ADAPTER="postgres"
44
+ # bundle install
45
+ #
46
+ # ./bin/ronin --database postgres://ronin@localhost/ronin
47
+ #
48
+ require 'set'
49
+
50
+ DM_ADAPTERS = Set['postgres', 'mysql', 'oracle', 'sqlserver']
51
+
52
+ adapters = (ENV['ADAPTER'] || ENV['ADAPTERS']).to_s
53
+ adapters = Set.new(adapters.to_s.tr(',',' ').split)
54
+
55
+ (DM_ADAPTERS & adapters).each do |adapter|
56
+ gem "dm-#{adapter}-adapter", DM_VERSION #, :git => "#{DM_URI}/dm-#{adapter}-adapter.git"
49
57
  end
data/README.md CHANGED
@@ -156,19 +156,17 @@ Remove a Database:
156
156
  * [parameters](http://github.com/postmodern/parameters#readme)
157
157
  ~> 0.2, >= 0.2.3
158
158
  * [data_paths](http://github.com/postmodern/data_paths#readme)
159
- ~> 0.2, >= 0.2.1
159
+ ~> 0.3
160
160
  * [object_loader](http://github.com/postmodern/object_loader#readme)
161
161
  ~> 1.0
162
162
  * [env](http://github.com/postmodern/env#readme)
163
- ~> 0.1, >= 0.1.2
163
+ ~> 0.2
164
164
  * [pullr](http://github.com/postmodern/pullr#readme)
165
165
  ~> 0.1, >= 0.1.2
166
- * [hexdump](http://github.com/postmodern/hexdump#readme)
167
- ~> 0.1
168
166
  * [thor](http://github.com/wycats/thor#readme)
169
167
  ~> 0.14.3
170
168
  * [ronin-support](http://github.com/ronin-ruby/ronin-support#readme)
171
- ~> 0.1
169
+ ~> 0.2
172
170
 
173
171
  ## Install
174
172
 
data/gemspec.yml CHANGED
@@ -53,11 +53,11 @@ dependencies:
53
53
  uri-query_params: ~> 0.5, >= 0.5.2
54
54
  open_namespace: ~> 0.3
55
55
  parameters: ~> 0.2, >= 0.2.3
56
- data_paths: ~> 0.2, >= 0.2.1
56
+ # data_paths: ~> 0.3
57
+ data_paths: ~> 0.3.0.rc1
57
58
  object_loader: ~> 1.0
58
- env: ~> 0.1, >= 0.1.2
59
+ env: ~> 0.2
59
60
  pullr: ~> 0.1, >= 0.1.2
60
- hexdump: ~> 0.1
61
61
  ripl: ~> 0.3
62
62
  ripl-multi_line: ~> 0.2
63
63
  ripl-auto_indent: ~> 0.1
@@ -65,11 +65,11 @@ dependencies:
65
65
  ripl-color_result: ~> 0.3
66
66
  thor: ~> 0.14.3
67
67
  # Ronin dependencies:
68
- ronin-support: ~> 0.1
68
+ # ronin-support: ~> 0.2
69
+ ronin-support: ~> 0.2.0.rc1
69
70
 
70
71
  development_dependencies:
71
72
  bundler: ~> 1.0.10
72
73
  yard: ~> 0.6.4
73
- yard-parameters: ~> 0.1.0
74
74
  yard-dm: ~> 0.1.1
75
75
  yard-dm-is-predefined: ~> 0.2.0
data/lib/ronin/address.rb CHANGED
@@ -18,13 +18,12 @@
18
18
  #
19
19
 
20
20
  require 'ronin/model'
21
+ require 'ronin/organization'
22
+ require 'ronin/target'
21
23
 
22
24
  require 'dm-timestamps'
23
25
 
24
26
  module Ronin
25
- autoload :Organization, 'ronin/organization'
26
- autoload :Target, 'ronin/target'
27
-
28
27
  #
29
28
  # A base model which represents an Internet Address, such as:
30
29
  #
@@ -69,6 +68,8 @@ module Ronin
69
68
  #
70
69
  # @since 1.0.0
71
70
  #
71
+ # @api public
72
+ #
72
73
  def self.[](key)
73
74
  if key.kind_of?(String)
74
75
  first(:address => key)
@@ -85,6 +86,8 @@ module Ronin
85
86
  #
86
87
  # @since 1.0.0
87
88
  #
89
+ # @api public
90
+ #
88
91
  def to_s
89
92
  self.address.to_s
90
93
  end
@@ -97,6 +100,8 @@ module Ronin
97
100
  #
98
101
  # @since 1.0.0
99
102
  #
103
+ # @api public
104
+ #
100
105
  def inspect
101
106
  "#<#{self.class}: #{self.address}>"
102
107
  end
data/lib/ronin/arch.rb CHANGED
@@ -61,12 +61,14 @@ module Ronin
61
61
  #
62
62
  # @since 1.0.0
63
63
  #
64
+ # @api public
65
+ #
64
66
  def to_ary
65
67
  [self.endian, self.address_length]
66
68
  end
67
69
 
68
70
  #
69
- # Defines a new predefined Arch.
71
+ # Defines a new pre-defined Arch.
70
72
  #
71
73
  # @param [Symbol, String] name
72
74
  # The name of the architecture.
@@ -80,27 +82,20 @@ module Ronin
80
82
  # @option options [Integer] :address_length
81
83
  # The address-length of the architecture.
82
84
  #
83
- # @example Defining a predefined Arch
85
+ # @example Defining a pre-defined Arch
84
86
  # Arch.predefine :alpha, :endian => :big, :address_length => 8
85
87
  #
86
- # @example Retrieving a predefined Arch
88
+ # @example Retrieving a pre-defined Arch
87
89
  # Arch.alpha
88
90
  #
91
+ # @api private
92
+ #
89
93
  def self.predefine(name,options={})
90
94
  super(name,options.merge(:name => name))
91
95
  end
92
96
 
93
- # The i386 Architecture
94
- predefine :i386, :endian => :little, :address_length => 4
95
-
96
- # The i486 Architecture
97
- predefine :i486, :endian => :little, :address_length => 4
98
-
99
- # The i686 Architecture
100
- predefine :i686, :endian => :little, :address_length => 4
101
-
102
- # The i986 Architecture
103
- predefine :i986, :endian => :little, :address_length => 4
97
+ # The x86 Architecture
98
+ predefine :x86, :endian => :little, :address_length => 4
104
99
 
105
100
  # The x86_64 Architecture
106
101
  predefine :x86_64, :endian => :little, :address_length => 8
@@ -132,5 +127,35 @@ module Ronin
132
127
  # The ARM (big-endian) Architecture
133
128
  predefine :arm_be, :endian => :big, :address_length => 4
134
129
 
130
+ #
131
+ # @see x86
132
+ #
133
+ def self.i386; x86; end
134
+
135
+ #
136
+ # @see x86
137
+ #
138
+ def self.i486; x86; end
139
+
140
+ #
141
+ # @see x86
142
+ #
143
+ def self.i686; x86; end
144
+
145
+ #
146
+ # @see x86
147
+ #
148
+ def self.i986; x86; end
149
+
150
+ #
151
+ # @see mips_be
152
+ #
153
+ def self.mips; mips_be; end
154
+
155
+ #
156
+ # @see arm_be
157
+ #
158
+ def self.arm; arm_be; end
159
+
135
160
  end
136
161
  end
data/lib/ronin/author.rb CHANGED
@@ -54,6 +54,8 @@ module Ronin
54
54
  # @return [String]
55
55
  # The name of the author.
56
56
  #
57
+ # @api public
58
+ #
57
59
  def to_s
58
60
  if self.email
59
61
  "#{self.name} <#{self.email}>"
@@ -0,0 +1,67 @@
1
+ #
2
+ # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ #
4
+ # This file is part of Ronin.
5
+ #
6
+ # Ronin is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Ronin is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
+ #
19
+
20
+ require 'open_namespace'
21
+
22
+ module Ronin
23
+ #
24
+ # When included into other namespaces, it allows for auto-loading Classes
25
+ # or Modules via {#const_missing}.
26
+ #
27
+ # @since 1.1.0
28
+ #
29
+ module AutoLoad
30
+ def self.included(base)
31
+ base.send :include, OpenNamespace
32
+ base.send :extend, self
33
+ end
34
+
35
+ protected
36
+
37
+ #
38
+ # Transparently auto-loads Classes and Modules from their respective
39
+ # files using [OpenNamespace](http://rubydoc.info/gems/open_namespace).
40
+ #
41
+ # @param [String, Symbol] name
42
+ # The name of the Class or Module to auto-load.
43
+ #
44
+ # @return [Class, Module]
45
+ # The loaded Class or Module.
46
+ #
47
+ # @raise [NameError]
48
+ # The Class or Module could not be found.
49
+ #
50
+ # @since 1.1.0
51
+ #
52
+ # @api public
53
+ #
54
+ def const_missing(name)
55
+ const = super(name)
56
+
57
+ if Object.const_defined?('DataMapper')
58
+ # if the loaded Class is a DataMapper Resource, re-finalize
59
+ if const < DataMapper::Resource
60
+ DataMapper.finalize
61
+ end
62
+ end
63
+
64
+ return const
65
+ end
66
+ end
67
+ end
@@ -20,10 +20,11 @@
20
20
  require 'ronin/model'
21
21
  require 'ronin/model/has_unique_name'
22
22
  require 'ronin/model/has_description'
23
+ require 'ronin/target'
23
24
 
24
- module Ronin
25
- autoload :Target, 'ronin/target'
25
+ require 'dm-timestamps'
26
26
 
27
+ module Ronin
27
28
  #
28
29
  # Represents a grouping of targeted {Address}es.
29
30
  #
@@ -32,10 +33,14 @@ module Ronin
32
33
  include Model
33
34
  include Model::HasUniqueName
34
35
  include Model::HasDescription
36
+ include DataMapper::Timestamps
35
37
 
36
38
  # Primary key of the campaign
37
39
  property :id, Serial
38
40
 
41
+ # Defines the `created_at` and `updated_at` timestamps
42
+ timestamps :at
43
+
39
44
  # The targets of the campaign
40
45
  has 0..n, :targets
41
46
 
@@ -56,6 +61,8 @@ module Ronin
56
61
  #
57
62
  # @since 1.0.0
58
63
  #
64
+ # @api public
65
+ #
59
66
  def self.targeting(addr)
60
67
  all(:addresses => {:address => addr})
61
68
  end
@@ -71,6 +78,8 @@ module Ronin
71
78
  #
72
79
  # @since 1.0.0
73
80
  #
81
+ # @api public
82
+ #
74
83
  def self.targeting_orgs(names)
75
84
  all(:organizations => {:name => names})
76
85
  end
@@ -86,6 +95,8 @@ module Ronin
86
95
  #
87
96
  # @since 1.0.0
88
97
  #
98
+ # @api public
99
+ #
89
100
  def targets?(addr)
90
101
  self.addresses.include?(address)
91
102
  end
@@ -104,6 +115,8 @@ module Ronin
104
115
  #
105
116
  # @since 1.0.0
106
117
  #
118
+ # @api public
119
+ #
107
120
  def target!(addr)
108
121
  unless (address = Address.first(:address => addr))
109
122
  raise("unknown address #{addr.dump}")