2023-06-09 11:29:00 +00:00
|
|
|
-- Long-running programs who were recently added to disk, based on btime/ctime
|
2022-10-18 18:42:26 +00:00
|
|
|
--
|
|
|
|
-- false-positives:
|
|
|
|
-- * many
|
|
|
|
--
|
2023-06-09 11:29:00 +00:00
|
|
|
-- tags: transient process state
|
2022-10-18 18:42:26 +00:00
|
|
|
-- platform: darwin
|
2023-05-08 17:20:47 +00:00
|
|
|
SELECT
|
|
|
|
f.ctime,
|
2022-10-18 18:42:26 +00:00
|
|
|
f.btime,
|
|
|
|
f.mtime,
|
2023-02-02 20:33:25 +00:00
|
|
|
p0.start_time,
|
2023-05-02 19:25:36 +00:00
|
|
|
s.authority AS s_auth,
|
|
|
|
s.identifier AS s_id,
|
2023-05-03 21:57:58 +00:00
|
|
|
REPLACE(f.directory, u.directory, '~') AS dir,
|
2023-06-01 15:52:20 +00:00
|
|
|
COALESCE(
|
|
|
|
REGEX_MATCH (
|
|
|
|
REPLACE(f.directory, u.directory, '~'),
|
|
|
|
'(~/.*?/.*?/.*?/)',
|
|
|
|
1
|
|
|
|
),
|
|
|
|
REPLACE(f.directory, u.directory, '~')
|
|
|
|
) AS top3_dir,
|
2023-05-03 21:57:58 +00:00
|
|
|
REPLACE(f.path, u.directory, '~') AS homepath,
|
2023-02-02 20:33:25 +00:00
|
|
|
-- Child
|
|
|
|
p0.pid AS p0_pid,
|
2023-05-17 14:54:16 +00:00
|
|
|
p0.start_time AS p0_start,
|
2023-02-02 20:33:25 +00:00
|
|
|
p0.path AS p0_path,
|
|
|
|
s.authority AS p0_sauth,
|
|
|
|
s.identifier AS p0_sid,
|
|
|
|
p0.name AS p0_name,
|
|
|
|
p0.cmdline AS p0_cmd,
|
|
|
|
p0.cwd AS p0_cwd,
|
|
|
|
p0.euid AS p0_euid,
|
|
|
|
p0_hash.sha256 AS p0_sha256,
|
|
|
|
-- Parent
|
|
|
|
p0.parent AS p1_pid,
|
2023-05-17 14:54:16 +00:00
|
|
|
p1.start_time AS p1_start,
|
2023-02-02 20:33:25 +00:00
|
|
|
p1.path AS p1_path,
|
|
|
|
p1.name AS p1_name,
|
|
|
|
p1.euid AS p1_euid,
|
|
|
|
p1.cmdline AS p1_cmd,
|
|
|
|
p1_hash.sha256 AS p1_sha256,
|
|
|
|
-- Grandparent
|
|
|
|
p1.parent AS p2_pid,
|
|
|
|
p2.name AS p2_name,
|
2023-05-17 14:54:16 +00:00
|
|
|
p2.start_time AS p2_start,
|
2023-02-02 20:33:25 +00:00
|
|
|
p2.path AS p2_path,
|
|
|
|
p2.cmdline AS p2_cmd,
|
|
|
|
p2_hash.sha256 AS p2_sha256
|
2023-05-08 17:20:47 +00:00
|
|
|
FROM
|
|
|
|
processes p0
|
2023-02-02 20:33:25 +00:00
|
|
|
LEFT JOIN signature s ON p0.path = s.path
|
|
|
|
LEFT JOIN file f ON p0.path = f.path
|
2023-05-03 21:57:58 +00:00
|
|
|
LEFT JOIN users u ON f.uid = u.uid
|
2023-02-02 20:33:25 +00:00
|
|
|
LEFT JOIN hash p0_hash ON p0.path = p0_hash.path
|
|
|
|
LEFT JOIN processes p1 ON p0.parent = p1.pid
|
|
|
|
LEFT JOIN hash p1_hash ON p1.path = p1_hash.path
|
|
|
|
LEFT JOIN processes p2 ON p1.parent = p2.pid
|
|
|
|
LEFT JOIN hash p2_hash ON p2.path = p2_hash.path
|
2023-05-08 17:20:47 +00:00
|
|
|
WHERE
|
|
|
|
p0.pid IN (
|
|
|
|
SELECT
|
|
|
|
pid
|
|
|
|
FROM
|
|
|
|
processes
|
|
|
|
WHERE
|
|
|
|
start_time > 0
|
2023-06-09 11:42:30 +00:00
|
|
|
AND start_time > (strftime('%s', 'now') - 43200)
|
2023-02-10 15:21:06 +00:00
|
|
|
AND pid > 0
|
|
|
|
AND path != ""
|
2023-02-24 22:24:09 +00:00
|
|
|
AND NOT path LIKE '/Applications/%'
|
|
|
|
AND NOT path LIKE '/Library/Apple/%'
|
|
|
|
AND NOT path LIKE '/nix/store/%'
|
|
|
|
AND NOT path LIKE '/opt/homebrew/%'
|
|
|
|
AND NOT path LIKE '/System/%'
|
2023-05-03 21:57:58 +00:00
|
|
|
AND NOT path LIKE '/usr/local/kolide-k2/bin/%'
|
2023-07-12 21:38:26 +00:00
|
|
|
AND NOT path LIKE '%/cloud_sql_proxy'
|
2023-02-10 15:21:06 +00:00
|
|
|
)
|
2023-05-17 14:54:16 +00:00
|
|
|
AND (p0.start_time - MAX(f.ctime, f.btime)) < 60
|
2022-11-22 14:21:03 +00:00
|
|
|
AND f.ctime > 0
|
2023-05-03 21:57:58 +00:00
|
|
|
AND NOT (
|
|
|
|
p0.euid > 499
|
|
|
|
AND (
|
|
|
|
top3_dir IN (
|
|
|
|
'~/Library/Application Support/BraveSoftware/',
|
|
|
|
'~/Library/Application Support/com.elgato.StreamDeck/',
|
|
|
|
'~/Library/Application Support/duckly/',
|
|
|
|
'~/Library/Application Support/com.elgato.StreamDeck/',
|
|
|
|
'~/Library/Application Support/Figma/',
|
|
|
|
'~/.vscode/extensions/ms-vscode.cpptools-1.15.4-darwin-arm64/',
|
|
|
|
'~/Library/Application Support/Steam/',
|
|
|
|
'~/Library/Application Support/Zed/',
|
2023-05-17 21:52:55 +00:00
|
|
|
'~/Library/Application Support/WebEx Folder/',
|
2023-05-03 21:57:58 +00:00
|
|
|
'/Library/Application Support/EcammLive',
|
2023-06-02 23:08:08 +00:00
|
|
|
'/usr/local/kolide-k2/Kolide.app/Contents/MacOS',
|
2023-05-03 21:57:58 +00:00
|
|
|
'~/Library/Application Support/Foxit Software/',
|
|
|
|
'~/Library/Application Support/JetBrains/',
|
|
|
|
'~/Library/Application Support/OpenLens',
|
|
|
|
'~/Library/Application Support/sourcegraph-sp/',
|
|
|
|
'~/Library/Application Support/Zwift/',
|
|
|
|
'~/Library/Caches/com.mimestream.Mimestream/',
|
|
|
|
'~/Library/Caches/com.sempliva.Tiles/',
|
|
|
|
'~/Library/Caches/JetBrains/',
|
|
|
|
'~/Library/Caches/org.gpgtools.updater/',
|
|
|
|
'~/Library/Caches/snyk/',
|
2023-05-05 19:10:54 +00:00
|
|
|
'~/projects/go/src/',
|
|
|
|
'~/Library/Caches/company.thebrowser.Browser/',
|
2023-05-03 21:57:58 +00:00
|
|
|
'/Library/Developer/Xcode/',
|
|
|
|
'~/.terraform.d/plugin-cache/registry.terraform.io/'
|
|
|
|
)
|
|
|
|
OR dir IN (
|
|
|
|
'~/bin',
|
|
|
|
'~/code/bin',
|
|
|
|
'~/go/bin',
|
2023-09-14 21:13:12 +00:00
|
|
|
'~/melange',
|
2023-05-03 21:57:58 +00:00
|
|
|
'~/Library/Application Support/cloud-code/installer/google-cloud-sdk/bin',
|
2023-06-02 23:08:08 +00:00
|
|
|
'/usr/local/kolide-k2/Kolide.app/Contents/MacOS',
|
2023-05-03 21:57:58 +00:00
|
|
|
'~/Library/Application Support/dev.warp.Warp-Stable',
|
2023-06-01 15:52:20 +00:00
|
|
|
'~/Library/Application Support/snyk-ls',
|
2023-05-03 21:57:58 +00:00
|
|
|
'~/Library/Application Support/zoom.us/Plugins/aomhost.app/Contents/MacOS',
|
|
|
|
'~/.local/bin',
|
|
|
|
'~/.local/share/gh/extensions/gh-sbom',
|
|
|
|
'~/.magefile',
|
2023-06-01 15:52:20 +00:00
|
|
|
'~/projects/go/bin',
|
|
|
|
'/usr/local/kolide-k2/Kolide.app/Contents/MacOS'
|
2023-05-03 21:57:58 +00:00
|
|
|
)
|
2023-06-07 13:55:17 +00:00
|
|
|
OR dir LIKE '~/%/node_modules/%bin'
|
2023-09-20 13:30:46 +00:00
|
|
|
OR dir LIKE '~/%/go/bin'
|
|
|
|
OR dir LIKE '~/Downloads/%.app/Contents/MacOS'
|
2023-05-03 21:57:58 +00:00
|
|
|
OR f.path LIKE '%go-build%'
|
2023-05-05 19:10:54 +00:00
|
|
|
OR f.path LIKE '~/%/src/%.test'
|
|
|
|
OR f.path LIKE '~/%/pkg/%.test'
|
2023-08-15 22:13:06 +00:00
|
|
|
OR f.path LIKE '~/%/gopls'
|
|
|
|
OR f.path LIKE '~/go/%/bin'
|
2023-05-03 21:57:58 +00:00
|
|
|
OR f.path LIKE '/private/tmp/%/Creative Cloud Installer.app/Contents/MacOS/Install'
|
|
|
|
OR f.path LIKE '/private/tmp/go-%'
|
|
|
|
OR f.path LIKE '/private/tmp/nix-build-%'
|
|
|
|
OR f.path LIKE '/private/var/db/com.apple.xpc.roleaccountd.staging/%'
|
|
|
|
OR f.path LIKE '/private/var/folders/%/bin/%'
|
|
|
|
OR f.path LIKE '/private/var/folders/%/d/Wrapper/%.app/%'
|
|
|
|
OR f.path LIKE '/private/var/folders/%/GoLand/%'
|
|
|
|
OR f.path LIKE '/private/var/folders/%/T/download/ARMDCHammer'
|
|
|
|
OR f.path LIKE '/private/var/folders/%/T/pulumi-go.%'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
AND NOT s.authority IN (
|
2023-02-09 01:06:26 +00:00
|
|
|
'Apple iPhone OS Application Signing',
|
2023-03-17 19:46:00 +00:00
|
|
|
'Apple Mac OS Application Signing',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: Adobe Inc. (JQ525L2MZD)',
|
2023-09-01 21:09:47 +00:00
|
|
|
'Developer ID Application: Azul Systems, Inc. (TDTHCUPYFR)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: Brave Software, Inc. (KL8N8XSYF4)',
|
|
|
|
'Developer ID Application: Brother Industries, LTD. (5HCL85FLGW)',
|
|
|
|
'Developer ID Application: Bryan Jones (49EYHPJ4Q3)',
|
2023-03-17 19:46:00 +00:00
|
|
|
'Developer ID Application: Canon Inc. (XE2XNRRXZ5)',
|
2023-05-17 21:52:55 +00:00
|
|
|
'Developer ID Application: Cisco (DE8Y96K9QP)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: CodeWeavers Inc. (9C6B7X7Z8E)',
|
|
|
|
'Developer ID Application: Corsair Memory, Inc. (Y93VXCB8Q5)',
|
2023-03-14 23:00:44 +00:00
|
|
|
'Developer ID Application: Denver Technologies, Inc (2BBY89MBSN)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: Docker Inc (9BNSXJN65R)',
|
2022-11-01 11:15:10 +00:00
|
|
|
'Developer ID Application: Dropbox, Inc. (G7HH3F8CAK)',
|
2023-05-17 21:52:55 +00:00
|
|
|
'Developer ID Application: Eclipse Foundation, Inc. (JCDTMS22B4)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: Emmanouil Konstantinidis (3YP8SXP3BF)',
|
|
|
|
'Developer ID Application: Galvanix (5BRAQAFB8B)',
|
2023-09-01 21:09:47 +00:00
|
|
|
'Developer ID Application: Garmin International (72ES32VZUA)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: General Arcade (Pte. Ltd.) (S8JLSG5ES7)',
|
|
|
|
'Developer ID Application: GEORGE NACHMAN (H7V7XYVQ7D)',
|
|
|
|
'Developer ID Application: GitHub (VEKTX9H2N7)',
|
|
|
|
'Developer ID Application: Google LLC (EQHXZ8M8AV)',
|
2022-11-01 11:15:10 +00:00
|
|
|
'Developer ID Application: GPGTools GmbH (PKV8ZPD836)',
|
2023-09-14 21:13:12 +00:00
|
|
|
'Developer ID Application: Tailscale Inc. (W5364U7YZB)',
|
2022-11-01 11:15:10 +00:00
|
|
|
'Developer ID Application: JetBrains s.r.o. (2ZEFAR8TH3)',
|
2023-03-17 19:46:00 +00:00
|
|
|
'Developer ID Application: Kandji, Inc. (P3FGV63VK7)',
|
2023-09-01 21:09:47 +00:00
|
|
|
'Developer ID Application: Keybase, Inc. (99229SGT5K)',
|
|
|
|
'Developer ID Application: Kolide, Inc (X98UFR7HA3)',
|
2022-11-01 11:15:10 +00:00
|
|
|
'Developer ID Application: Kolide Inc (YZ3EM74M78)',
|
2023-09-01 21:09:47 +00:00
|
|
|
'Developer ID Application: EnterpriseDB Corporation (26QKX55P9K)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: Logitech Inc. (QED4VVPZWA)',
|
|
|
|
'Developer ID Application: Michael Jones (YD6LEYT6WZ)',
|
2023-03-17 19:46:00 +00:00
|
|
|
'Developer ID Application: Microsoft Corporation (UBF8T346G9)',
|
2023-09-01 21:09:47 +00:00
|
|
|
'Developer ID Application: Mojang AB (HR992ZEAE6)',
|
2023-03-17 19:46:00 +00:00
|
|
|
'Developer ID Application: Objective Development Software GmbH (MLZF7K7B5R)',
|
|
|
|
'Developer ID Application: Objective-See, LLC (VBG97UB4TA)',
|
2022-11-01 11:15:10 +00:00
|
|
|
'Developer ID Application: Opal Camera Inc (97Z3HJWCRT)',
|
2023-09-01 21:09:47 +00:00
|
|
|
'Developer ID Application: OPENVPN TECHNOLOGIES, INC. (ACV7L3WCD8)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: OSQUERY A Series of LF Projects, LLC (3522FA9PXF)',
|
2023-03-17 19:46:00 +00:00
|
|
|
'Developer ID Application: Parallels International GmbH (4C6364ACXT)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: RescueTime, Inc (FSY4RB8H39)',
|
|
|
|
'Developer ID Application: Seiko Epson Corporation (TXAEAV5RN4)',
|
2023-09-01 21:09:47 +00:00
|
|
|
'Developer ID Application: SteelSeries (6WGL6CHFH2)',
|
2023-03-17 19:46:00 +00:00
|
|
|
'Developer ID Application: Sublime HQ Pty Ltd (Z6D26JE4Y4)',
|
|
|
|
'Developer ID Application: SUSE LLC (2Q6FHJR3H3)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Developer ID Application: Yubico Limited (LQA3CS5MM7)',
|
2022-11-01 11:15:10 +00:00
|
|
|
'Developer ID Application: Zoom Video Communications, Inc. (BJ4HAAB9B3)',
|
2022-10-18 18:42:26 +00:00
|
|
|
'Software Signing'
|
|
|
|
)
|
2023-09-01 21:09:47 +00:00
|
|
|
AND NOT (
|
2023-09-01 21:27:27 +00:00
|
|
|
s.identifier = "com.apple.print.PrinterProxy"
|
2023-09-01 21:09:47 +00:00
|
|
|
AND p0.path LIKE "/Users/%/Library/Printers/%/Contents/MacOS/PrinterProxy"
|
|
|
|
AND p0.uid > 499
|
|
|
|
)
|
2023-02-08 19:37:09 +00:00
|
|
|
AND NOT (
|
2023-05-03 21:57:58 +00:00
|
|
|
homepath LIKE '~/%'
|
2023-02-02 20:33:25 +00:00
|
|
|
AND p0.uid > 499
|
2022-10-18 18:42:26 +00:00
|
|
|
AND f.ctime = f.mtime
|
2023-02-02 20:33:25 +00:00
|
|
|
AND f.uid = p0.uid
|
|
|
|
AND p0.cmdline LIKE './%'
|
2023-05-17 14:54:16 +00:00
|
|
|
AND p0.path NOT LIKE '%Library%'
|
|
|
|
AND p0.path NOT LIKE '%/.%'
|
|
|
|
AND p0.path NOT LIKE '%Cache%'
|
2022-10-18 18:42:26 +00:00
|
|
|
)
|
2023-06-12 14:10:57 +00:00
|
|
|
AND NOT homepath LIKE '~/%/terraform-provider-%'
|
|
|
|
AND NOT homepath LIKE '~/src/%'
|
|
|
|
AND NOT homepath LIKE '~/github/%'
|
|
|
|
AND NOT homepath LIKE '~/go/src/%'
|
2023-05-08 17:07:57 +00:00
|
|
|
-- Arc
|
|
|
|
AND NOT (
|
|
|
|
p0.path LIKE '/Users/%/Library/Caches/%/org.sparkle-project.Sparkle/Launcher/%'
|
|
|
|
AND s.identifier = 'org.sparkle-project.Sparkle.Updater'
|
|
|
|
AND s.authority != ''
|
|
|
|
AND p0.uid > 499
|
|
|
|
)
|
2023-07-12 21:38:26 +00:00
|
|
|
AND NOT (
|
|
|
|
p0.path = '/Library/PrivilegedHelperTools/com.macpaw.CleanMyMac4.Agent'
|
|
|
|
AND s_auth = 'Developer ID Application: MacPaw Inc. (S8EX82NJP6)'
|
|
|
|
)
|
2023-02-15 01:16:02 +00:00
|
|
|
GROUP BY
|
|
|
|
p0.pid
|