macos-artifacts 0.6.1 → 0.6.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
  SHA256:
3
- metadata.gz: 67cf55113fa48b9f79fb0e91c47a8c1a595575868fc3e1e071a27e06708b7859
4
- data.tar.gz: 2da13eebb0d0287828a7da35e7222375a5de747f38a2c40f7235137d80a68760
3
+ metadata.gz: ff8a46c9c151ddb085fd4c578d90e16aa922722d61728b7803934ef04617184f
4
+ data.tar.gz: 8ef9df8d3ca88f39c04988d856ae3d9d08cc870999d8b3058a055bec482c48bf
5
5
  SHA512:
6
- metadata.gz: fbec3bb3b6e463166e2572d353ed9f971af19e1814b1962551b067cf346cf6808fc49a1d806e811782a28bfa24e6c2e2501e1277e7be7dac9a69bea3ce696444
7
- data.tar.gz: 35089efa9fd7e06beeb05f077729ab46cfdeab82df2bd64f32e76f1c394202d530e7892ee19cf6a0a3ec4a40b04d308a6679a5a4ee3327e91f4d892e7e666c50
6
+ metadata.gz: '09b71859a27f25c9db18c8ace5fcc00bfbae9023a4be65b632e8b3d3a341c4136a26c5c2eb6b445bf10e7727da52031f836af66c315bd29acce70dc697db9718'
7
+ data.tar.gz: 56786359ec1eca917904786f9171b481f2d5982252542b699dab1068841a9a9f00ff6a8db8db0f334a805cdc5d1613722e0b13c3f8816e1261616e66faee6e96
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # Change Log
2
2
 
3
3
 
4
+
5
+ ---
6
+ ## version 0.6.3
7
+ - Update: minor syntax change for System Extensions
8
+ - Fixed: error with Apps::InstallHistory US-ASCII error
9
+
10
+
11
+ ---
12
+ ## version 0.6.2
13
+ - Fixed: workaround for listing files in user directory where listing items in the .Trash resulted in an error
14
+
4
15
  ---
5
16
  ## version 0.6.1
6
17
  - Fixed: checking plist to make sure they are valid before reading them with CFPropertyList
data/README.md CHANGED
@@ -8,7 +8,7 @@ Output is simple text making it able to be scraped up by an MDM or EDR solution
8
8
  ---
9
9
  ## Installation:
10
10
 
11
- `sudp gem install macos-artifacts`
11
+ `sudo gem install macos-artifacts`
12
12
 
13
13
  ---
14
14
  ## Usage:
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+ require 'json'
3
+ require 'date'
2
4
 
3
5
  module Macos
4
6
  module Artifacts
@@ -51,23 +53,22 @@ module Macos
51
53
  end
52
54
 
53
55
  def self.installHistory
54
- history = `system_profiler SPInstallHistoryDataType `.split("\n")
55
- history.shift
56
- history.shift
57
- puts "Application Install History:"
58
- history.each do |item|
59
- item = item.strip
60
- if ! item.empty?
61
- if item.start_with?(/^Version:/)
62
- puts " #{item}"
63
- elsif item.start_with?(/^Source:/)
64
- puts " #{item}"
65
- elsif item.start_with?(/^Install Date:/)
66
- puts " #{item}"
67
- else
68
- puts " #{item}"
69
- end
70
- end
56
+ time = DateTime.now
57
+ installs = `system_profiler -json SPInstallHistoryDataType`.strip
58
+ data = JSON.parse(installs)
59
+
60
+ puts "Software Install History:"
61
+ data["SPInstallHistoryDataType"].each do |item|
62
+ date = item["install_date"]
63
+ parsed_date = DateTime.parse(date)
64
+ installsDays = (time - parsed_date).to_i
65
+
66
+ puts " Name: #{item["_name"]}"
67
+ puts " Install Days: #{installsDays}"
68
+ puts " Install Date: #{item["install_date"]}"
69
+ puts " Version: #{item["install_version"]}"
70
+ puts " Install Source: #{item["package_source"]}"
71
+ puts ""
71
72
  end
72
73
  end
73
74
 
@@ -75,7 +75,7 @@ module Macos
75
75
  $userHomeFolder = Dir.entries("/Users/#{$currentUser}")
