Skip to content

Commit 175fa39

Browse files
authored
Merge pull request #53 from jamf/dev
A merge of the latest dev branch into main
2 parents f5f1f33 + 579cfd5 commit 175fa39

File tree

23 files changed

+706
-56
lines changed

23 files changed

+706
-56
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
![](https://github.com/jamf/aftermath/blob/main/AftermathLogo.png)
33

44

5-
![](https://img.shields.io/badge/release-1.2.0-bright%20green) ![](https://img.shields.io/badge/macOS-12.0%2B-blue) ![](https://img.shields.io/badge/license-MIT-orange)
5+
![](https://img.shields.io/badge/release-2.0.0-bright%20green) ![](https://img.shields.io/badge/macOS-12.0%2B-blue) ![](https://img.shields.io/badge/license-MIT-orange)
66

77

88
## About
@@ -57,12 +57,15 @@ sudo ./aftermath --analyze <path_to_collection_zip>
5757
```
5858

5959
### External Unified Log Predicates
60-
As of v1.2.0, users have the ability to pass Aftermath a text file of unified log predicates using the `--logs` or `-l` arguments. The file being passed to Aftermath is required to be a text file and each predicate needs to be newline-separated. In addition, each line item will be a dictionary object. The key in the dictionary will whatever the user desires to call this predicate. For example, if you want to see all login events, we will create a predicate and title it `login_events`.
60+
Users have the ability to pass Aftermath a text file of unified log predicates using the `--logs` or `-l` arguments. The file being passed to Aftermath is required to be a text file and each predicate needs to be newline-separated. In addition, each line item will be a dictionary object. The key in the dictionary will whatever the user desires to call this predicate. For example, if you want to see all login events, we will create a predicate and title it `login_events`.
6161
```
6262
login_events: processImagePath contains "loginwindow" and eventMessage contains "com.apple.sessionDidLogin
6363
tcc: process == "tccd"
6464
```
6565

66+
### Note
67+
Because `eslogger` and `tcpdump` run on additional threads and the goal is to collect as much data from them as possible, they exit when aftermath exits. Because of this, the last line of the eslogger json file or the pcap file generated from tcpdump may be truncated.
68+
6669
## Releases
6770
There is an Aftermath.pkg available under [Releases](https://github.com/jamf/aftermath/releases). This pkg is signed and notarized. It will install the aftermath binary at `/usr/local/bin/`. This would be the ideal way to deploy via MDM. Since this is installed in `bin`, you can then run aftermath like
6871
```bash
@@ -81,10 +84,14 @@ To uninstall the aftermath binary, run the `AftermathUninstaller.pkg` from the [
8184
usage: --collect-dirs <path_to_dir> <path_to_another_dir>
8285
--deep or -d -> perform a deep scan of the file system for modified and accessed timestamped metadata
8386
WARNING: This will be a time-intensive, memory-consuming scan.
87+
--es-logs -> specify which Endpoint Security events (space-separated) to collect (defaults are: create exec mmap). To disable, see --disable-es-logs
88+
usage: --es-logs setuid unmount write
8489
--logs -> specify an external text file with unified log predicates (as dictionary objects) to parse
8590
usage: --logs /Users/<USER>/Desktop/myPredicates.txt
8691
-o or --output -> specify an output location for Aftermath collection results (defaults to /tmp)
8792
usage: -o Users/user/Desktop
93+
--disable-browser-killswitch -> by default, browsers are force-closed during collection. This will disable the force-closing of browsers.
94+
--disable-es-logs -> by default, es logs of create, exec, and mmap are collected. This will disable this default behavior
8895
--pretty -> colorize Terminal output
8996
--cleanup -> remove Aftermath folders from default locations ("/tmp", "/var/folders/zz/)
9097
```

aftermath.xcodeproj/project.pbxproj

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
5E29FD732A2FB098008D528F /* ESModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E29FD722A2FB098008D528F /* ESModule.swift */; };
11+
5E29FD752A2FB0EF008D528F /* ESLogs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E29FD742A2FB0EF008D528F /* ESLogs.swift */; };
1012
5E494473293AC914007FFBDD /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E494472293AC914007FFBDD /* URL.swift */; };
1113
5E494475293D50FE007FFBDD /* ConfigurationProfiles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E494474293D50FE007FFBDD /* ConfigurationProfiles.swift */; };
14+
5E4BC90029D75A8E0004DAA6 /* Arc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E4BC8FF29D75A8E0004DAA6 /* Arc.swift */; };
1215
5E6780F22922E7E800BAF04B /* Edge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E6780F12922E7E800BAF04B /* Edge.swift */; };
1316
5E93B0AE2941608D009D2AB5 /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E93B0AD2941608D009D2AB5 /* Data.swift */; };
1417
5E93B0B0294160B6009D2AB5 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E93B0AF294160B6009D2AB5 /* String.swift */; };
18+
5EA438FF2A7010FF00F3E2B9 /* XProtectBehavioralService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EA438FE2A7010FF00F3E2B9 /* XProtectBehavioralService.swift */; };
1519
70A44403275707A90035F40E /* SystemReconModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70A44402275707A90035F40E /* SystemReconModule.swift */; };
1620
70A44405275A76990035F40E /* LSQuarantine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70A44404275A76990035F40E /* LSQuarantine.swift */; };
1721
70CF9E3A27611C6100FD884B /* ShellHistoryAndProfiles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70CF9E3927611C6100FD884B /* ShellHistoryAndProfiles.swift */; };
@@ -77,11 +81,15 @@
7781
/* End PBXCopyFilesBuildPhase section */
7882

7983
/* Begin PBXFileReference section */
84+
5E29FD722A2FB098008D528F /* ESModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ESModule.swift; sourceTree = "<group>"; };
85+
5E29FD742A2FB0EF008D528F /* ESLogs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ESLogs.swift; sourceTree = "<group>"; };
8086
5E494472293AC914007FFBDD /* URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = "<group>"; };
8187
5E494474293D50FE007FFBDD /* ConfigurationProfiles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationProfiles.swift; sourceTree = "<group>"; };
88+
5E4BC8FF29D75A8E0004DAA6 /* Arc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arc.swift; sourceTree = "<group>"; };
8289
5E6780F12922E7E800BAF04B /* Edge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Edge.swift; sourceTree = "<group>"; };
8390
5E93B0AD2941608D009D2AB5 /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = "<group>"; };
8491
5E93B0AF294160B6009D2AB5 /* String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
92+
5EA438FE2A7010FF00F3E2B9 /* XProtectBehavioralService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XProtectBehavioralService.swift; sourceTree = "<group>"; };
8593
70A44402275707A90035F40E /* SystemReconModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemReconModule.swift; sourceTree = "<group>"; };
8694
70A44404275A76990035F40E /* LSQuarantine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LSQuarantine.swift; sourceTree = "<group>"; };
8795
70CF9E3927611C6100FD884B /* ShellHistoryAndProfiles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShellHistoryAndProfiles.swift; sourceTree = "<group>"; };
@@ -158,6 +166,15 @@
158166
/* End PBXFrameworksBuildPhase section */
159167

160168
/* Begin PBXGroup section */
169+
5E29FD712A2FB07E008D528F /* endpointSecurity */ = {
170+
isa = PBXGroup;
171+
children = (
172+
5E29FD722A2FB098008D528F /* ESModule.swift */,
173+
5E29FD742A2FB0EF008D528F /* ESLogs.swift */,
174+
);
175+
path = endpointSecurity;
176+
sourceTree = "<group>";
177+
};
161178
70A44401275707800035F40E /* systemRecon */ = {
162179
isa = PBXGroup;
163180
children = (
@@ -230,6 +247,7 @@
230247
70CF9E3927611C6100FD884B /* ShellHistoryAndProfiles.swift */,
231248
A08342D7284E48FC005E437A /* LogFiles.swift */,
232249
5E494474293D50FE007FFBDD /* ConfigurationProfiles.swift */,
250+
5EA438FE2A7010FF00F3E2B9 /* XProtectBehavioralService.swift */,
233251
);
234252
path = artifacts;
235253
sourceTree = "<group>";
@@ -271,6 +289,7 @@
271289
A0E1E3EC275EC809008D0DC6 /* Chrome.swift */,
272290
A0E1E3EE275EC810008D0DC6 /* Safari.swift */,
273291
5E6780F12922E7E800BAF04B /* Edge.swift */,
292+
5E4BC8FF29D75A8E0004DAA6 /* Arc.swift */,
274293
);
275294
path = browsers;
276295
sourceTree = "<group>";
@@ -357,6 +376,7 @@
357376
A3CD4E54274434EE00869ECB /* aftermath */,
358377
A08342D4284A8211005E437A /* analysis */,
359378
A076742D2755797800ED7066 /* artifacts */,
379+
5E29FD712A2FB07E008D528F /* endpointSecurity */,
360380
A374535B2757C1110074B65C /* extensions */,
361381
A0E1E3F9275ED4B7008D0DC6 /* filesystem */,
362382
A02509F228ADB1930030D6A7 /* helpers */,
@@ -441,7 +461,7 @@
441461
attributes = {
442462
BuildIndependentTargetsInParallel = 1;
443463
LastSwiftUpdateCheck = 1340;
444-
LastUpgradeCheck = 1320;
464+
LastUpgradeCheck = 1430;
445465
TargetAttributes = {
446466
A190FFDA28B8151300B9EF9A = {
447467
CreatedOnToolsVersion = 13.4;
@@ -502,6 +522,7 @@
502522
files = (
503523
A3CD4E56274434EE00869ECB /* Command.swift in Sources */,
504524
5E494475293D50FE007FFBDD /* ConfigurationProfiles.swift in Sources */,
525+
5E4BC90029D75A8E0004DAA6 /* Arc.swift in Sources */,
505526
A0C2E89728AAAE33008FA597 /* ProcLib.h in Sources */,
506527
A3745358275730870074B65C /* LaunchItems.swift in Sources */,
507528
A0FAEEFE28B94B2C00AC655F /* LogParser.swift in Sources */,
@@ -533,11 +554,14 @@
533554
A3046F8E27627DAC0069AA21 /* Module.swift in Sources */,
534555
8ABB9E2B27568EB700C0ADD7 /* UnifiedLogModule.swift in Sources */,
535556
5E93B0AE2941608D009D2AB5 /* Data.swift in Sources */,
557+
5EA438FF2A7010FF00F3E2B9 /* XProtectBehavioralService.swift in Sources */,
536558
A0879957275AD2DC00E885BC /* SystemConfig.swift in Sources */,
537559
A0FD80F628C7F82400E91584 /* ProcessParser.swift in Sources */,
538560
A05BF3BF284FF8CF009E197B /* Slack.swift in Sources */,
561+
5E29FD732A2FB098008D528F /* ESModule.swift in Sources */,
539562
5E494473293AC914007FFBDD /* URL.swift in Sources */,
540563
A007834E28947D71008489EA /* Emond.swift in Sources */,
564+
5E29FD752A2FB0EF008D528F /* ESLogs.swift in Sources */,
541565
A076742F2755798F00ED7066 /* ArtifactsModule.swift in Sources */,
542566
A0759135275985170006766F /* TCC.swift in Sources */,
543567
A0E1E3F6275ED2E4008D0DC6 /* NetworkModule.swift in Sources */,
@@ -561,6 +585,7 @@
561585
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
562586
CODE_SIGN_STYLE = Automatic;
563587
CURRENT_PROJECT_VERSION = 1;
588+
DEAD_CODE_STRIPPING = YES;
564589
DEVELOPMENT_TEAM = "";
565590
GENERATE_INFOPLIST_FILE = YES;
566591
MACOSX_DEPLOYMENT_TARGET = 12.3;
@@ -578,6 +603,7 @@
578603
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
579604
CODE_SIGN_STYLE = Automatic;
580605
CURRENT_PROJECT_VERSION = 1;
606+
DEAD_CODE_STRIPPING = YES;
581607
DEVELOPMENT_TEAM = "";
582608
GENERATE_INFOPLIST_FILE = YES;
583609
MACOSX_DEPLOYMENT_TARGET = 12.3;
@@ -624,6 +650,7 @@
624650
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
625651
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES;
626652
COPY_PHASE_STRIP = NO;
653+
DEAD_CODE_STRIPPING = YES;
627654
DEBUG_INFORMATION_FORMAT = dwarf;
628655
ENABLE_HARDENED_RUNTIME = YES;
629656
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -688,6 +715,7 @@
688715
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
689716
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES;
690717
COPY_PHASE_STRIP = NO;
718+
DEAD_CODE_STRIPPING = YES;
691719
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
692720
ENABLE_HARDENED_RUNTIME = YES;
693721
ENABLE_NS_ASSERTIONS = NO;
@@ -719,6 +747,7 @@
719747
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
720748
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES;
721749
CODE_SIGN_STYLE = Manual;
750+
DEAD_CODE_STRIPPING = YES;
722751
DEVELOPMENT_TEAM = "";
723752
"DEVELOPMENT_TEAM[sdk=macosx*]" = 6PV5YF2UES;
724753
ENABLE_HARDENED_RUNTIME = YES;
@@ -730,7 +759,7 @@
730759
MACH_O_TYPE = mh_execute;
731760
NEW_SETTING = "";
732761
ONLY_ACTIVE_ARCH = YES;
733-
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.aftermath;
762+
PRODUCT_BUNDLE_IDENTIFIER = com.crashsecurity.aftermath;
734763
PRODUCT_NAME = "$(TARGET_NAME)";
735764
PROVISIONING_PROFILE_SPECIFIER = "";
736765
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/libs/ProcLib $(SRCROOT)/libs/launchdXPC";
@@ -744,10 +773,11 @@
744773
buildSettings = {
745774
ARCHS = "$(ARCHS_STANDARD)";
746775
CLANG_ENABLE_MODULES = YES;
747-
CODE_SIGN_IDENTITY = "Developer ID Application";
776+
CODE_SIGN_IDENTITY = "Apple Development";
748777
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
749778
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES;
750779
CODE_SIGN_STYLE = Manual;
780+
DEAD_CODE_STRIPPING = YES;
751781
DEVELOPMENT_TEAM = 6PV5YF2UES;
752782
"DEVELOPMENT_TEAM[sdk=macosx*]" = 6PV5YF2UES;
753783
ENABLE_HARDENED_RUNTIME = YES;
@@ -759,7 +789,7 @@
759789
MACH_O_TYPE = mh_execute;
760790
NEW_SETTING = "";
761791
ONLY_ACTIVE_ARCH = NO;
762-
PRODUCT_BUNDLE_IDENTIFIER = com.jamf.aftermath;
792+
PRODUCT_BUNDLE_IDENTIFIER = com.crashsecurity.aftermath;
763793
PRODUCT_NAME = "$(TARGET_NAME)";
764794
PROVISIONING_PROFILE_SPECIFIER = "";
765795
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/libs/ProcLib $(SRCROOT)/libs/launchdXPC";

aftermath.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aftermath.xcodeproj/xcshareddata/xcschemes/aftermath.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1340"
3+
LastUpgradeVersion = "1430"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

aftermath.xcodeproj/xcshareddata/xcschemes/tests.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1340"
3+
LastUpgradeVersion = "1430"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

aftermath/CaseFiles.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ struct CaseFiles {
5959

6060
let fm = FileManager.default
6161
let isDir = fm.isDirectoryThatExists(path: outputLocation)
62-
guard isDir || fm.fileExists(atPath: outputLocation) else {
63-
print("Output path is not a valid file or directory that exists")
64-
return
62+
63+
var isFullPath: Bool = false
64+
65+
if URL(fileURLWithPath: outputLocation).pathExtension == "zip" {
66+
isFullPath = true
6567
}
6668

6769
print("Moving the aftermath directory from its temporary location. This may take some time. Please wait...")
@@ -70,9 +72,15 @@ struct CaseFiles {
7072
let localCaseDir = isAnalysis ? analysisCaseDir : caseDir
7173

7274
let endPath: String
75+
7376
if isDir {
7477
endPath = "\(outputLocation)/\(localCaseDir.lastPathComponent)"
7578
} else {
79+
// Determine if the directory didn't exist and we weren't passed a full path. Checks for misspellings in the path. (ie: -o /Users/user/Desktopp)
80+
guard isFullPath else {
81+
print("Output location is invalid.")
82+
return
83+
}
7684
// Ensure that we end up with the correct (.zip) path extension
7785
endPath = fm.deletingPathExtension(path: outputLocation)
7886
}

0 commit comments

Comments
 (0)