marshmallow 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f385bffb8c4b740a68e8c77f767fe6ca25c434c
4
- data.tar.gz: 80f8080fdf605af0d42622438c7f3e0195327ef5
3
+ metadata.gz: 447943b36336a0873bdd0d15e51b47f488a96086
4
+ data.tar.gz: 8ff2a3653d9d37386721bbc25a4f0a69e5d46070
5
5
  SHA512:
6
- metadata.gz: f0f51d9b1268810f03deec79fd5d5a897b484191387446ce5bdb7188a9d1309ed87cc65895b9b5eba60ffbab969f58cece9fe3b605948822475572847fde707b
7
- data.tar.gz: 960bd1ea869c23c34b6064e426a3d49dd901bcbcec5ce0b962c9578e3afde103ab49ee52299a636ae723e0c17fb76a2fa57f37c058e1c7349d79e8c06c2ca13b
6
+ metadata.gz: 216e331f1ac32456b5e3d6925ca05248cd0abfe85265303abe97ccb124399df0689f14ca535ad935a31edf59247924f44e1054a23ad81cc0d950199eac89fa97
7
+ data.tar.gz: 19af7d5042c1285aef5a77aeec6cf9511e764a9ae0cfae0a33fd5d9b9669327c1c6b528d67c3e85dd8369b9413410063dec2aa19ceaece0496b4d77b4d56593f
@@ -1,3 +1,10 @@
1
+ ## 0.1.3 (2.8.2017)
2
+ - added options for: profiles_installed, profiles_all, domain_check, firewall_check, fastuserswitch_check, loginwindow_check, user_launchagents, userlaunchdaemons, and options
3
+ - fixed code for ardinfo's to use 'CFPropertyList'
4
+ - renamed sys_launchagents to system_launchagents
5
+ - renamed sys_launchdaemons to system_launchdaemons
6
+
7
+
1
8
  ## 0.1.2 (1.27.2017)
2
9
  Fixed gem build errors
3
10
 
@@ -7,4 +14,3 @@ Fixed and updates some issues in README and gemspec files
7
14
  ## 0.1.0 (1.26.2017)
8
15
  Original Build
9
16
 
10
- - first commit
data/README.md CHANGED
@@ -5,40 +5,47 @@ Tested on macOS 10.12.
5
5
 
6
6
  ## Usage
7
7
  To see a list of availible options for Marshmallow, require 'Marshmallow' in file then type:
8
- `puts Marshmallow.methods(false)`
8
+ `puts Marshmallow.options`
9
9
 
10
10
 
11
11
  output should be similar to this:
12
12
  ***
13
- - users
14
- - users_number
15
- - listoflocaladmins
16
- - apps_installed
17
- - apps_number
18
- - serial
19
- - os_version
20
- - build
21
- - model
22
- - model_id
23
- - processor_name
24
- - processor_speed
25
- - processor_number
26
- - cores
27
- - memory
28
- - boot_rom
29
- - smc
30
- - uuid
31
- - graphics
32
- - free_space
33
- - hd_size
34
- - boot_volume
35
- - computer_name
36
- - sys_launchagents
37
- - sys_launchdaemons
38
- - ard_info1
39
- - ard_info2
40
- - ard_info3
41
- - ard_info4
13
+ apps_installed
14
+ ard_info1
15
+ ard_info2
16
+ ard_info3
17
+ ard_info4
18
+ boot_rom
19
+ boot_volume
20
+ build
21
+ computer_name
22
+ cores
23
+ domain_check
24
+ fastuserswitch_check
25
+ firewall_check
26
+ free_space
27
+ graphics
28
+ hd_size
29
+ listoflocaladmins
30
+ loginwindow_check
31
+ memory
32
+ model
33
+ model_id
34
+ options
35
+ os_version
36
+ processor_name
37
+ processor_number
38
+ processor_speed
39
+ profiles_all
40
+ profiles_installed
41
+ serial
42
+ smc
43
+ system_launchagents
44
+ system_launchdaemons
45
+ user_launchagents
46
+ user_launchdaemons
47
+ users
48
+ uuid
42
49
 
