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
@@ -18,6 +18,8 @@
18
18
  #
19
19
 
20
20
  require 'ronin/network/telnet'
21
+ require 'ronin/ui/output/helpers'
22
+ require 'ronin/mixin'
21
23
 
22
24
  require 'parameters'
23
25
 
@@ -28,44 +30,51 @@ module Ronin
28
30
  # Adds Telnet convenience methods and connection parameters to a
29
31
  # class.
30
32
  #
33
+ # Defines the following parameters:
34
+ #
35
+ # * `host` (`String`) - Telnet host.
36
+ # * `port` (`Integer`) - Telnet port.
37
+ # * `telnet_user` (`String`) - Telnet user to login as.
38
+ # * `telnet_password` (`String`) - Telnet password to login with.
39
+ # * `telnet_proxy` (`String`) - Telnet proxy.
40
+ # * `telnet_ssl` (`Boolean`) - Enable Telnet over SSL. Defaults to `true`.
41
+ #
31
42
  module Telnet
32
- include Parameters
43
+ include Mixin
44
+
45
+ mixin UI::Output::Helpers, Parameters
33
46
 
34
- # Telnet host
35
- parameter :host,
36
- :type => String,
37
- :description => 'Telnet host'
47
+ mixin do
48
+ # Telnet host
49
+ parameter :host, :type => String,
50
+ :description => 'Telnet host'
38
51
 
39
- # Telnet port
40
- parameter :port,
41
- :type => Integer,
42
- :description => 'Telnet port'
52
+ # Telnet port
53
+ parameter :port, :type => Integer,
54
+ :description => 'Telnet port'
43
55
 
44
- # Telnet user
45
- parameter :telnet_user,
46
- :type => String,
47
- :description => 'Telnet user to login as'
56
+ # Telnet user
57
+ parameter :telnet_user, :type => String,
58
+ :description => 'Telnet user to login as'
48
59
 
49
- # Telnet password
50
- parameter :telnet_password,
51
- :type => String,
52
- :description => 'Telnet password to login with'
60
+ # Telnet password
61
+ parameter :telnet_password, :type => String,
62
+ :description => 'Telnet password to login with'
53
63
 
54
- # Telnet proxy
55
- parameter :telnet_proxy,
56
- :description => 'Telnet proxy'
64
+ # Telnet proxy
65
+ parameter :telnet_proxy, :description => 'Telnet proxy'
57
66
 
58
- # Enable Telnet SSL
59
- parameter :telnet_ssl,
60
- :type => true,
61
- :description => 'Enable Telnet over SSL'
67
+ # Enable Telnet SSL
68
+ parameter :telnet_ssl, :type => true,
69
+ :description => 'Enable Telnet over SSL'
70
+ end
62
71
 
63
72
  protected
64
73
 
65
74
  #
66
- # Creates a connection to a Telnet server. The {#host}, {#port},
67
- # {#telnet_user}, {#telnet_password}, {#telnet_proxy} and
68
- # {#telnet_ssl} parameters will also be used to connect to the
75
+ # Creates a connection to a Telnet server. The `host`, `port`,
76
+ # `telnet_user`, `telnet_password`, `telnet_proxy` and
77
+ # `telnet_ssl` parameters will also be used to connect to the
69
78
  # Telnet server.
70
79
  #
71
80
  # @param [Hash] options
@@ -130,6 +139,8 @@ module Ronin
130
139
  # telnet_connect
131
140
  # # => Net::Telnet
132
141
  #
142
+ # @api public
143
+ #
133
144
  def telnet_connect(options={},&block)
134
145
  options[:port] ||= self.port
135
146
  options[:user] ||= self.telnet_user
@@ -148,9 +159,9 @@ module Ronin
148
159
  end
149
160
 
150
161
  #
151
- # Starts a session with a Telnet server. The {#host}, {#port},
152
- # {#telnet_user}, {#telnet_password}, {#telnet_proxy} and
153
- # {#telnet_ssl} parameters will also be used to connect to the
162
+ # Starts a session with a Telnet server. The `host`, `port`,
163
+ # `telnet_user`, `telnet_password`, `telnet_proxy` and
164
+ # `telnet_ssl` parameters will also be used to connect to the
154
165
  # Telnet server.
155
166
  #
156
167
  # @yield [session]
