boris 1.0.0.beta.1 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -0
- data/README.md +114 -32
- data/Rakefile +19 -0
- data/lib/boris.rb +0 -13
- data/lib/boris/connectors.rb +25 -7
- data/lib/boris/connectors/snmp.rb +24 -4
- data/lib/boris/connectors/ssh.rb +32 -6
- data/lib/boris/connectors/wmi.rb +109 -54
- data/lib/boris/errors.rb +1 -1
- data/lib/boris/helpers/array.rb +62 -62
- data/lib/boris/helpers/constants.rb +22 -19
- data/lib/boris/helpers/hash.rb +7 -7
- data/lib/boris/helpers/network.rb +68 -0
- data/lib/boris/helpers/scrubber.rb +53 -51
- data/lib/boris/helpers/string.rb +148 -26
- data/lib/boris/lumberjack.rb +74 -47
- data/lib/boris/options.rb +28 -16
- data/lib/boris/profiler.rb +19 -0
- data/lib/boris/profilers/linux/redhat.rb +74 -0
- data/lib/boris/{profiles → profilers}/linux_core.rb +13 -4
- data/lib/boris/{profiles → profilers}/unix/solaris.rb +25 -15
- data/lib/boris/{profiles → profilers}/unix_core.rb +90 -85
- data/lib/boris/profilers/windows/windows2003.rb +11 -0
- data/lib/boris/profilers/windows/windows2008.rb +26 -0
- data/lib/boris/profilers/windows/windows2012.rb +11 -0
- data/lib/boris/{profiles → profilers}/windows_core.rb +36 -14
- data/lib/boris/structure.rb +173 -167
- data/lib/boris/target.rb +110 -168
- data/lib/boris/version.rb +3 -0
- metadata +32 -115
- data/boris.gemspec +0 -28
- data/doc/Array.html +0 -437
- data/doc/Boris.html +0 -230
- data/doc/Boris/ConnectionAlreadyActive.html +0 -123
- data/doc/Boris/ConnectionFailed.html +0 -127
- data/doc/Boris/Connector.html +0 -794
- data/doc/Boris/InvalidCredentials.html +0 -131
- data/doc/Boris/InvalidOption.html +0 -123
- data/doc/Boris/InvalidTargetName.html +0 -123
- data/doc/Boris/Lumberjack.html +0 -466
- data/doc/Boris/MissingCredentials.html +0 -123
- data/doc/Boris/NoActiveConnection.html +0 -123
- data/doc/Boris/NoProfileDetected.html +0 -123
- data/doc/Boris/Options.html +0 -783
- data/doc/Boris/Profiles.html +0 -117
- data/doc/Boris/Profiles/Linux.html +0 -1151
- data/doc/Boris/Profiles/RedHat.html +0 -875
- data/doc/Boris/Profiles/Solaris.html +0 -1230
- data/doc/Boris/Profiles/Structure.html +0 -2050
- data/doc/Boris/Profiles/UNIX.html +0 -893
- data/doc/Boris/Profiles/Windows.html +0 -1846
- data/doc/Boris/Profiles/Windows/Windows2003.html +0 -304
- data/doc/Boris/Profiles/Windows/Windows2008.html +0 -379
- data/doc/Boris/Profiles/Windows/Windows2012.html +0 -304
- data/doc/Boris/SNMPConnector.html +0 -512
- data/doc/Boris/SSHConnector.html +0 -633
- data/doc/Boris/Target.html +0 -2002
- data/doc/Boris/WMIConnector.html +0 -1134
- data/doc/BorisLogger.html +0 -217
- data/doc/Hash.html +0 -195
- data/doc/String.html +0 -1246
- data/doc/_index.html +0 -420
- data/doc/class_list.html +0 -53
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -328
- data/doc/file.README.html +0 -183
- data/doc/file_list.html +0 -55
- data/doc/frames.html +0 -28
- data/doc/index.html +0 -183
- data/doc/js/app.js +0 -214
- data/doc/js/full_list.js +0 -173
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1468
- data/doc/top-level-namespace.html +0 -126
- data/lib/boris/profiles/linux/redhat.rb +0 -77
- data/lib/boris/profiles/windows/windows2003.rb +0 -15
- data/lib/boris/profiles/windows/windows2008.rb +0 -23
- data/lib/boris/profiles/windows/windows2012.rb +0 -15
- data/test/connector_tests/test_snmp.rb +0 -35
- data/test/connector_tests/test_ssh.rb +0 -51
- data/test/connector_tests/test_wmi.rb +0 -129
- data/test/helper_tests/test_array.rb +0 -25
- data/test/helper_tests/test_hash.rb +0 -10
- data/test/helper_tests/test_string.rb +0 -136
- data/test/profile_tests/test_core_skeleton +0 -107
- data/test/profile_tests/test_linux_core.rb +0 -331
- data/test/profile_tests/test_redhat.rb +0 -134
- data/test/profile_tests/test_solaris.rb +0 -523
- data/test/profile_tests/test_unix_core.rb +0 -117
- data/test/profile_tests/test_windows.rb +0 -536
- data/test/setup_tests.rb +0 -14
- data/test/test_all.rb +0 -8
- data/test/test_options.rb +0 -44
- data/test/test_structure.rb +0 -136
- data/test/test_target.rb +0 -146
data/lib/boris/target.rb
CHANGED
@@ -1,32 +1,24 @@
|
|
1
|
+
require 'boris/errors'
|
2
|
+
require 'boris/options'
|
1
3
|
require 'boris/connectors/snmp'
|
2
4
|
require 'boris/connectors/ssh'
|
3
5
|
require 'boris/connectors/wmi'
|
4
|
-
|
5
|
-
require 'boris/profiles/linux/redhat'
|
6
|
-
require 'boris/profiles/unix/solaris'
|
7
|
-
|
8
|
-
require 'boris/profiles/windows/windows2003'
|
9
|
-
require 'boris/profiles/windows/windows2008'
|
10
|
-
require 'boris/profiles/windows/windows2012'
|
6
|
+
require 'boris/helpers/network'
|
11
7
|
|
12
8
|
module Boris
|
13
|
-
PORT_DEFAULTS = {:ssh=>22, :wmi=>135}
|
14
|
-
VALID_CONNECTION_TYPES = [:snmp, :ssh, :wmi]
|
15
|
-
|
16
9
|
# {Boris::Target} is the basic class from which you can control the underlying framework
|
17
10
|
# for communicating with the device you wish to scan. A Target will allow you to provide
|
18
|
-
# options via {Boris::Options}, detect which
|
11
|
+
# options via {Boris::Options}, detect which profiler to use, connect to, and eventually
|
19
12
|
# scan your target device, returning a large amount of data.
|
20
13
|
class Target
|
21
14
|
include Lumberjack
|
22
|
-
|
15
|
+
|
23
16
|
attr_reader :host
|
24
|
-
attr_reader :target_profile
|
25
17
|
attr_reader :unavailable_connection_types
|
26
18
|
|
27
19
|
attr_accessor :connector
|
20
|
+
attr_accessor :profiler
|
28
21
|
attr_accessor :options
|
29
|
-
attr_accessor :logger
|
30
22
|
|
31
23
|
# Create the target by passing in a mandatory hostname or IP address, and optional
|
32
24
|
# {Boris::Options options hash}.
|
@@ -36,50 +28,55 @@ module Boris
|
|
36
28
|
#
|
37
29
|
# require 'boris'
|
38
30
|
#
|
39
|
-
# target = Boris::Target.new('192.168.1.1', :
|
31
|
+
# target = Boris::Target.new('192.168.1.1', :auto_scrub_data=>false)
|
40
32
|
#
|
41
33
|
# @param [String] host hostname or IP address
|
42
34
|
# @param [Hash] options an optional list of options. See {Boris::Options} for a list of all
|
43
35
|
# possible options.
|
44
36
|
def initialize(host, options={})
|
37
|
+
@logger = Boris.logger
|
38
|
+
|
45
39
|
@host = host
|
46
40
|
|
47
41
|
options ||= {}
|
48
42
|
@options = Options.new(options)
|
49
|
-
|
50
|
-
@logger = BorisLogger.new(STDERR)
|
51
|
-
|
52
|
-
if @options[:log_level]
|
53
|
-
@logger.level = case @options[:log_level]
|
54
|
-
when :debug then Logger::DEBUG
|
55
|
-
when :info then Logger::INFO
|
56
|
-
when :warn then Logger::WARN
|
57
|
-
when :error then Logger::ERROR
|
58
|
-
when :fatal then Logger::FATAL
|
59
|
-
else raise ArgumentError, "invalid logger level specified (#{@options[:log_level].inspect})"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
43
|
+
@connector = Connector.new(@host)
|
63
44
|
@unavailable_connection_types = []
|
64
45
|
|
65
46
|
if block_given?
|
66
47
|
yield self
|
67
|
-
disconnect if @connector
|
68
|
-
else
|
69
|
-
self
|
48
|
+
disconnect if @connector.connected?
|
70
49
|
end
|
71
50
|
end
|
72
51
|
|
52
|
+
# Convience method for returning data already collected (internally looks at the Profiler
|
53
|
+
# object of Target).
|
54
|
+
#
|
55
|
+
# target.get(:hardware)
|
56
|
+
#
|
57
|
+
# target[:hardware] #=> {:cpu_architecture=>64, :cpu_core_count=>2...}
|
58
|
+
#
|
59
|
+
# # same thing as:
|
60
|
+
#
|
61
|
+
# target.profiler.hardware #=> {:cpu_architecture=>64, :cpu_core_count=>2...}
|
62
|
+
#
|
63
|
+
# @param [Hash] category name
|
64
|
+
# @return [Array, Hash] scanned data elements for provided category
|
65
|
+
def [](category)
|
66
|
+
eval "@profiler.#{category.to_s}"
|
67
|
+
end
|
68
|
+
|
73
69
|
# Connects to the target using the credentials supplied via the connection type as specified
|
74
70
|
# by the credential. This method will smartly bypass any further connection attempts if it
|
75
71
|
# is determined that the connection will likely never work (for example, if you try to
|
76
72
|
# connect via WMI to a Linux host (which will fail), any further attempts to connect to that
|
77
73
|
# host via WMI will be ignored).
|
74
|
+
#
|
78
75
|
# @raise [ConnectionAlreadyActive] when a connection is already active
|
79
76
|
# @raise [InvalidOption] if credentials are not specified in the target's options hash
|
80
77
|
# @return [Boolean] returns true if the connection attempt succeeded
|
81
78
|
def connect
|
82
|
-
if @connector
|
79
|
+
if @connector.connected?
|
83
80
|
raise ConnectionAlreadyActive, 'a connect attempt has been made when active connection already exists'
|
84
81
|
elsif @options[:credentials].empty?
|
85
82
|
raise InvalidOption, 'no credentials specified'
|
@@ -88,7 +85,7 @@ module Boris
|
|
88
85
|
debug 'preparing to connect'
|
89
86
|
|
90
87
|
@options[:credentials].each do |cred|
|
91
|
-
if @connector
|
88
|
+
if @connector.connected?
|
92
89
|
debug 'active connection established, will not try any more credentials'
|
93
90
|
break
|
94
91
|
end
|
@@ -96,20 +93,20 @@ module Boris
|
|
96
93
|
debug "using credential (#{cred[:user]})"
|
97
94
|
|
98
95
|
cred[:connection_types].each do |conn_type|
|
99
|
-
if @connector
|
96
|
+
if @connector.connected?
|
100
97
|
debug 'active connection established, will not try any more connection types'
|
101
98
|
break
|
102
99
|
end
|
103
100
|
|
104
101
|
case conn_type
|
105
102
|
when :snmp
|
106
|
-
@connector = SNMPConnector.new(@host, cred, @options
|
103
|
+
@connector = SNMPConnector.new(@host, cred, @options)
|
107
104
|
@connector.establish_connection
|
108
105
|
# we won't add snmp to the @unavailable_connection_types array, as it
|
109
106
|
# could respond later with another community string
|
110
107
|
when :ssh
|
111
108
|
if !@unavailable_connection_types.include?(:ssh)
|
112
|
-
@connector = SSHConnector.new(@host, cred, @options
|
109
|
+
@connector = SSHConnector.new(@host, cred, @options)
|
113
110
|
@connector.establish_connection
|
114
111
|
|
115
112
|
if @connector.reconnectable == false
|
@@ -118,7 +115,7 @@ module Boris
|
|
118
115
|
end
|
119
116
|
when :wmi
|
120
117
|
if !@unavailable_connection_types.include?(:wmi)
|
121
|
-
@connector = WMIConnector.new(@host, cred
|
118
|
+
@connector = WMIConnector.new(@host, cred)
|
122
119
|
@connector.establish_connection
|
123
120
|
|
124
121
|
if @connector.reconnectable == false
|
@@ -131,7 +128,7 @@ module Boris
|
|
131
128
|
end
|
132
129
|
end
|
133
130
|
|
134
|
-
|
131
|
+
info 'all connection attempts failed' if !@connector.connected?
|
135
132
|
|
136
133
|
return @connector ? true : false
|
137
134
|
end
|
@@ -140,73 +137,86 @@ module Boris
|
|
140
137
|
#
|
141
138
|
# @return [Boolean] returns true if the connection to the target is active
|
142
139
|
def connected?
|
143
|
-
|
140
|
+
@connector.connected?
|
144
141
|
end
|
145
142
|
|
146
|
-
# Cycles through all of the
|
147
|
-
# target.
|
148
|
-
# certain command will properly fit the target. Once a suitable
|
143
|
+
# Cycles through all of the profilers as specified in {Boris::Options} for this
|
144
|
+
# target. Each profiler includes a method for determining whether the output of a
|
145
|
+
# certain command will properly fit the target. Once a suitable profiler is
|
149
146
|
# determined, it is then loaded up, which provides {Boris} the instructions on
|
150
147
|
# how to proceed.
|
151
148
|
#
|
152
|
-
# @raise [InvalidOption] if no
|
149
|
+
# @raise [InvalidOption] if no profilers are loaded prior to calling #detect_profiler
|
153
150
|
# @raise [NoActiveConnection] if no active connection is available when calling
|
154
|
-
# #
|
155
|
-
# @raise [
|
156
|
-
# @return [Module] returns the
|
151
|
+
# #detect_profiler
|
152
|
+
# @raise [NoProfilerDetected] when no suitable profiler was found
|
153
|
+
# @return [Module] returns the Class of a suitable profiler, else it will throw
|
157
154
|
# an error
|
158
|
-
# @see #
|
159
|
-
def
|
160
|
-
raise InvalidOption, 'no
|
161
|
-
raise NoActiveConnection, 'no active connection' if
|
162
|
-
|
163
|
-
@target_profile = nil
|
155
|
+
# @see #force_profiler_to
|
156
|
+
def detect_profiler
|
157
|
+
raise InvalidOption, 'no profilers loaded' if @options[:profilers].empty? || @options[:profilers].nil?
|
158
|
+
raise NoActiveConnection, 'no active connection' if @connector.connected? == false
|
164
159
|
|
165
|
-
@options[:
|
166
|
-
break if @
|
160
|
+
@options[:profilers].each do |profiler|
|
161
|
+
break if @profiler
|
167
162
|
|
168
|
-
if
|
169
|
-
debug "testing
|
163
|
+
if profiler.connection_type == @connector.class
|
164
|
+
debug "testing profiler: #{profiler}"
|
170
165
|
|
171
|
-
if
|
172
|
-
@
|
166
|
+
if profiler.matches_target?(@connector)
|
167
|
+
@profiler = profiler
|
173
168
|
|
174
|
-
debug "suitable
|
169
|
+
debug "suitable profiler found (#{profiler})"
|
175
170
|
|
176
|
-
|
171
|
+
@profiler = @profiler.new(@connector)
|
177
172
|
|
178
|
-
debug "
|
173
|
+
debug "profiler set to #{profiler}"
|
179
174
|
end
|
180
175
|
end
|
181
176
|
end
|
182
177
|
|
183
|
-
raise
|
178
|
+
raise NoProfilerDetected, 'no suitable profiler found' if !@profiler
|
184
179
|
|
185
|
-
@
|
180
|
+
@profiler
|
186
181
|
end
|
187
182
|
|
188
183
|
# Gracefully disconnects from the target (if a connection exists).
|
189
184
|
#
|
190
185
|
# @return [Boolean] returns true if the connection disconnected successfully
|
191
186
|
def disconnect
|
192
|
-
@connector.disconnect if @connector
|
187
|
+
@connector.disconnect if @connector.connected?
|
193
188
|
end
|
194
189
|
|
195
|
-
# Allows us to force the use of a
|
196
|
-
# @param
|
197
|
-
# @see #
|
198
|
-
def
|
199
|
-
|
200
|
-
|
201
|
-
|
190
|
+
# Allows us to force the use of a profiler. This can be used instead of #detect_profiler.
|
191
|
+
# @param profiler the module of the profiler we wish to set the target to use
|
192
|
+
# @see #detect_profiler
|
193
|
+
def force_profiler_to(profiler)
|
194
|
+
@profiler = profiler.new(@connector)
|
195
|
+
debug "profiler successfully forced to #{profiler}"
|
196
|
+
end
|
197
|
+
|
198
|
+
# Convience method for collecting data from a Target, where the user can pass in a symbol
|
199
|
+
# for the category that should be collected.
|
200
|
+
#
|
201
|
+
# target.get(:hardware) #=> {:cpu_architecture=>64, :cpu_core_count=>2...}
|
202
|
+
#
|
203
|
+
# # same thing as:
|
204
|
+
#
|
205
|
+
# target.profiler.get_hardware #=> {:cpu_architecture=>64, :cpu_core_count=>2...}
|
206
|
+
#
|
207
|
+
# @param [Hash] category name
|
208
|
+
# @return [Array, Hash] scanned data elements for provided category
|
209
|
+
def get(category)
|
210
|
+
eval "@profiler.get_#{category.to_s}"
|
211
|
+
self[category]
|
202
212
|
end
|
203
213
|
|
204
214
|
# Calls all data-collecting methods. Probably will be used in most cases after a
|
205
215
|
# connection has been established to the host.
|
206
216
|
# @note Running the full gamut of data collection methods may take some time, and
|
207
217
|
# connections over WMI usually take longer than their SSH counterparts. Typically,
|
208
|
-
# a Linux server scan can be completed in
|
209
|
-
# will be completed in 2-3 minutes (
|
218
|
+
# a Linux server scan can be completed in just a minute or two, whereas a Windows
|
219
|
+
# host will be completed in 2-3 minutes (there are many other factors, of course).
|
210
220
|
# Methods that will be called include:
|
211
221
|
# * get_file_systems (Array)
|
212
222
|
# * get_hardware (Hash)
|
@@ -220,117 +230,49 @@ module Boris
|
|
220
230
|
# * get_operating_system (Hash)
|
221
231
|
#
|
222
232
|
# target.retrieve_all
|
223
|
-
# target
|
224
|
-
# target
|
233
|
+
# target[:file_systems].size #=> 2
|
234
|
+
# target[:installed_applications].first #=> {:application_name=>'Adobe Reader'...}
|
225
235
|
#
|
226
|
-
# @see Boris::
|
227
|
-
# This method will also scrub the data after retrieving all of the items
|
236
|
+
# @see Boris::Profilers::Structure Profilers::Structure a complete list of the data scructure
|
237
|
+
# This method will also scrub the data after retrieving all of the items (unless the
|
238
|
+
# :auto_scrub option is set to false).
|
228
239
|
def retrieve_all
|
229
|
-
|
230
|
-
|
231
|
-
get_file_systems
|
232
|
-
get_hardware
|
233
|
-
get_hosted_shares
|
234
|
-
get_installed_applications
|
235
|
-
get_local_user_groups
|
236
|
-
get_installed_patches
|
237
|
-
get_installed_services
|
238
|
-
get_network_id
|
239
|
-
get_network_interfaces
|
240
|
-
get_operating_system
|
240
|
+
raise NoActiveConnection, 'no active connection' if @connector.connected? == false
|
241
241
|
|
242
|
-
debug 'all items
|
243
|
-
|
244
|
-
scrub_data! if @options[:auto_scrub_data]
|
245
|
-
end
|
246
|
-
|
247
|
-
# Attempts to suggest a connection method based on whether certain TCP ports
|
248
|
-
# on the target are responding (135 for WMI, 22 for SSH by default). Can be
|
249
|
-
# used to speed up the process of determining whether we should try to
|
250
|
-
# connect to our host using different methods, or bypass certain attempts
|
251
|
-
# entirely.
|
252
|
-
#
|
253
|
-
# target = Target.new('redhatserver01')
|
254
|
-
# target.suggested_connection_method #=> :ssh
|
255
|
-
#
|
256
|
-
# @return [Symbol] returns :wmi, :ssh, or nil
|
257
|
-
# @see tcp_port_responding?
|
258
|
-
def suggested_connection_method
|
259
|
-
connection_method = nil
|
260
|
-
|
261
|
-
debug 'detecting if wmi is available'
|
262
|
-
connection_method = :wmi if tcp_port_responding?(PORT_DEFAULTS[:wmi])
|
263
|
-
info 'wmi does not appear to be responding'
|
264
|
-
|
265
|
-
if connection_method.nil?
|
266
|
-
debug 'detecting if ssh is available'
|
267
|
-
connection_method = :ssh if tcp_port_responding?(PORT_DEFAULTS[:ssh])
|
268
|
-
info 'ssh does not appear to be responding'
|
269
|
-
end
|
270
|
-
|
271
|
-
info 'failed to detect connection method'if connection_method.nil?
|
272
|
-
connection_method
|
273
|
-
end
|
242
|
+
debug 'retrieving all configuration items'
|
274
243
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
# they succeed or not.
|
279
|
-
#
|
280
|
-
# target = Target.new('windowsserver01')
|
281
|
-
# target.tcp_port_responding?(22) #=> false
|
282
|
-
#
|
283
|
-
# @param port the TCP port number we wish to test
|
284
|
-
# @return [Boolean] returns true of the supplied port is responding
|
285
|
-
def tcp_port_responding?(port)
|
286
|
-
status = false
|
287
|
-
|
288
|
-
debug "checking if port #{port} is responding"
|
289
|
-
|
290
|
-
begin
|
291
|
-
conn = TCPSocket.new(@host, port)
|
292
|
-
info "port #{port} is responding"
|
293
|
-
conn.close
|
294
|
-
debug "connection to port closed"
|
295
|
-
status = true
|
296
|
-
rescue
|
297
|
-
info "port #{port} is not responding"
|
298
|
-
status = false
|
244
|
+
Structure::CATEGORIES.each do |category|
|
245
|
+
debug "calling #get_#{category.to_s}"
|
246
|
+
eval "@profiler.get_#{category.to_s}"
|
299
247
|
end
|
248
|
+
|
249
|
+
debug 'all items retrieved successfully'
|
300
250
|
|
301
|
-
|
251
|
+
@profiler.scrub_data! if @options[:auto_scrub_data]
|
302
252
|
end
|
303
253
|
|
304
254
|
# Parses the target's scanned data into JSON format for portability.
|
305
255
|
#
|
306
|
-
# target.
|
307
|
-
# json_string = target.to_json #=> "{
|
256
|
+
# target.get(:network_id)
|
257
|
+
# json_string = target.to_json #=> "{...\"domain\":\"mydomain.com\",\"hostname\":\"SERVER01\"}"...
|
308
258
|
#
|
309
259
|
# # The JSON string can later be parsed back into an object
|
310
260
|
# target_object = JSON.parse(json_string, :symbolize_names=>true)
|
311
|
-
#
|
312
|
-
#
|
313
|
-
|
261
|
+
# # and easily accessed...
|
262
|
+
# target_object[:network_id] #=> {:domain=>"mydomain.com", :hostname=>"SERVER01"}
|
263
|
+
#
|
264
|
+
# @param [Hash] print_type a symbol value for json output options. Only option supported now
|
265
|
+
# is :pretty_print to determine whether the data should be returned in json format with
|
266
|
+
# proper indentation.
|
267
|
+
# @return [JSON] a JSON object containing retrieved data from the target
|
268
|
+
def to_json(print_type=:standard)
|
314
269
|
json = {}
|
315
270
|
|
316
|
-
|
317
|
-
|
318
|
-
hardware
|
319
|
-
hosted_shares
|
320
|
-
installed_applications
|
321
|
-
installed_patches
|
322
|
-
installed_services
|
323
|
-
local_user_groups
|
324
|
-
network_id
|
325
|
-
network_interfaces
|
326
|
-
operating_system
|
327
|
-
}
|
328
|
-
|
329
|
-
data_vars.each do |var|
|
330
|
-
json[var.to_sym] = self.instance_variable_get("@#{var}".to_sym)
|
271
|
+
Structure::CATEGORIES.each do |category|
|
272
|
+
json[category.to_sym] = @profiler.instance_variable_get("@#{category}".to_sym)
|
331
273
|
end
|
332
274
|
|
333
|
-
generated_json =
|
275
|
+
generated_json = print_type == :pretty_print ? JSON.pretty_generate(json) : JSON.generate(json)
|
334
276
|
|
335
277
|
debug "json generated successfully"
|
336
278
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Joe Martin
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: netaddr
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.5.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.5.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: net-ssh
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 2.5.2
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 2.5.2
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: snmp
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 1.1.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.1.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: mocha
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 0.12.3
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 0.12.3
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: shoulda
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: 3.1.1
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
93
|
+
version: 3.1.1
|
94
94
|
description: ! 'Boris: A networked-device scanning library. Boris allows you to write
|
95
95
|
programs for logging into and pulling information off of various server platforms,
|
96
96
|
appliances, and other types of networked devices, producing clean and consistent
|
@@ -100,93 +100,6 @@ executables: []
|
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
-
- ./boris.gemspec
|
104
|
-
- ./doc/_index.html
|
105
|
-
- ./doc/Array.html
|
106
|
-
- ./doc/Boris/ConnectionAlreadyActive.html
|
107
|
-
- ./doc/Boris/ConnectionFailed.html
|
108
|
-
- ./doc/Boris/Connector.html
|
109
|
-
- ./doc/Boris/InvalidCredentials.html
|
110
|
-
- ./doc/Boris/InvalidOption.html
|
111
|
-
- ./doc/Boris/InvalidTargetName.html
|
112
|
-
- ./doc/Boris/Lumberjack.html
|
113
|
-
- ./doc/Boris/MissingCredentials.html
|
114
|
-
- ./doc/Boris/NoActiveConnection.html
|
115
|
-
- ./doc/Boris/NoProfileDetected.html
|
116
|
-
- ./doc/Boris/Options.html
|
117
|
-
- ./doc/Boris/Profiles/Linux.html
|
118
|
-
- ./doc/Boris/Profiles/RedHat.html
|
119
|
-
- ./doc/Boris/Profiles/Solaris.html
|
120
|
-
- ./doc/Boris/Profiles/Structure.html
|
121
|
-
- ./doc/Boris/Profiles/UNIX.html
|
122
|
-
- ./doc/Boris/Profiles/Windows/Windows2003.html
|
123
|
-
- ./doc/Boris/Profiles/Windows/Windows2008.html
|
124
|
-
- ./doc/Boris/Profiles/Windows/Windows2012.html
|
125
|
-
- ./doc/Boris/Profiles/Windows.html
|
126
|
-
- ./doc/Boris/Profiles.html
|
127
|
-
- ./doc/Boris/SNMPConnector.html
|
128
|
-
- ./doc/Boris/SSHConnector.html
|
129
|
-
- ./doc/Boris/Target.html
|
130
|
-
- ./doc/Boris/WMIConnector.html
|
131
|
-
- ./doc/Boris.html
|
132
|
-
- ./doc/BorisLogger.html
|
133
|
-
- ./doc/class_list.html
|
134
|
-
- ./doc/css/common.css
|
135
|
-
- ./doc/css/full_list.css
|
136
|
-
- ./doc/css/style.css
|
137
|
-
- ./doc/file.README.html
|
138
|
-
- ./doc/file_list.html
|
139
|
-
- ./doc/frames.html
|
140
|
-
- ./doc/Hash.html
|
141
|
-
- ./doc/index.html
|
142
|
-
- ./doc/js/app.js
|
143
|
-
- ./doc/js/full_list.js
|
144
|
-
- ./doc/js/jquery.js
|
145
|
-
- ./doc/method_list.html
|
146
|
-
- ./doc/String.html
|
147
|
-
- ./doc/top-level-namespace.html
|
148
|
-
- ./lib/boris/connectors/snmp.rb
|
149
|
-
- ./lib/boris/connectors/ssh.rb
|
150
|
-
- ./lib/boris/connectors/wmi.rb
|
151
|
-
- ./lib/boris/connectors.rb
|
152
|
-
- ./lib/boris/errors.rb
|
153
|
-
- ./lib/boris/helpers/array.rb
|
154
|
-
- ./lib/boris/helpers/constants.rb
|
155
|
-
- ./lib/boris/helpers/hash.rb
|
156
|
-
- ./lib/boris/helpers/scrubber.rb
|
157
|
-
- ./lib/boris/helpers/string.rb
|
158
|
-
- ./lib/boris/lumberjack.rb
|
159
|
-
- ./lib/boris/options.rb
|
160
|
-
- ./lib/boris/profiles/linux/redhat.rb
|
161
|
-
- ./lib/boris/profiles/linux_core.rb
|
162
|
-
- ./lib/boris/profiles/unix/solaris.rb
|
163
|
-
- ./lib/boris/profiles/unix_core.rb
|
164
|
-
- ./lib/boris/profiles/windows/windows2003.rb
|
165
|
-
- ./lib/boris/profiles/windows/windows2008.rb
|
166
|
-
- ./lib/boris/profiles/windows/windows2012.rb
|
167
|
-
- ./lib/boris/profiles/windows_core.rb
|
168
|
-
- ./lib/boris/structure.rb
|
169
|
-
- ./lib/boris/target.rb
|
170
|
-
- ./lib/boris.rb
|
171
|
-
- ./LICENSE.md
|
172
|
-
- ./README.md
|
173
|
-
- ./test/connector_tests/test_snmp.rb
|
174
|
-
- ./test/connector_tests/test_ssh.rb
|
175
|
-
- ./test/connector_tests/test_wmi.rb
|
176
|
-
- ./test/helper_tests/test_array.rb
|
177
|
-
- ./test/helper_tests/test_hash.rb
|
178
|
-
- ./test/helper_tests/test_string.rb
|
179
|
-
- ./test/profile_tests/test_core_skeleton
|
180
|
-
- ./test/profile_tests/test_linux_core.rb
|
181
|
-
- ./test/profile_tests/test_redhat.rb
|
182
|
-
- ./test/profile_tests/test_solaris.rb
|
183
|
-
- ./test/profile_tests/test_unix_core.rb
|
184
|
-
- ./test/profile_tests/test_windows.rb
|
185
|
-
- ./test/setup_tests.rb
|
186
|
-
- ./test/test_all.rb
|
187
|
-
- ./test/test_options.rb
|
188
|
-
- ./test/test_structure.rb
|
189
|
-
- ./test/test_target.rb
|
190
103
|
- lib/boris/connectors/snmp.rb
|
191
104
|
- lib/boris/connectors/ssh.rb
|
192
105
|
- lib/boris/connectors/wmi.rb
|
@@ -195,21 +108,28 @@ files:
|
|
195
108
|
- lib/boris/helpers/array.rb
|
196
109
|
- lib/boris/helpers/constants.rb
|
197
110
|
- lib/boris/helpers/hash.rb
|
111
|
+
- lib/boris/helpers/network.rb
|
198
112
|
- lib/boris/helpers/scrubber.rb
|
199
113
|
- lib/boris/helpers/string.rb
|
200
114
|
- lib/boris/lumberjack.rb
|
201
115
|
- lib/boris/options.rb
|
202
|
-
- lib/boris/
|
203
|
-
- lib/boris/
|
204
|
-
- lib/boris/
|
205
|
-
- lib/boris/
|
206
|
-
- lib/boris/
|
207
|
-
- lib/boris/
|
208
|
-
- lib/boris/
|
209
|
-
- lib/boris/
|
116
|
+
- lib/boris/profiler.rb
|
117
|
+
- lib/boris/profilers/linux/redhat.rb
|
118
|
+
- lib/boris/profilers/linux_core.rb
|
119
|
+
- lib/boris/profilers/unix/solaris.rb
|
120
|
+
- lib/boris/profilers/unix_core.rb
|
121
|
+
- lib/boris/profilers/windows/windows2003.rb
|
122
|
+
- lib/boris/profilers/windows/windows2008.rb
|
123
|
+
- lib/boris/profilers/windows/windows2012.rb
|
124
|
+
- lib/boris/profilers/windows_core.rb
|
210
125
|
- lib/boris/structure.rb
|
211
126
|
- lib/boris/target.rb
|
127
|
+
- lib/boris/version.rb
|
212
128
|
- lib/boris.rb
|
129
|
+
- CHANGELOG.md
|
130
|
+
- LICENSE.md
|
131
|
+
- Rakefile
|
132
|
+
- README.md
|
213
133
|
homepage: https://github.com/alkalinecoffee/boris
|
214
134
|
licenses: []
|
215
135
|
post_install_message:
|
@@ -225,15 +145,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
146
|
none: false
|
227
147
|
requirements:
|
228
|
-
- - ! '
|
148
|
+
- - ! '>='
|
229
149
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
231
|
-
requirements:
|
232
|
-
- netaddr
|
233
|
-
- net/ssh
|
234
|
-
- snmp
|
150
|
+
version: '0'
|
151
|
+
requirements: []
|
235
152
|
rubyforge_project:
|
236
|
-
rubygems_version: 1.8.
|
153
|
+
rubygems_version: 1.8.24
|
237
154
|
signing_key:
|
238
155
|
specification_version: 3
|
239
156
|
summary: ! 'Boris: A networked-device scanning library.'
|