43
50
  ## Examples:
44
51
 
@@ -1,5 +1,7 @@
1
1
  #require "marshmallow/version"
2
2
 
3
+ require "CFPropertyList"
4
+
3
5
  module Marshmallow
4
6
  def self.users
5
7
  users=[]
@@ -13,10 +15,6 @@ module Marshmallow
13
15
  return users
14
16
  end
15
17
 
16
- def self.users_number
17
- return Flock.users.length
18
- end
19
-
20
18
  def self.listoflocaladmins
21
19
  listoflocaladmins =`dscacheutil -q group -a name admin`.split(":")
22
20
  listoflocaladmins=listoflocaladmins[4].strip.split(" ")
@@ -33,10 +31,6 @@ module Marshmallow
33
31
  return apps
34
32
  end
35
33
 
36
- def self.apps_number
37
- return Flock.apps_installed.length
38
- end
39
-
40
34
  def self.serial
41
35
  serial = `system_profiler SPHardwareDataType | awk '/Serial/'`.split(":")
42
36
  serial = serial[1].strip!
@@ -143,7 +137,7 @@ module Marshmallow
143
137
  return name[1].strip
144
138
  end
145
139
 
146
- def self.sys_launchagents
140
+ def self.system_launchagents
147
141
  launchagents=[]
148
142
  for x in Dir.entries("/Library/LaunchAgents")
149
143
  if !x.start_with?(".")
@@ -153,7 +147,7 @@ module Marshmallow
153
147
  return launchagents
154
148
  end
155
149
 
156
- def self.sys_launchdaemons
150
+ def self.system_launchdaemons
157
151
  launchdaemons=[]
158
152
  for x in Dir.entries("/Library/LaunchDaemons")
159
153
  if !x.start_with?(".")
@@ -163,37 +157,148 @@ module Marshmallow
163
157
  return launchdaemons
164
158
  end
165
159
 
160
+ def self.user_launchagents
161
+ users.each do |username|
162
+ if File.exist?("/Users/#{username}/Library/LaunchAgents")
163
+ launchAgents=[]
164
+ for x in Dir.entries("/Users/#{username}/Library/LaunchAgents")
165
+ if !x.start_with?(".")
166
+ launchAgents.push(x)
167
+ end
168
+ end
169
+ puts"#{username} LaunchAgents: "
170
+ puts launchAgents
171
+ puts "\n"
172
+ else
173
+ puts "#{username} LaunchAgents does not exist "
174
+ puts "\n"
175
+ end
176
+ end
177
+ end
178
+
179
+ def self.user_launchdaemons
180
+ users.each do |username|
181
+ if File.exist?("/Users/#{username}/Library/LaunchDaemons")
182
+ launchdaemons=[]
183
+ for file in Dir.entries("/Users/#{username}/Library/LaunchDaemons")
184
+ if !file.start_with?(".")
185
+ launchdaemons.push(file)
186
+ end
187
+ end
188
+ puts "#{username} LaunchDaemons: "
189
+ puts launchdaemons
190
+ puts "\n"
191
+ else
192
+ puts "#{username} LaunchDaemons: does not exist"
193
+ puts "\n"
194
+ end
195
+ end
196
+ end
197
+
166
198
  def self.ard_info1
167
- if !`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text1`.chomp.empty?
168
- `defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text1`.chomp
169
- else
199
+ plist = CFPropertyList::List.new(:file => "/Library/Preferences/com.apple.RemoteDesktop.plist")
200
+ results = CFPropertyList.native_types(plist.value)
201
+ if results['Text1'].empty?
170
202
  return "null"
203
+ else
204
+ return results['Text1']
171
205
  end
172
206
  end
173
207
 
174
208
  def self.ard_info2
175
- if !`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text2`.chomp.empty?
176
- `defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text2`.chomp
177
- else
209
+ plist = CFPropertyList::List.new(:file => "/Library/Preferences/com.apple.RemoteDesktop.plist")
210
+ results = CFPropertyList.native_types(plist.value)
211
+ if results['Text2'].empty?
178
212
  return "null"
