macos-artifacts 0.6.3 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff8a46c9c151ddb085fd4c578d90e16aa922722d61728b7803934ef04617184f
4
- data.tar.gz: 8ef9df8d3ca88f39c04988d856ae3d9d08cc870999d8b3058a055bec482c48bf
3
+ metadata.gz: f1ddf4c188e1d94cc14f5329bd1abb165a1364e0b270b394b4565e46a3861b75
4
+ data.tar.gz: 6cc605f5a9c737f23db1f52ed4e3bd09a271931f78e7607e7d8dff1032feaf8d
5
5
  SHA512:
6
- metadata.gz: '09b71859a27f25c9db18c8ace5fcc00bfbae9023a4be65b632e8b3d3a341c4136a26c5c2eb6b445bf10e7727da52031f836af66c315bd29acce70dc697db9718'
7
- data.tar.gz: 56786359ec1eca917904786f9171b481f2d5982252542b699dab1068841a9a9f00ff6a8db8db0f334a805cdc5d1613722e0b13c3f8816e1261616e66faee6e96
6
+ metadata.gz: 27c015884b1a648d4cd1ef28d81e04824cdc40e3577a4f73cb1c2941214c57b05bedad3afd34cc4cbc05518ab4fee9f35b907c55547594c23bb817614ed58a51
7
+ data.tar.gz: 9ef5208b23c47e2cb5863efda227792e68279c0c047b1ab20bb0149b0c691b444845e8f440e56f8e9b52632fbbe55d9c87c5d8bb0e668e1281216a0ac43debc1
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Change Log
2
2
 
3
3
 
4
+ ---
5
+ ## version 0.6.4
6
+ - Add: airdrop activity for the last 7 days shows timestamps. Macos::Artifacts::airDrop
7
+ - Add: applications installed in current users account. Macos::Artifacts::Apps::userInstalledApplications
8
+ - Fixed: IO error with Macos::Artifacts::Apps::applications when plist file didn't exist
9
+ - Fixed: IO error with Macos::Artifacts::Files::systemLaunchAgents when is a symlink or doesn't exist
10
+
4
11
 
5
12
  ---
6
13
  ## version 0.6.3
data/README.md CHANGED
@@ -16,6 +16,8 @@ Output is simple text making it able to be scraped up by an MDM or EDR solution
16
16
  `require 'macos/artifacts'`
17
17
 
18
18
  ```ruby
19
+ Macos::Artifacts::Help::options
20
+
19
21
  Macos::Artifacts::computerName
20
22
  Macos::Artifacts::serial
21
23
  Macos::Artifacts::version
@@ -35,6 +37,14 @@ Macos::Artifacts::firewallStatus
35
37
  Macos::Artifacts::screenlockStatus
36
38
  Macos::Artifacts::lockStatus
37
39
  Macos::Artifacts::softwareUpdates
40
+ Macos::Artifacts::airDrop
41
+
42
+ Macos::Artifacts::Apps::applications
43
+ Macos::Artifacts::Apps::packagesReceipts
44
+ Macos::Artifacts::Apps::installHistory
45
+ Macos::Artifacts::Apps::appInstallLocations
46
+ Macos::Artifacts::Apps::userInstalledApplications
47
+
38
48
  Macos::Artifacts::Files::systemLaunchAgents
39
49
  Macos::Artifacts::Files::systemLaunchDaemons
40
50
  Macos::Artifacts::Files::userLaunchAgents
@@ -44,12 +54,22 @@ Macos::Artifacts::Files::userApplicationSupport
44
54
  Macos::Artifacts::Files::libraryPreferences
45
55
  Macos::Artifacts::Files::userLibraryPreferences
46
56
  Macos::Artifacts::Files::cronTabs
57
+
47
58
  Macos::Artifacts::Files::etcHosts
59
+ Macos::Artifacts::Files::usrLocal
60
+ Macos::Artifacts::Files::usrLocalBin
61
+ Macos::Artifacts::Files::usrLocalSbin
62
+ Macos::Artifacts::Files::usersShared
63
+ Macos::Artifacts::Files::privateTmp
64
+ Macos::Artifacts::Files::scriptInstallLocations
65
+
48
66
  Macos::Artifacts::State::users
49
67
  Macos::Artifacts::State::adminUsers
50
68
  Macos::Artifacts::State::systemExtensions
51
69
  Macos::Artifacts::State::processCPU
52
70
  Macos::Artifacts::State::processMemory
71
+ Macos::Artifacts::State::openNetworkConnections
72
+ Macos::Artifacts::State::networkInterfaces
53
73
  ```