76
76
  fileArray = []
77
77
  $userHomeFolder.each do | filename |
78
- if filename != "." && filename != ".."
78
+ if filename != "." && filename != ".." && filename != ".Trash" && filename != ".cups"
79
79
  filePath = "/Users/#{$currentUser}/#{filename}"
80
80
  fileArray.push("#{filePath}")
81
81
  end
@@ -36,55 +36,66 @@ module Macos
36
36
 
37
37
  puts "System Extensions:"
38
38
  sysext.each do |line|
39
-
39
+
40
40
  if line.start_with?('---')
41
41
  line = line.split(" ")
42
- puts " Type: #{line[1]}"
42
+ $extType = line[1]
43
43
  elsif !line.start_with?("enabled")
44
44
  line = line.split(" ")
45
45
  if line[0] = "*"
46
- puts " Enabled: true"
46
+ extEnabled = "true"
47
47
  else
48
- puts " Enabled: false"
48
+ extEnabled = "false"
49
49
  end
50
50
  if line[1] = "*"
51
- puts " Active: true"
51
+ extActive = "true"
52
52
  else
53
- puts " Active: false"
53
+ extActive = "false"
54
54
  end
55
- puts " TeamID: #{line[2]}"
56
- puts " BundleID: #{line[3]}"
57
- puts " Version: #{line[4]}"
58
-
55
+ teamID = line[2]
56
+ bunldeID = line[3]
57
+ versionExt = line[4]
58
+
59
59
  if line[5] != "[activated"
60
60
  if line[6] != "[activated"
61
61
  if line[7] != "[activated"
62
62
  if line[8] != "[activated"
63
- puts " Name: #{line[5]} #{line[6]} #{line[7]} #{line[8]}"
63
+ nameExt = "#{line[5]} #{line[6]} #{line[7]} #{line[8]}"
64
64
  else
65
- puts " Name: #{line[5]} #{line[6]} #{line[7]}"
65
+ nameExt = "#{line[5]} #{line[6]} #{line[7]}"
66
66
  end
67
67
  end
68
68
  else
69
- puts " Name: #{line[5]}"
69
+ nameExt = "#{line[5]}"
70
70
  end
71
71
  else
72
- puts " Name: #{line[5]}"
72
+ nameExt = "#{line[5]}"
73
73
  end
74
74
 
75
75
  if line[6] == "[activated"
76
- puts " State: #{line[6]} #{line[7]}"
76
+ stateExt = "#{line[6]} #{line[7]}"
77
77
  elsif line[7] == "[activated"
78
- puts " State: #{line[7]} #{line[8]}"
78
+ stateExt = "#{line[7]} #{line[8]}"
79
79
  elsif line[8] == "[activated"
80
- puts " State: #{line[8]} #{line[9]}"
80
+ stateExt = "#{line[8]} #{line[9]}"
81
81
  elsif line[9] == "[activated"
82
- puts " State: #{line[9]} #{line[10]}"
82
+ stateExt = "#{line[9]} #{line[10]}"
83
83
  else
84
- puts " State: #{line[6]} #{line[7]}"
84
+ stateExt = "#{line[6]} #{line[7]}"
85
85
  end
86
+ puts " Type: #{$extType}"
87
+ puts " Enabled: #{extEnabled}"
88
+ puts " Active: #{extActive}"
89
+ puts " Team ID: #{teamID}"
90
+ puts " Bundle ID: #{bunldeID}"
91
+ puts " Version: #{versionExt}"
92
+ puts " Name: #{nameExt}"
93
+ puts " State: #{stateExt}"
86
94
  end
95
+
87
96
  end
97
+
98
+
88
99
  end
89
100
 
90
101
  def self.processCPU
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Macos
4
4
  module Artifacts
5
- VERSION = "0.6.1"
5
+ VERSION = "0.6.3"
6
6
  end
7
7
  end
@@ -7,6 +7,7 @@ require_relative "artifacts/apps"
7
7
  require_relative "artifacts/help"
8
8
  require 'cfpropertylist'
9
9
 
10
+
10
11
  $currentUser = ENV['USER']
11
12
 
12
13
  module Macos
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macos-artifacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.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: 2023-09-12 00:00:00.000000000 Z
11
+ date: 2024-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler