mirror of
https://github.com/mroi/apple-internals.git
synced 2026-02-12 17:12:44 +00:00
db: extract dylibs from dyld cache and scan
uses dyld_shared_cache_util tool from the Nix flake
This commit is contained in:
16
Makefile
16
Makefile
@@ -23,6 +23,7 @@ $(DB):
|
||||
$(DB).lz: $(DB)
|
||||
compression_tool -encode -i $< -o $@
|
||||
tmutil addexclusion $@
|
||||
rm -rf dyld
|
||||
endif
|
||||
|
||||
check: internals.txt
|
||||
@@ -32,8 +33,18 @@ check: internals.txt
|
||||
|
||||
# MARK: - data extraction helpers
|
||||
|
||||
NIX = $(shell nix-build --no-out-link -A nixFlakes '<nixpkgs>')/bin/nix
|
||||
DSCU = $(shell \
|
||||
$(NIX) --experimental-features 'nix-command flakes' build --no-write-lock-file .\#dyld-shared-cache && \
|
||||
readlink result && rm result)/bin/dyld_shared_cache_util
|
||||
|
||||
dyld: /System/Library/dyld/dyld_shared_cache_$(shell uname -m)
|
||||
$(DSCU) -extract $@ $<
|
||||
find $@ -type f -print0 | xargs -0 chmod a+x
|
||||
|
||||
prefix = $$(case $(1) in \
|
||||
(macOS) ;; \
|
||||
(macOS-dyld) echo $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/dyld ;; \
|
||||
(iOS) echo /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot ;; \
|
||||
(tvOS) echo /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot ;; \
|
||||
(watchOS) echo /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/watchOS.simruntime/Contents/Resources/RuntimeRoot ;; \
|
||||
@@ -43,6 +54,7 @@ find = \
|
||||
{ \
|
||||
$(2) find /Library /System /bin /dev /private /sbin /usr ! \( -path /System/Volumes/Data -prune \) $(1) 2> /dev/null | sed 's/^/macOS /' ; \
|
||||
cd /Applications/Xcode.app/Contents/Developer ; find Library Toolchains Tools usr $(1) | sed 's|^|macOS /Applications/Xcode.app/Contents/Developer/|' ; \
|
||||
test -d "$(call prefix,macOS-dyld)" && cd "$(call prefix,macOS-dyld)" && find . $(1) | sed '1d;s/^\./macOS-dyld /' ; \
|
||||
cd $(call prefix,iOS) ; find . $(1) | sed '1d;s/^\./iOS /' ; \
|
||||
cd $(call prefix,tvOS) ; find . $(1) | sed '1d;s/^\./tvOS /' ; \
|
||||
cd $(call prefix,watchOS) ; find . $(1) | sed '1d;s/^\./watchOS /' ; \
|
||||
@@ -56,7 +68,7 @@ file = SELECT id, $(1) FROM files WHERE os = '$$os' AND path = '$$(echo "$$path"
|
||||
$(DB_TARGETS)::
|
||||
echo 'BEGIN IMMEDIATE TRANSACTION;'
|
||||
|
||||
db_files::
|
||||
db_files:: dyld
|
||||
if ! csrutil status | grep -Fq disabled ; then \
|
||||
printf '\033[1mdisable SIP to get complete file information\033[m\n' >&2 ; \
|
||||
echo 'FAIL;' ; \
|
||||
@@ -69,7 +81,7 @@ db_files::
|
||||
find $(HOME)/Library | sed "s|^$(HOME)|~|;s/'/''/g;s/.*/INSERT INTO files (os, path) VALUES('macOS', '&');/"
|
||||
echo 'CREATE INDEX files_path ON files (path);'
|
||||
|
||||
db_binaries::
|
||||
db_binaries:: dyld
|
||||
printf '\033[1mcollecting executable information...\033[m\n' >&2
|
||||
echo 'DROP TABLE IF EXISTS linkages;'
|
||||
echo 'DROP TABLE IF EXISTS entitlements;'
|
||||
|
||||
Reference in New Issue
Block a user