54
74
 
55
75
 
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'json'
3
4
  require 'date'
5
+ $currentUser = ENV['USER']
4
6
 
5
7
  module Macos
6
8
  module Artifacts
@@ -10,35 +12,39 @@ module Macos
10
12
  $applicationsDirectory = Dir.entries("#{$applicationsPath}")
11
13
  puts "Applications Folder:"
12
14
  $applicationsDirectory.sort!.each do | filename |
13
- if ! filename.start_with?(".")
15
+ if ! filename.start_with?(".")
14
16
  if File.extname(filename) == ".app"
15
- plist = CFPropertyList::List.new(:file => "#{$applicationsPath}/#{filename}/Contents/Info.plist")
16
- data = CFPropertyList.native_types(plist.value)
17
- data.each do |k,v|
18
- if k == "CFBundleShortVersionString"
19
- puts " #{$applicationsPath}/#{filename}: #{v}"
17
+ plistfile = "#{$applicationsPath}/#{filename}/Contents/Info.plist"
18
+ if File.exist?("#{plistfile}")
19
+ plist = CFPropertyList::List.new(:file => "#{$applicationsPath}/#{filename}/Contents/Info.plist")
20
+ data = CFPropertyList.native_types(plist.value)
21
+ data.each do |k,v|
22
+ if k == "CFBundleShortVersionString"
23
+ puts " #{$applicationsPath}/#{filename}: #{v}"
24
+ end
25
+ end
20
26
  end
21
- end
27
+
22
28
  else
23
- if File.directory?("#{$applicationsPath}/#{filename}")
29
+ if File.directory?("#{$applicationsPath}/#{filename}")
24
30
  puts " #{$applicationsPath}/#{filename}:"
25
31
  subpath = Dir.entries("#{$applicationsPath}/#{filename}")
26
32
  subpath.each do |subdirapp|
27
- if ! subdirapp.start_with?(".")
33
+ if ! subdirapp.start_with?(".")
28
34
  if File.extname(subdirapp) == ".app"
29
- plist = CFPropertyList::List.new(:file => "#{$applicationsPath}/#{filename}/#{subdirapp}/Contents/Info.plist")
30
- data = CFPropertyList.native_types(plist.value)
31
- data.each do |k,v|
35
+ plist = CFPropertyList::List.new(:file => "#{$applicationsPath}/#{filename}/#{subdirapp}/Contents/Info.plist")
36
+ data = CFPropertyList.native_types(plist.value)
37
+ data.each do |k,v|
32
38
  if k == "CFBundleShortVersionString"
33
- puts " #{$applicationsPath}/#{filename}/#{subdirapp}: #{v}"
39
+ puts " #{$applicationsPath}/#{filename}/#{subdirapp}: #{v}"
34
40
  end
35
- end
41
+ end
42
+ end
36
43
  end
37
- end
38
44
  end
39
- end
45
+ end
46
+ end
40
47
  end
41
- end
42
48
  end
43
49
  end
44
50
 
@@ -81,8 +87,15 @@ module Macos
81
87
  end
82
88
  end
83
89
  end
84
-
85
90
 
91
+ def self.userInstalledApplications
92
+ history = `mdfind -onlyin /Users/"#{$currentUser}" 'kMDItemKind == "Application"'`.split("\n")
93
+ puts "User Installed Applications:"
94
+ history.each do |item|
95
+ puts " #{item.strip}"
96
+ end
97
+ end
98
+
86
99
  end
87
100
  end
88
101
  end
@@ -11,14 +11,27 @@ module Macos
11
11
  $launchAgentDir = Dir.entries("#{$systemLaunchAgentsPath}")
12
12
  puts "System Launchagents:"
13
13
  $launchAgentDir.each do | filename |
