This repository was archived by the owner on Jun 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDumpFrameworks.sh
More file actions
executable file
·59 lines (40 loc) · 2.34 KB
/
Copy pathDumpFrameworks.sh
File metadata and controls
executable file
·59 lines (40 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Dumps all of the iOS frameworks (both public and private) and then patches the imports.
# The headers are then merged with the existing iOS headers in your SDK.
# Takes one argument:
# The SDK Path (e.g. "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk")
# You must place the class-dump executable in "/usr/bin/"
SDK=$1
# Initial set up
rm -rf ~/Desktop/HeaderDump
mkdir ~/Desktop/HeaderDump
mkdir ~/Desktop/HeaderDump/Frameworks
mkdir ~/Desktop/HeaderDump/PrivateFrameworks
mkdir ~/Desktop/PatchedHeaderDump
mkdir ~/Desktop/PatchedHeaderDump/Frameworks
mkdir ~/Desktop/PatchedHeaderDump/PrivateFrameworks
# Dump Public Frameworks
for fw in $SDK/System/Library/Frameworks/*/
do
class-dump --arch armv6 --arch armv7 -H -o ~/Desktop/HeaderDump/Frameworks/$(perl -e "print substr(substr('$fw', 0, -1), rindex(substr('$fw', 0, -1), \"/\") +1, (rindex(substr('$fw', 0, -1), \".\"))-(rindex(substr('$fw', 0, -1), \"/\") +1))";).framework/ $fw$(perl -e "print substr(substr('$fw', 0, -1), rindex(substr('$fw', 0, -1), \"/\") +1, (rindex(substr('$fw', 0, -1), \".\"))-(rindex(substr('$fw', 0, -1), \"/\") +1))";)
done
# Dump Private Frameworks
for pfw in $SDK/System/Library/PrivateFrameworks/*/
do
class-dump --arch armv6 --arch armv7 -H -o ~/Desktop/HeaderDump/PrivateFrameworks/$(perl -e "print substr(substr('$pfw', 0, -1), rindex(substr('$pfw', 0, -1), \"/\") +1, (rindex(substr('$pfw', 0, -1), \".\"))-(rindex(substr('$pfw', 0, -1), \"/\") +1))";).framework/ $pfw$(perl -e "print substr(substr('$pfw', 0, -1), rindex(substr('$pfw', 0, -1), \"/\") +1, (rindex(substr('$pfw', 0, -1), \".\"))-(rindex(substr('$pfw', 0, -1), \"/\") +1))";)
done
# Dump SpringBoard
class-dump --arch armv6 --arch armv7 -H $SDK/System/Library/CoreServices/SpringBoard.app/SpringBoard -o ~/Desktop/HeaderDump/PrivateFrameworks/SpringBoard.framework
# Patch Headers
perl ./PatchHeaders.pl ~/Desktop/
# Merge with Apple Headers
sudo cp -Rn ~/Desktop/PatchedHeaderDump/Frameworks/ $SDK/System/Library/Frameworks
sudo cp -Rn ~/Desktop/PatchedHeaderDump/PrivateFrameworks/ $SDK/System/Library/PrivateFrameworks
sudo cp ./substrate.h $SDK/System/Library/PrivateFrameworks
sudo cp ./libsubstrate.dylib $SDK/usr/lib
# Tidy Up
rm -rf ~/Desktop/HeaderDump
rm -rf ~/Desktop/PatchedHeaderDump
rm ~/Desktop/headers.h
echo "Framework Dump completed successfully"
exit 0