How jamf/aftermath works
Main components
• Main Application Core – Represented by the “aftermath” directory containing main.swift and other key files. This is the entry point for execution.
• Collection Modules – There are several domain-specific modules:
• Analysis (analysis folder): Parsing logs, databases, timeline generation, and storyline creation.
• Artifacts (artifacts folder): Collecting configuration profiles, log files, quarantine data, etc.
• Filesystem (filesystem folder): Walking common directories, gathering file metadata, including specialized browsers submodules.
• Network (network folder): Capturing active network connections and related preferences.
• Persistence (persistence folder): Monitoring items such as cron jobs, login items, launch agents/daemons, system extensions.
• Processes (processes folder): Using support from TrueTree, process tree generation and network-related process information.
• Endpoint Security (endpointSecurity folder): Collecting ES logs and relevant security events.
• System Recon (systemRecon folder): Environment details, installed applications, system configuration and status.
• Unified Logs (unifiedlogs folder): Handling unified logging modules.
• Extension Utilities – Found in the “extensions” directory, which offer helper methods for core data types (FileManager, String, URL).
• Helper Components – Found in “helpers” as common code pieces.
• Library Integrations – Under “libs”, third-party or additional platform-specific libraries (e.g., ProcLib, launchdXPC) are integrated.
• Optional Analysis Phase – Via the “--analyze” flag when running the tool, the system processes previously collected data archives.
Out the relationships and interactions
• The Main Application (aftermath/main.swift) acts as the central orchestrator that kicks off one or more collection modules based on options passed from the command line.
• Each module (for artifacts, filesystem, network, etc.) is responsible for a distinct aspect of data collection. They can be visualized as independent but interacting blocks that feed data into a common output (written to /tmp or a user-specified output directory).
• The Analysis module works separately to ingest and process a zip/archive produced by the collection phase, resulting in parsed data, timelines, and storylines.
• Some modules (e.g., endpointSecurity and processes) may use additional libraries or threads (referencing “eslogger”, “tcpdump”, and TrueTree) to handle asynchronous data collection.
Architectural patterns and design principles
• Modular Architecture – Each domain (artifacts, filesystem, network, etc.) is clearly separated into its own directory and module, facilitating focused maintenance and future extension.
• Command-Line Interface (CLI) Design – The use of flags (e.g., --analyze, --deep, --disable) implies a design that can flexibly control behavior at runtime.
• Separation of Concerns – Distinct modules for collection vs. analysis and granular sub-modules (e.g., file browsers under filesystem/browsers) indicate good separation of responsibilities.
• Extensibility – With explicit handling for additional unified log predicates and disabling certain features through CLI arguments, the system is designed with extensibility in mind.
Relevant technologies and frameworks
• Swift and Xcode – The project is built with Xcode and written in Swift.
• macOS APIs – Since Aftermath requires full disk access and system-level privileges (e.g., accessing logs, network connections, process details), it directly leverages macOS system services.
• External logs and shell commands – Modules that interact with logs (e.g., Endpoint Security) or utilize shell utilities may invoke external processes whose lifecycles are controlled by the main application.