kaseyaws 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -9
- data/kaseyaws.gemspec +1 -1
- data/lib/kaseyaws/client.rb +110 -51
- data/lib/kaseyaws/security.rb +3 -5
- data/lib/kaseyaws/version.rb +1 -1
- data/lib/kaseyaws.rb +1 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05e73b2d95fd766ef74c52637f295b137eb320a9
|
4
|
+
data.tar.gz: 2988b717660f02eff59882cfca77bce8daf57804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e51be2546220b7de7261a21bf4c961c6d0bdf6ef9a133146711cd26cb1e7a0a2532db807cf2ea001a93f4b5d72593a0950ed9742f82ad35a270ae80a39e186d7
|
7
|
+
data.tar.gz: e8adae035ee96a14a9478abdf29261f385298beab44fd89ae8eeb7c69af66f58b5a8e799c2c3c34bda7627e7b74a593e90cce8b3cf7973f6ae6b59cb91cb548b
|
data/README.md
CHANGED
@@ -2,21 +2,23 @@
|
|
2
2
|
|
3
3
|
A simple Ruby Gem that provides a Ruby client for Kaseya's VSA web service.
|
4
4
|
|
5
|
-
This is currently a work in progress, as all Kaseya web service operations are not implemented
|
5
|
+
This is currently a work in progress, as all Kaseya web service operations are not yet implemented.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
7
|
+
[The offical documentation for the Kaseya VSA web service](http://tinyurl.com/kaseyavsaws)
|
10
8
|
|
11
|
-
|
9
|
+
## Installation
|
12
10
|
|
13
|
-
|
11
|
+
KaseyaWS is available at [Rubygems](http://rubygems.org/gems/kaseyaws) and can be installed as follows.
|
14
12
|
|
15
|
-
|
13
|
+
```
|
14
|
+
$ gem install kaseyaws
|
15
|
+
```
|
16
16
|
|
17
|
-
|
17
|
+
or add it to your Gemfile:
|
18
18
|
|
19
|
-
|
19
|
+
```
|
20
|
+
gem 'kaseyaws', '~> 0.0.3'
|
21
|
+
```
|
20
22
|
|
21
23
|
## Usage
|
22
24
|
|
data/kaseyaws.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = KaseyaWS::VERSION
|
9
9
|
s.authors = "Phillip Henslee"
|
10
10
|
s.email = "phenslee@towerdigital.us"
|
11
|
-
s.description = "A Ruby Gem for Kaseya's VSA web
|
11
|
+
s.description = "A Ruby Gem for Kaseya's VSA web service"
|
12
12
|
s.summary = "A simple client for the Kaseya VSA web service"
|
13
13
|
s.homepage = "https://github.com/towerdigital/kaseyaws"
|
14
14
|
s.license = "MIT"
|
data/lib/kaseyaws/client.rb
CHANGED
@@ -14,6 +14,8 @@ require "savon"
|
|
14
14
|
|
15
15
|
module KaseyaWS
|
16
16
|
|
17
|
+
# The client class is just a wrapper for the Kaseya VSA WSDL. All methods return a Hash object
|
18
|
+
|
17
19
|
class Client
|
18
20
|
HASH_ALGORITHM = "SHA-256"
|
19
21
|
attr_accessor :client
|
@@ -36,31 +38,31 @@ module KaseyaWS
|
|
36
38
|
def add_mach_group_to_scope(group_name,scope_name)
|
37
39
|
|
38
40
|
response = self.client.call(:add_mach_group_to_scope, message: {req:[{
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
group_name: group_name,
|
42
|
+
scope_name: scope_name,
|
43
|
+
browser_i_p: @client_ip,
|
44
|
+
session_i_d: @sessionid}]}
|
45
|
+
)
|
44
46
|
response.body[:add_mach_group_to_scope_response][:add_mach_group_to_scope_result]
|
45
47
|
end
|
46
48
|
|
47
49
|
def add_org_to_scope(company_id,scope_id)
|
48
50
|
|
49
51
|
response = self.client.call(:add_org_to_scope, message: {req:[{
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
company_i_d: company_id,
|
53
|
+
scope_i_d: scope_id,
|
54
|
+
session_i_d: @sessionid}]}
|
55
|
+
)
|
54
56
|
response.body[:add_org_to_scope_response][:add_org_to_scope_result]
|
55
57
|
end
|
56
58
|
|
57
59
|
def add_user_to_role(username,role_id)
|
58
60
|
|
59
61
|
response = self.client.call(:add_user_to_role, message: {req:[{
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
62
|
+
user_name: user_name,
|
63
|
+
role_i_d: role_id,
|
64
|
+
session_i_d: @sessionid}]}
|
65
|
+
)
|
64
66
|
response.body[:add_user_to_role_response][:add_user_to_role_result]
|
65
67
|
end
|
66
68
|
|
@@ -68,7 +70,6 @@ module KaseyaWS
|
|
68
70
|
|
69
71
|
random_number = KaseyaWS::Security.secure_random
|
70
72
|
covered_password = KaseyaWS::Security.compute_covered_password(username,password, random_number, HASH_ALGORITHM)
|
71
|
-
browser_ip = @client_ip
|
72
73
|
|
73
74
|
self.client = Savon::Client.new(@savon_options)
|
74
75
|
|
@@ -76,7 +77,7 @@ module KaseyaWS
|
|
76
77
|
user_name: username,
|
77
78
|
covered_password: covered_password,
|
78
79
|
random_number: random_number,
|
79
|
-
|
80
|
+
browser_i_p: @client_ip,
|
80
81
|
hashing_algorithm: HASH_ALGORITHM}]}
|
81
82
|
)
|
82
83
|
@sessionid = response.body[:authenticate_response][:authenticate_result][:session_id]
|
@@ -85,53 +86,111 @@ module KaseyaWS
|
|
85
86
|
def close_alarm (monitor_alarm_id, notes)
|
86
87
|
|
87
88
|
response = self.client.call(:close_alarm, message: {req:[{
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
89
|
+
monitor_alarm_i_d: monitor_alarm_id,
|
90
|
+
notes: notes,
|
91
|
+
browser_i_p: @client_ip,
|
92
|
+
session_i_d: @sessionid}]}
|
93
|
+
)
|
93
94
|
response.body[:close_alarm_response][:close_alarm_result]
|
94
95
|
end
|
95
96
|
|
96
97
|
def create_machine_group (group_name,org_name,parent_name)
|
97
98
|
|
98
99
|
response = self.client.call(:create_machine_group, message: {req:[{
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
group_name: group_name,
|
101
|
+
org_name: org_name,
|
102
|
+
parent_name: parent_name,
|
103
|
+
browser_i_p: @client_ip,
|
104
|
+
session_i_d: @sessionid}]}
|
105
|
+
)
|
105
106
|
response.body[:create_machine_group_response][:create_machine_group_result]
|
106
107
|
end
|
107
108
|
|
108
109
|
def create_role (role_name,role_type,parent_role_name)
|
109
110
|
|
110
111
|
response = self.client.call(:create_role, message: {req:[{
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
112
|
+
role_name: role_name,
|
113
|
+
role_type: role_type,
|
114
|
+
parent_role_name: parent_role_name,
|
115
|
+
browser_i_p: @client_ip,
|
116
|
+
session_i_d: @sessionid}]}
|
117
|
+
)
|
117
118
|
response.body[:create_role_response][:create_role_result]
|
118
119
|
end
|
119
120
|
|
120
121
|
def delete_admin (user_name)
|
121
122
|
|
122
123
|
response = self.client.call(:delete_admin, message: {req:[{
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
user_name: user_name,
|
125
|
+
browser_i_p: @client_ip,
|
126
|
+
session_i_d: @sessionid}]}
|
127
|
+
)
|
127
128
|
response.body[:delete_admin_response][:delete_admin_result]
|
128
129
|
end
|
129
130
|
|
131
|
+
|
132
|
+
def delete_agent (agent_guid, uninstall_agent_first)
|
133
|
+
|
134
|
+
response = self.client.call(:delete_agent, message: {req:[{
|
135
|
+
agent_guid: agent_guid,
|
136
|
+
uninstall_agent_first: uninstall_agent_first,
|
137
|
+
browser_i_p: @client_ip,
|
138
|
+
session_i_d: @sessionid}]}
|
139
|
+
)
|
140
|
+
response.body[:delete_agent_response][:delete_agent_result]
|
141
|
+
end
|
142
|
+
|
143
|
+
def delete_agent_install_package (package_id)
|
144
|
+
|
145
|
+
response = self.client.call(:delete_agent_install_package, message: {req:[{
|
146
|
+
package_id: package_id,
|
147
|
+
browser_i_p: @client_ip,
|
148
|
+
session_i_d: @sessionid}]}
|
149
|
+
)
|
150
|
+
response.body[:delete_agent_install_package_response][:delete_agent_install_package_result]
|
151
|
+
end
|
152
|
+
|
153
|
+
def delete_machine_group (group_name)
|
154
|
+
|
155
|
+
response = self.client.call(:delete_machine_group, message: {req:[{
|
156
|
+
group_name: group_name,
|
157
|
+
browser_i_p: @client_ip,
|
158
|
+
session_i_d: @sessionid}]}
|
159
|
+
)
|
160
|
+
response.body[:delete_machine_group_response][:delete_machine_group_result]
|
161
|
+
end
|
162
|
+
|
163
|
+
def echo (input)
|
164
|
+
|
165
|
+
response = self.client.call(:echo, message: { input: input })
|
166
|
+
|
167
|
+
response.body[:echo_response][:echo_result]
|
168
|
+
end
|
169
|
+
|
170
|
+
def echo_mt (payload)
|
171
|
+
|
172
|
+
response = self.client.call(:echo_mt, message: {req:[{
|
173
|
+
payload: payload,
|
174
|
+
session_i_d: @sessionid}]}
|
175
|
+
)
|
176
|
+
response.body[:echo_mt_response][:echo_mt_result]
|
177
|
+
end
|
178
|
+
|
130
179
|
def get_alarm (monitor_alarm_id)
|
131
180
|
|
132
181
|
response = self.client.call(:get_alarm, message: {req:[{
|
133
182
|
monitor_alarm_i_d: monitor_alarm_id,
|
134
|
-
|
183
|
+
browser_i_p: @client_ip,
|
184
|
+
session_i_d: @sessionid}]}
|
185
|
+
)
|
186
|
+
response.body[:get_alarm_response][:get_alarm_result]
|
187
|
+
end
|
188
|
+
|
189
|
+
def get_alarm (monitor_alarm_id)
|
190
|
+
|
191
|
+
response = self.client.call(:get_alarm, message: {req:[{
|
192
|
+
monitor_alarm_i_d: monitor_alarm_id,
|
193
|
+
browser_i_p: @client_ip,
|
135
194
|
session_i_d: @sessionid}]}
|
136
195
|
)
|
137
196
|
response.body[:get_alarm_response][:get_alarm_result]
|
@@ -141,7 +200,7 @@ module KaseyaWS
|
|
141
200
|
|
142
201
|
response = self.client.call(:get_alarm_list, message: {req:[{
|
143
202
|
return_all_records: get_all_records,
|
144
|
-
|
203
|
+
browser_i_p: @client_ip,
|
145
204
|
session_i_d: @sessionid}]}
|
146
205
|
)
|
147
206
|
response.body[:get_alarm_list_response][:get_alarm_list_result]
|
@@ -150,32 +209,32 @@ module KaseyaWS
|
|
150
209
|
def get_machine(machine_group_id)
|
151
210
|
|
152
211
|
response = self.client.call(:get_machine, message: {req:[{
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
212
|
+
machine___group_i_d: machine_group_id,
|
213
|
+
browser_i_p: @client_ip,
|
214
|
+
session_i_d: @sessionid}]}
|
215
|
+
)
|
157
216
|
response.body[:get_machine_response][:get_machine_result]
|
158
217
|
end
|
159
218
|
|
160
219
|
def get_machine_group_list
|
161
220
|
|
162
221
|
response = self.client.call(:get_machine_group_list, message: {req:[{
|
163
|
-
|
164
|
-
|
165
|
-
|
222
|
+
browser_i_p: @client_ip,
|
223
|
+
session_i_d: @sessionid}]}
|
224
|
+
)
|
166
225
|
response.body[:get_machine_group_list_response][:get_machine_group_list_result]
|
167
226
|
end
|
168
227
|
|
169
228
|
def get_machine_list(machine_group,machine_collection)
|
170
229
|
|
171
230
|
response = self.client.call(:get_machine_list, message: {req:[{
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
231
|
+
machine_group: machine_group,
|
232
|
+
machine_collection: machine_collection,
|
233
|
+
browser_i_p: @client_ip,
|
234
|
+
session_i_d: @sessionid}]}
|
235
|
+
)
|
177
236
|
response.body[:get_machine_list_response][:get_machine_list_result]
|
178
237
|
end
|
179
238
|
|
180
239
|
end
|
181
|
-
end
|
240
|
+
end
|
data/lib/kaseyaws/security.rb
CHANGED
@@ -18,16 +18,14 @@ require 'json'
|
|
18
18
|
module KaseyaWS
|
19
19
|
class Security
|
20
20
|
|
21
|
-
# Utility method to return the client's IP address
|
22
|
-
# Most but not all Kaseya VSA SOAP request require <BrowserIP>
|
21
|
+
# Utility method to return the client's IP address, most but not all Kaseya VSA SOAP request require it.
|
23
22
|
|
24
23
|
def self.client_ip
|
25
24
|
r = Net::HTTP.get( 'jsonip.com','/' )
|
26
25
|
r = JSON::parse(r)['ip']
|
27
26
|
end
|
28
27
|
|
29
|
-
#
|
30
|
-
# Used to compute the second hash for the double hash sequence
|
28
|
+
# Returns an eight digit secure random number, used to compute the second hash for the double hash sequence.
|
31
29
|
|
32
30
|
def self.secure_random
|
33
31
|
i = SecureRandom.random_bytes
|
@@ -36,7 +34,7 @@ module KaseyaWS
|
|
36
34
|
i = i[1..8]
|
37
35
|
end
|
38
36
|
|
39
|
-
# Computes the double hashed covered password to authenticate with the VSA
|
37
|
+
# Computes the double hashed covered password to authenticate with the VSA server.
|
40
38
|
|
41
39
|
def self.compute_covered_password(username, password, rnd_number, hashing_algorithm)
|
42
40
|
if hashing_algorithm == "SHA-1"
|
data/lib/kaseyaws/version.rb
CHANGED
data/lib/kaseyaws.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaseyaws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phillip Henslee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: A Ruby Gem for Kaseya's VSA web
|
69
|
+
description: A Ruby Gem for Kaseya's VSA web service
|
70
70
|
email: phenslee@towerdigital.us
|
71
71
|
executables: []
|
72
72
|
extensions: []
|