@@ -168,6 +179,8 @@ module Ronin
168
179
  #
169
180
  # @see telnet_connect
170
181
  #
182
+ # @api public
183
+ #
171
184
  def telnet_session(options={},&block)
172
185
  return telnet_connect(options) do |sess|
173
186
  yield sess if block_given?
@@ -18,6 +18,8 @@
18
18
  #
19
19
 
20
20
  require 'ronin/network/udp'
21
+ require 'ronin/ui/output/helpers'
22
+ require 'ronin/mixin'
21
23
 
22
24
  require 'parameters'
23
25
 
@@ -27,45 +29,52 @@ module Ronin
27
29
  #
28
30
  # Adds UDP convenience methods and connection parameters to a class.
29
31
  #
32
+ # Defines the following parameters:
33
+ #
34
+ # * `host` (`String`) - UDP host.
35
+ # * `port` (`Integer`) - UDP port.
36
+ # * `local_host` (`String`) - UDP local host.
37
+ # * `local_port` (`Integer`) - UDP local port.
38
+ # * `server_host` (`String`) - UDP server host.
39
+ # * `server_port` (`Integer`) - UDP server port.
40
+ #
30
41
  module UDP
31
- include Parameters
32
-
33
- # UDP host
34
- parameter :host,
35
- :type => String,
36
- :description => 'UDP host'
37
-
38
- # UDP port
39
- parameter :port,
40
- :type => Integer,
41
- :description => 'UDP port'
42
-
43
- # UDP local host
44
- parameter :local_host,
45
- :type => String,
46
- :description => 'UDP local host'
47
-
48
- # UDP local port
49
- parameter :local_port,
50
- :type => Integer,
51
- :description => 'UDP local port'
52
-
53
- # UDP server host
54
- parameter :server_host,
55
- :type => String,
56
- :description => 'UDP server host'
57
-
58
- # UDP server port
59
- parameter :server_port,
60
- :type => Integer,
61
- :description => 'UDP server port'
42
+ include Mixin
43
+
44
+ mixin UI::Output::Helpers, Parameters
45
+
46
+ mixin do
47
+ # UDP host
48
+ parameter :host, :type => String,
49
+ :description => 'UDP host'
50
+
51
+ # UDP port
52
+ parameter :port, :type => Integer,
53
+ :description => 'UDP port'
54
+
55
+ # UDP local host
56
+ parameter :local_host, :type => String,
57
+ :description => 'UDP local host'
58
+
59
+ # UDP local port
60
+ parameter :local_port, :type => Integer,
61
+ :description => 'UDP local port'
62
+
63
+ # UDP server host
64
+ parameter :server_host, :type => String,
65
+ :description => 'UDP server host'
66
+
67
+ # UDP server port
68
+ parameter :server_port, :type => Integer,
69
+ :description => 'UDP server port'
70
+ end
62
71
 
63
72
  protected
64
73
 
65
74
  #
66
75
  # Opens a UDP connection to the host and port specified by the
67
- # {#host} and {#port} parameters. If the {#local_host} and
68
- # {#local_port} parameters are set, they will be used for
76
+ # `host` and `port` parameters. If the `local_host` and
77
+ # `local_port` parameters are set, they will be used for
69
78
  # the local host and port of the UDP connection.
70
79
  #
71
80
  # @yield [socket]
@@ -86,6 +95,8 @@ module Ronin
86
95
  # puts sock.readlines
87
96
  # end
88
97
  #
98
+ # @api public
99
+ #
89
100
  def udp_connect(&block)
90
101
  print_info "Connecting to #{self.host}:#{self.port} ..."
91
102
 
@@ -93,9 +104,9 @@ module Ronin
93
104
  end
94
105
 
95
106
  #
96
- # Connects to the host and port specified by the {#host} and {#port}
97
- # parameters, then sends the given data. If the {#local_host} and
98
- # {#local_port} instance methods are set, they will be used for the
107
+ # Connects to the host and port specified by the `host` and `port`
108
+ # parameters, then sends the given data. If the `local_host` and
109
+ # `local_port` instance methods are set, they will be used for the
99
110
  # local host and port of the UDP connection.
100
111
  #
101
112
  # @param [String] data
@@ -110,6 +121,8 @@ module Ronin
110
121
  # @return [UDPSocket]
111
122
  # The newly created UDPSocket object.
112
123
  #
124
+ # @api public
125
+ #
113
126
  def udp_connect_and_send(data,&block)
114
127
  print_info "Connecting to #{self.host}:#{self.port} ..."
115
128
  print_debug "Sending data: #{data.inspect}"
@@ -119,7 +132,7 @@ module Ronin
119
132
 
120
133
  #
121
134
  # Creates a UDP session to the host and port specified by the
122
- # {#host} and {#port} parameters. If the {#local_host} and {#local_port}
135
+ # `host` and `port` parameters. If the `local_host` and `local_port`
123
136
  # parameters are set, they will be used for the local host and port
124
137
  # of the UDP connection.
125
138
  #
@@ -132,6 +145,8 @@ module Ronin
132
145
  #
133
146
  # @return [nil]
134
147
  #
148
+ # @api public
149
+ #
135
150
  def udp_session(&block)
136
151
  print_info "Connecting to #{self.host}:#{self.port} ..."
137
152
 
@@ -142,8 +157,8 @@ module Ronin
142
157
  end
143
158
 
144
159
  #
145
- # Creates a new UDPServer object listening on {#server_host} and
146
- # {#server_port} parameters.
160
+ # Creates a new UDPServer object listening on `server_host` and
161
+ # `server_port` parameters.
147
162
  #
148
163
  # @yield [server]
149
164
  # The given block will be passed the newly created server.
@@ -157,6 +172,8 @@ module Ronin
157
172
  # @example
158
173
  # udp_server
159
174
  #
175
+ # @api public
176
+ #
160
177
  def udp_server(&block)
161
178
  if self.server_host
162
179
  print_info "Listening on #{self.server_host}:#{self.server_port} ..."
@@ -169,7 +186,7 @@ module Ronin
169
186
 
170
187
  #
171
188
  # Creates a new temporary UDPServer object listening on the
172
- # {#server_host} and {#server_port} parameters.
189
+ # `server_host` and `server_port` parameters.
173
190
  #
174
191
  # @yield [server]
175
192
  # The given block will be passed the newly created server.
@@ -185,6 +202,8 @@ module Ronin
185
202
  # data, sender = server.recvfrom(1024)
186
203
  # end
187
204
  #
205
+ # @api public
206
+ #
188
207
  def udp_server_session(&block)
189
208
  if self.server_host
190
209
  print_info "Listening on #{self.server_host}:#{self.server_port} ..."
@@ -18,15 +18,14 @@
18
18
  #
19
19
 
20
20
  require 'ronin/model'
21
+ require 'ronin/ip_address'
22
+ require 'ronin/port'
23
+ require 'ronin/service'
24
+ require 'ronin/service_credential'
21
25
 
22
26
  require 'dm-timestamps'
23
27
 
24
28
  module Ronin
25
- autoload :ServiceCredential, 'ronin/service_credential'
26
- autoload :Port, 'ronin/port'
27
- autoload :Service, 'ronin/service'
28
- autoload :IPAddress, 'ronin/ip_address'
29
-
30
29
  #
31
30
  # Represents a open port at a specified IP address.
32
31
  #
@@ -64,6 +63,8 @@ module Ronin
64
63
  #
65
64
  # @since 1.0.0
66
65
  #
66
+ # @api public
67
+ #
67
68
  def address
68
69
  self.ip_address.address
69
70
  end
@@ -76,6 +77,8 @@ module Ronin
76
77
  #
77
78
  # @since 1.0.0
78
79
  #
80
+ # @api public
81
+ #
79
82
  def number
80
83
  self.port.number
81
84
  end
@@ -88,6 +91,8 @@ module Ronin
88
91
  #
89
92
  # @since 1.0.0
90
93
  #
94
+ # @api public
95
+ #
91
96
  def to_i
92
97
  self.port.to_i
93
98
  end
@@ -100,6 +105,8 @@ module Ronin
100
105
  #
101
106
  # @since 1.0.0
102
107
  #
108
+ # @api public
109
+ #
103
110
  def to_s
104
111
  if self.service
105
112
  "#{self.port} (#{self.service})"
@@ -20,12 +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/address'
23
24
 
24
25
  require 'dm-timestamps'
25
26
 
26
27
  module Ronin
27
- autoload :Address, 'ronin/address'
28
-
29
28
  #
30
29
  # Represents an Organization which owns {Address}es.
31
30
  #
data/lib/ronin/os.rb CHANGED
@@ -19,12 +19,11 @@
19
19
 
20
20
  require 'ronin/model'
21
21
  require 'ronin/model/has_name'
22
+ require 'ronin/os_guess'
23
+ require 'ronin/ip_address'
22
24
  require 'ronin/extensions/meta'
23
25
 
24
26
  module Ronin
25
- autoload :OSGuess, 'ronin/os_guess'
26
- autoload :IPAddress, 'ronin/ip_address'
27
-
28
27
  #
29
28
  # Represents an Operating System and pre-defines other common ones
30
29
  # ({linux}, {freebsd}, {openbsd}, {netbsd}, {osx}, {solaris}, {windows}
@@ -59,6 +58,8 @@ module Ronin
59
58
  #
60
59
  # @since 1.0.0
61
60
  #
61
+ # @api public
62
+ #
62
63
  def recent_ip_address
63
64
  relation = self.os_guesses.first(:order => [:created_at.desc])
64
65
 
@@ -77,6 +78,8 @@ module Ronin
77
78
  # os = OS.new(:name => 'Linux', :version => '2.6.11')
78
79
  # os.to_s # => "Linux 2.6.11"
79
80
  #
81
+ # @api public
82
+ #
80
83
  def to_s
81
84
  if self.version
82
85
  "#{self.name} #{self.version}"
@@ -102,6 +105,8 @@ module Ronin
102
105
  #
103
106
  # @since 1.0.0
104
107
  #
108
+ # @api public
109
+ #
105
110
  def to_ary
106
111
  [self.name, self.version]
107
112
  end
@@ -120,6 +125,8 @@ module Ronin
120
125
  # @example
121
126
  # OS.predefine :freebsd, 'FreeBSD'
122
127
  #
128
+ # @api private
129
+ #
123
130
  def OS.predefine(name,os_name)
124
131
  os_name = os_name.to_s
125
132
 
@@ -18,13 +18,12 @@
18
18
  #
19
19
 
20
20
  require 'ronin/model'
21
+ require 'ronin/os'
22
+ require 'ronin/ip_address'
21
23
 
22
24
  require 'dm-timestamps'
23
25
 
24
26
  module Ronin
25
- autoload :IPAddress, 'ronin/ip_address'
26
- autoload :OS, 'ronin/os'
27
-
28
27
  #
29
28
  # Represents a guess about what {OS} an {IPAddress} might be running.
30
29
  #
@@ -18,12 +18,11 @@
18
18
  #
19
19
 
20
20
  require 'ronin/model'
21
+ require 'ronin/credential'
21
22
 
22
23
  require 'digest'
23
24
 
24
25
  module Ronin
25
- autoload :Credential, 'ronin/credential'
26
-
27
26
  #
28
27
  # Represents a password that can be stored in the {Database}.
29
28
  #
@@ -35,7 +34,8 @@ module Ronin
35
34
  property :id, Serial
36
35
 
37
36
  # The clear-text of the password
38
- property :clear_text, String, :required => true,
37
+ property :clear_text, String, :length => 256,
38
+ :required => true,
39
39
  :unique => true
40
40
 
41
41
  # The credentials which use the password
@@ -79,6 +79,8 @@ module Ronin
79
79
  #
80
80
  # @since 1.0.0
81
81
  #
82
+ # @api public
83
+ #
82
84
  def digest(algorithm,options={})
83
85
  digest_class = begin
84
86
  Digest.const_get(algorithm.to_s.upcase)
@@ -109,6 +111,8 @@ module Ronin
109
111
  #
110
112
  # @since 1.0.0
111
113
  #
114
+ # @api public
115
+ #
112
116
  def count
113
117
  self.credentials.count
114
118
  end
@@ -121,6 +125,8 @@ module Ronin
121
125
  #
122
126
  # @since 1.0.0
123
127
  #
128
+ # @api public
129
+ #
124
130
  def to_s
125
131
  self.clear_text
126
132
  end
@@ -133,6 +139,8 @@ module Ronin
133
139
  #
134
140
  # @since 1.0.0
135
141
  #
142
+ # @api public
143
+ #
136
144
  def inspect
137
145
  "#<#{self.class}: #{self.clear_text}>"
138
146
  end