From b7e036a19dcd996a90ff6c23b15d9bef2cef221f Mon Sep 17 00:00:00 2001 From: ichitaso Date: Thu, 14 Apr 2022 06:44:20 +0900 Subject: [PATCH] v1.1.6 - Fixed an issue that did not work on iOS 11.x - If "appldnld.apple.com" is included in /etc/hosts file and blocked, the part is removed and "afc2d" can be downloaded. --- LICENSE | 6 +++--- Makefile | 4 +++- Tweak.xm | 3 +-- afc2dSupport.plist | 4 ---- control | 2 +- killdaemon.mm | 15 ++++++++++++++- postrm.mm | 2 +- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/LICENSE b/LICENSE index 94a9ed0..7ace19c 100644 --- a/LICENSE +++ b/LICENSE @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - Copyright (C) + Apple File Conduit "2" (iOS 11+, arm64) + Copyright (C) 2018 Cannathea This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Copyright (C) + Apple File Conduit "2" (iOS 11+, arm64) Copyright (C) 2018 Cannathea This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/Makefile b/Makefile index 847f119..647ed40 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ -TARGET =: clang::7.0 +TARGET =: clang:14.5:7.0 ARCHS = arm64 arm64e +PREFIX = $(THEOS)/toolchain/Xcode11.xctoolchain/usr/bin/ DEBUG = 0 GO_EASY_ON_ME = 1 @@ -47,6 +48,7 @@ after-package:: zip -r .theos/$(THEOS_PACKAGE_NAME)_$(THEOS_PACKAGE_BASE_VERSION)_iphoneos-arm.zip $(THEOS_PACKAGE_NAME)_$(THEOS_PACKAGE_BASE_VERSION)_iphoneos-arm mv .theos/$(THEOS_PACKAGE_NAME)_$(THEOS_PACKAGE_BASE_VERSION)_iphoneos-arm.zip ./ sudo rm -rf $(THEOS_PACKAGE_NAME)_$(THEOS_PACKAGE_BASE_VERSION)_iphoneos-arm + rm -f ./layout/DEBIAN/postrm after-install:: install.exec "killall -9 backboardd" diff --git a/Tweak.xm b/Tweak.xm index 3f3b100..12dd134 100755 --- a/Tweak.xm +++ b/Tweak.xm @@ -34,8 +34,7 @@ %end %end %ctor { - if (([[NSFileManager defaultManager] fileExistsAtPath:@"/usr/share/jailbreak/signcert.p12"]) || - [[NSFileManager defaultManager] fileExistsAtPath:PATH]) { + if ([[NSFileManager defaultManager] fileExistsAtPath:PATH]) { %init(SpringBoardHook); } } diff --git a/afc2dSupport.plist b/afc2dSupport.plist index 09734a6..a5a84d1 100755 --- a/afc2dSupport.plist +++ b/afc2dSupport.plist @@ -4,10 +4,6 @@ Filter - CoreFoundationVersion - - 1556.00 - Bundles com.apple.springboard diff --git a/control b/control index 4b0324f..8bd868a 100644 --- a/control +++ b/control @@ -1,6 +1,6 @@ Package: com.cannathea.afc2d-arm64 Name: Apple File Conduit "2" (iOS 11+, arm64) -Version: 1.1.5 +Version: 1.1.6 Description: Allow full file-system access over USB for all arm64 devices, especially useful for those on iOS 11 and above. Section: System Pre-Depends: dpkg (>= 1.14.25-8) diff --git a/killdaemon.mm b/killdaemon.mm index dbb9133..ae40bbe 100644 --- a/killdaemon.mm +++ b/killdaemon.mm @@ -1,6 +1,6 @@ /* AFC2 - the original definition of "jailbreak" * Copyright (C) 2014 Jay Freeman (saurik) - * Copyright (C) 2018 - 2021 Cannathea + * Copyright (C) 2018 Cannathea */ /* GNU General Public License, Version 3 {{{ */ @@ -79,6 +79,18 @@ return nil; } +static void removeHostsBlock() { + NSString *path = @"/etc/hosts"; + if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { + NSString *content = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + if ([content containsString:@"appldnld"]) { + printf("Apple server is blocked by /etc/hosts, unblocking...\n"); + easy_spawn((const char *[]){"/bin/sed", "-i", "/appldnld/d", "/etc/hosts", NULL}); + easy_spawn((const char *[]){"killall", "mDNSResponder", "discoveryd" , NULL}); + } + } +} + int main(int argc, const char **argv) { @autoreleasepool { setgid(0); @@ -94,6 +106,7 @@ int main(int argc, const char **argv) { if ((chdir("/")) < 0) { printf("ERROR: Not run as root.\n"); } else if ([[NSFileManager defaultManager] removeItemAtPath:PATH error:nil]) { + removeHostsBlock(); if (NSString *error = download()) { fprintf(stderr, "error: %s\n", [error UTF8String]); diff --git a/postrm.mm b/postrm.mm index 6b180a0..6ad1ef2 100644 --- a/postrm.mm +++ b/postrm.mm @@ -1,6 +1,6 @@ /* AFC2 - the original definition of "jailbreak" * Copyright (C) 2014 Jay Freeman (saurik) - * Copyright (C) 2018 - 2021 Cannathea + * Copyright (C) 2018 Cannathea */ /* GNU General Public License, Version 3 {{{ */