14
- if filename != "." && filename != ".."
15
- puts " #{$systemLaunchAgentsPath}/#{filename}"
16
- plist = CFPropertyList::List.new(:file => "#{$systemLaunchAgentsPath}/#{filename}")
17
- data = CFPropertyList.native_types(plist.value)
18
- data.each do |k,v|
19
- puts " #{k}: #{v}"
14
+ if filename != "." && filename != ".."
15
+ puts " #{$systemLaunchAgentsPath}/#{filename}"
16
+ plistPath = "#{$systemLaunchAgentsPath}/#{filename}"
17
+ if File.exist?("#{plistPath}")
18
+ plist = CFPropertyList::List.new(:file => "#{$systemLaunchAgentsPath}/#{filename}")
19
+ data = CFPropertyList.native_types(plist.value)
20
+ data.each do |k,v|
21
+ puts " #{k}: #{v}"
22
+ end
23
+ end
24
+ if File.symlink?("#{plistPath}")
25
+ filename = File.readlink("#{plistPath}")
26
+ if File.exist?("#{filename}")
27
+ plist = CFPropertyList::List.new(:file => "#{$systemLaunchAgentsPath}/#{filename}")
28
+ data = CFPropertyList.native_types(plist.value)
29
+ data.each do |k,v|
30
+ puts " #{k}: #{v}"
31
+ end
32
+ end
33
+ end
20
34
  end
21
- end
22
35
  end
23
36
  end
24
37
 
@@ -29,6 +29,7 @@ module Macos
29
29
  puts " Macos::Artifacts::screenlockStatus checks screenlock status and time"
30
30
  puts " Macos::Artifacts::lockStatus returns Activation Lock Status"
31
31
  puts " Macos::Artifacts::softwareUpdates returns machines softwareupate settings"
32
+ puts " Macos::Artifacts::airDrop returns timestamps of successful airdrops in last 7 days"
32
33
  puts ""
33
34
  puts "Macos::Artifacts::Files Usage:"
34
35
  puts " Macos::Artifacts::Files::systemLaunchAgents list output of installed /Library/LaunchAgents"
@@ -62,6 +63,7 @@ module Macos
62
63
  puts " Macos::Artifacts::Apps::packagesReceipts outputs list of installed packages"
63
64
  puts " Macos::Artifacts::Apps::installHistory outputs history of installed apps"
64
65
  puts " Macos::Artifacts::Apps::appInstallLocations outputs list of appliction install paths"
66
+ puts " Macos::Artifacts::Apps::userInstalledApplications outputs list of applictions installed in current users account"
65
67
  puts ""
66
68
  end
67
69
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Macos
4
4
  module Artifacts
5
- VERSION = "0.6.3"
5
+ VERSION = "0.6.4"
6
6
  end
7
7
  end
@@ -6,6 +6,7 @@ require_relative "artifacts/files"
6
6
  require_relative "artifacts/apps"
7
7
  require_relative "artifacts/help"
8
8
  require 'cfpropertylist'
9
+ require 'json'
9
10
 
10
11
 
11
12
  $currentUser = ENV['USER']
@@ -142,5 +143,21 @@ module Macos
142
143
  puts " Install Critical Updates: #{criticalUpdateInstall}"
143
144
  end
144
145
  end
146
+
147
+ def self.airDrop
148
+ airdropUsage = `log show --style json --last 7d --predicate 'subsystem == "com.apple.sharing" AND category == "AirDrop" AND eventMessage == "Sending Ask response with code OK (200)"'`.strip
149
+ data = JSON.parse(airdropUsage)
150
+
151
+ puts "Airdrop Activty last 7 Days:"
152
+ data.each do |item|
153
+ # puts item
154
+ puts " UserID: #{item["userID"]}"
155
+ puts " Subsystem: #{item["subsystem"]}"
156
+ puts " Category: #{item["category"]}"
157
+ puts " Time: #{item["timestamp"]}"
158
+ puts " Message: #{item["eventMessage"]}"
159
+ puts ""
160
+ end
161
+ end
145
162
  end
146
163
  end
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.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - nic scott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-30 00:00:00.000000000 Z
11
+ date: 2024-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler