boris 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/README.md +92 -57
- data/lib/boris.rb +1 -0
- data/lib/boris/connectors.rb +2 -0
- data/lib/boris/connectors/snmp.rb +1 -1
- data/lib/boris/connectors/ssh.rb +24 -6
- data/lib/boris/connectors/wmi.rb +74 -27
- data/lib/boris/errors.rb +9 -5
- data/lib/boris/helpers.rb +7 -0
- data/lib/boris/helpers/array.rb +4 -4
- data/lib/boris/helpers/constants.rb +11 -2
- data/lib/boris/helpers/hash.rb +3 -3
- data/lib/boris/helpers/scrubber.rb +21 -14
- data/lib/boris/helpers/string.rb +31 -30
- data/lib/boris/helpers/time.rb +5 -0
- data/lib/boris/lumberjack.rb +2 -2
- data/lib/boris/options.rb +1 -1
- data/lib/boris/profiler.rb +4 -5
- data/lib/boris/profilers/linux_core.rb +3 -3
- data/lib/boris/profilers/unix/solaris.rb +12 -8
- data/lib/boris/profilers/windows_core.rb +42 -17
- data/lib/boris/target.rb +14 -14
- data/lib/boris/version.rb +1 -1
- metadata +21 -32
data/lib/boris/target.rb
CHANGED
@@ -3,7 +3,6 @@ require 'boris/options'
|
|
3
3
|
require 'boris/connectors/snmp'
|
4
4
|
require 'boris/connectors/ssh'
|
5
5
|
require 'boris/connectors/wmi'
|
6
|
-
require 'boris/helpers/network'
|
7
6
|
|
8
7
|
module Boris
|
9
8
|
# {Boris::Target} is the basic class from which you can control the underlying framework
|
@@ -63,7 +62,7 @@ module Boris
|
|
63
62
|
# @param [Hash] category name
|
64
63
|
# @return [Array, Hash] scanned data elements for provided category
|
65
64
|
def [](category)
|
66
|
-
|
65
|
+
@profiler.instance_variable_get("@#{category}".to_sym)
|
67
66
|
end
|
68
67
|
|
69
68
|
# Connects to the target using the credentials supplied via the connection type as specified
|
@@ -105,7 +104,9 @@ module Boris
|
|
105
104
|
# we won't add snmp to the @unavailable_connection_types array, as it
|
106
105
|
# could respond later with another community string
|
107
106
|
when :ssh
|
108
|
-
if
|
107
|
+
if @unavailable_connection_types.include?(:ssh)
|
108
|
+
debug 'connection attempt bypassed (ssh connection unavailable)'
|
109
|
+
else
|
109
110
|
@connector = SSHConnector.new(@host, cred, @options)
|
110
111
|
@connector.establish_connection
|
111
112
|
|
@@ -114,7 +115,9 @@ module Boris
|
|
114
115
|
end
|
115
116
|
end
|
116
117
|
when :wmi
|
117
|
-
if
|
118
|
+
if @unavailable_connection_types.include?(:wmi)
|
119
|
+
debug 'connection attempt bypassed (wmi connection unavailable)'
|
120
|
+
else
|
118
121
|
@connector = WMIConnector.new(@host, cred)
|
119
122
|
@connector.establish_connection
|
120
123
|
|
@@ -130,7 +133,7 @@ module Boris
|
|
130
133
|
|
131
134
|
info 'all connection attempts failed' if !@connector.connected?
|
132
135
|
|
133
|
-
return @connector ? true : false
|
136
|
+
return @connector.connected? ? true : false
|
134
137
|
end
|
135
138
|
|
136
139
|
# Checks on the status of the connection.
|
@@ -158,7 +161,7 @@ module Boris
|
|
158
161
|
raise NoActiveConnection, 'no active connection' if @connector.connected? == false
|
159
162
|
|
160
163
|
@options[:profilers].each do |profiler|
|
161
|
-
break if @profiler
|
164
|
+
break if @profiler || @connector.failure_message
|
162
165
|
|
163
166
|
if profiler.connection_type == @connector.class
|
164
167
|
debug "testing profiler: #{profiler}"
|
@@ -175,6 +178,8 @@ module Boris
|
|
175
178
|
end
|
176
179
|
end
|
177
180
|
|
181
|
+
raise PasswordExpired, @connector.failure_message if @connector.failure_message
|
182
|
+
|
178
183
|
raise NoProfilerDetected, 'no suitable profiler found' if !@profiler
|
179
184
|
|
180
185
|
@profiler
|
@@ -207,7 +212,7 @@ module Boris
|
|
207
212
|
# @param [Hash] category name
|
208
213
|
# @return [Array, Hash] scanned data elements for provided category
|
209
214
|
def get(category)
|
210
|
-
|
215
|
+
@profiler.send("get_#{category.to_s}")
|
211
216
|
self[category]
|
212
217
|
end
|
213
218
|
|
@@ -243,7 +248,7 @@ module Boris
|
|
243
248
|
|
244
249
|
Structure::CATEGORIES.each do |category|
|
245
250
|
debug "calling #get_#{category.to_s}"
|
246
|
-
|
251
|
+
@profiler.send("get_#{category.to_s}")
|
247
252
|
end
|
248
253
|
|
249
254
|
debug 'all items retrieved successfully'
|
@@ -254,12 +259,7 @@ module Boris
|
|
254
259
|
# Parses the target's scanned data into JSON format for portability.
|
255
260
|
#
|
256
261
|
# target.get(:network_id)
|
257
|
-
# json_string = target.to_json #=> "{
|
258
|
-
#
|
259
|
-
# # The JSON string can later be parsed back into an object
|
260
|
-
# target_object = JSON.parse(json_string, :symbolize_names=>true)
|
261
|
-
# # and easily accessed...
|
262
|
-
# target_object[:network_id] #=> {:domain=>"mydomain.com", :hostname=>"SERVER01"}
|
262
|
+
# json_string = target.to_json #=> "...{\"domain\":\"mydomain.com\",\"hostname\":\"SERVER01\"}"...
|
263
263
|
#
|
264
264
|
# @param [Hash] print_type a symbol value for json output options. Only option supported now
|
265
265
|
# is :pretty_print to determine whether the data should be returned in json format with
|
data/lib/boris/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,86 @@
|
|
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.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Joe Martin
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: netaddr
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.5.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.5.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: net-ssh
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 2.5.2
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 2.5.2
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: snmp
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 1.1.0
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 1.1.0
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: mocha
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 0.12.3
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 0.12.3
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: shoulda
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: 3.1.1
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: 3.1.1
|
94
|
-
description:
|
83
|
+
description: 'Boris: A networked-device scanning library. Boris allows you to write
|
95
84
|
programs for logging into and pulling information off of various server platforms,
|
96
85
|
appliances, and other types of networked devices, producing clean and consistent
|
97
86
|
data ideal for configuration managment usage.'
|
@@ -111,6 +100,8 @@ files:
|
|
111
100
|
- lib/boris/helpers/network.rb
|
112
101
|
- lib/boris/helpers/scrubber.rb
|
113
102
|
- lib/boris/helpers/string.rb
|
103
|
+
- lib/boris/helpers/time.rb
|
104
|
+
- lib/boris/helpers.rb
|
114
105
|
- lib/boris/lumberjack.rb
|
115
106
|
- lib/boris/options.rb
|
116
107
|
- lib/boris/profiler.rb
|
@@ -132,27 +123,25 @@ files:
|
|
132
123
|
- README.md
|
133
124
|
homepage: https://github.com/alkalinecoffee/boris
|
134
125
|
licenses: []
|
126
|
+
metadata: {}
|
135
127
|
post_install_message:
|
136
128
|
rdoc_options: []
|
137
129
|
require_paths:
|
138
130
|
- lib
|
139
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
132
|
requirements:
|
142
|
-
- -
|
133
|
+
- - '>='
|
143
134
|
- !ruby/object:Gem::Version
|
144
135
|
version: 1.9.3
|
145
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
137
|
requirements:
|
148
|
-
- -
|
138
|
+
- - '>='
|
149
139
|
- !ruby/object:Gem::Version
|
150
140
|
version: '0'
|
151
141
|
requirements: []
|
152
142
|
rubyforge_project:
|
153
|
-
rubygems_version:
|
143
|
+
rubygems_version: 2.0.0
|
154
144
|
signing_key:
|
155
|
-
specification_version:
|
156
|
-
summary:
|
145
|
+
specification_version: 4
|
146
|
+
summary: 'Boris: A networked-device scanning library.'
|
157
147
|
test_files: []
|
158
|
-
has_rdoc:
|