213
+ else
214
+ return results['Text2']
179
215
  end
180
216
  end
181
217
 
182
218
  def self.ard_info3
183
- if !`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text3`.chomp.empty?
184
- `defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text3`.chomp
185
- else
219
+ plist = CFPropertyList::List.new(:file => "/Library/Preferences/com.apple.RemoteDesktop.plist")
220
+ results = CFPropertyList.native_types(plist.value)
221
+ if results['Text3'].empty?
186
222
  return "null"
223
+ else
224
+ return results['Text3']
187
225
  end
188
226
  end
189
227
 
190
228
  def self.ard_info4
191
- if !`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text4`.chomp.empty?
192
- `defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text4`.chomp
193
- else
229
+ plist = CFPropertyList::List.new(:file => "/Library/Preferences/com.apple.RemoteDesktop.plist")
230
+ results = CFPropertyList.native_types(plist.value)
231
+ if results['Text4'].empty?
194
232
  return "null"
233
+ else
234
+ return results['Text4']
235
+ end
236
+ end
237
+
238
+ def self.profiles_installed
239
+ if `profiles -C`.chomp == "There are no configuration profiles installed in the system domain"
240
+ puts "No profiles installed"
241
+ else
242
+ profiles=`profiles -C`.lines
243
+
244
+ installed=[]
245
+ for x in profiles
246
+ installed.push(x.split.last)
247
+ end
248
+ installed.delete("installed")
249
+ puts installed
250
+ end
251
+ end
252
+
253
+ def self.profiles_all
254
+ profiles="profiles -C"
255
+ system(profiles)
256
+ end
257
+
258
+ def self.domain_check
259
+ if `dsconfigad -show`.empty?
260
+ puts "no Domain Settings"
261
+ else
262
+ domain_check=`dsconfigad -show | grep "Active Directory Domain"`.split("=")
263
+ domain_check = domain_check[1].strip!
264
+ return domain_check
265
+ end
266
+ end
267
+
268
+ def self.firewall_check
269
+ plist = CFPropertyList::List.new(:file => "/Library/Preferences/com.apple.alf.plist")
270
+ firewall = CFPropertyList.native_types(plist.value)
271
+ if firewall['globalstate'] == 1
272
+ return "on"
273
+ else
274
+ return "off"
275
+ end
276
+ end
277
+
278
+ def self.fastuserswitch_check
279
+ plist = CFPropertyList::List.new(:file => "/Library/Preferences/.GlobalPreferences.plist")
280
+ results = CFPropertyList.native_types(plist.value)
281
+ if results['MultipleSessionEnabled'] == true
282
+ return "enabled"
283
+ else
284
+ return "disabled"
285
+ end
286
+ end
287
+
288
+ def self.loginwindow_check
289
+ plist = CFPropertyList::List.new(:file => "/Library/Preferences/com.apple.loginwindow.plist")
290
+ results = CFPropertyList.native_types(plist.value)
291
+ if results['SHOWFULLNAME'] == true
292
+ return "Name and Password"
293
+ else
294
+ return "List of users"
195
295
  end
196
296
  end
297
+
298
+ def self.options
299
+ return Marshmallow.methods(false).sort
300
+ end
197
301
  end
198
302
 
199
303
 
304
+
@@ -1,3 +1,3 @@
1
1
  module Marshmallow
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
Binary file
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "bundler", "~> 1.13"
34
34
  spec.add_development_dependency "rake", "~> 10.0"
35
35
  spec.add_development_dependency "minitest", "~> 5.0"
36
+ spec.add_development_dependency "CFPropertyList", ">= 2.0.0"
36
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marshmallow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Scott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: CFPropertyList
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.0
55
69
  description:
56
70
  email:
57
71
  - scottnl@kenyon.edu
@@ -70,6 +84,7 @@ files:
70
84
  - bin/setup
71
85
  - lib/marshmallow.rb
72
86
  - lib/marshmallow/version.rb
87
+ - marshmallow-0.1.2.gem
73
88
  - marshmallow.gemspec
74
89
  homepage: https://github.com/nlscott/marshmallow
75
90
  licenses: