├── Makefile ├── Tweak.xm ├── WFLoggerFix.plist ├── control ├── layout └── DEBIAN │ └── postinst └── wfloggerfixprefs ├── Makefile ├── Resources ├── Info.plist └── Root.plist ├── WFLFRootListController.h ├── WFLFRootListController.m └── entry.plist /Makefile: -------------------------------------------------------------------------------- 1 | ARCHS = arm64 arm64e 2 | 3 | include $(THEOS)/makefiles/common.mk 4 | 5 | TWEAK_NAME = WFLoggerFix 6 | WFLoggerFix_FILES = Tweak.xm 7 | 8 | include $(THEOS_MAKE_PATH)/tweak.mk 9 | 10 | SUBPROJECTS += wfloggerfixprefs 11 | include $(THEOS_MAKE_PATH)/aggregate.mk -------------------------------------------------------------------------------- /Tweak.xm: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #import 5 | 6 | extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void); 7 | 8 | bool enable_log = false; 9 | 10 | void prefchanged_handler() { 11 | NSDictionary *prefs = [NSDictionary dictionaryWithContentsOfFile:@"/private/var/mobile/Library/Preferences/in.net.mario.tweak.wfloggerfixprefs.plist"]; 12 | if (prefs) { 13 | NSValue *value = [prefs objectForKey:@"enablelog"]; 14 | if (value) enable_log = [value boolValue]; 15 | } 16 | } 17 | 18 | kern_return_t get_vm_protection_64(mach_port_t port, vm_address_t address, vm_prot_t *outprot) { 19 | if (address <= 0xFFFFFFFF) return KERN_INVALID_ADDRESS; 20 | vm_size_t size; 21 | vm_region_basic_info_data_t info; 22 | memory_object_name_t object; 23 | mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT_64; 24 | kern_return_t err = vm_region_64(port, &address, &size, VM_REGION_BASIC_INFO_64, (vm_region_info_t)&info, &info_count, &object); 25 | if (err == KERN_SUCCESS && outprot) *outprot = info.protection; 26 | return err; 27 | } 28 | 29 | int get_char_type(char c) { 30 | char p, *pp = "psPS@"; 31 | while ((p = *(pp++))) if (c == p) return 3; 32 | pp = "*acdefginouxACDEFGOUX"; 33 | while ((p = *(pp++))) if (c == p) return 2; 34 | pp = " .-+#$0123456789hjlqtzL"; 35 | while ((p = *(pp++))) if (c == p) return 1; 36 | return 0; 37 | } 38 | 39 | bool check_format_with_arguments(char *format, va_list ap) { 40 | bool is_flag = false; 41 | void *arg; 42 | vm_prot_t prot; 43 | for (char *ptr = format; *ptr != '\0'; ptr++) { 44 | if (*ptr == '%') { 45 | is_flag = !is_flag; 46 | continue; 47 | } 48 | if (!is_flag) continue; 49 | int char_type = get_char_type(*ptr); 50 | switch (char_type) { 51 | case 3: 52 | arg = va_arg(ap, void *); 53 | is_flag = false; 54 | if (get_vm_protection_64(mach_task_self(), (vm_address_t)arg, &prot) == KERN_SUCCESS && prot & VM_PROT_READ) continue; 55 | return false; 56 | case 1: 57 | if (*ptr == '$') return false; 58 | continue; 59 | case 2: 60 | arg = va_arg(ap, void *); 61 | case 0: 62 | is_flag = false; 63 | continue; 64 | } 65 | } 66 | return true; 67 | } 68 | 69 | void (*orig_WFLogger__WFLog_message_)(id, SEL, int, char *, ...); 70 | void mod_WFLogger__WFLog_message_(id self, SEL _cmd, int level, char *message, ...) { 71 | if (!enable_log) return; 72 | if (!message || !strlen(message)) { 73 | orig_WFLogger__WFLog_message_(self, _cmd, level, "(null)"); 74 | return; 75 | } 76 | 77 | va_list ap; 78 | va_start(ap, message); 79 | if (!check_format_with_arguments(message, ap)) { 80 | orig_WFLogger__WFLog_message_(self, _cmd, level, "%s", message); 81 | return; 82 | } 83 | va_end(ap); 84 | 85 | va_start(ap, message); 86 | NSString *formatted = [[NSString alloc] initWithFormat:@(message) locale:0 arguments:ap]; 87 | va_end(ap); 88 | orig_WFLogger__WFLog_message_(self, _cmd, level, "%@", formatted); 89 | [formatted release]; 90 | } 91 | 92 | %ctor { 93 | prefchanged_handler(); 94 | CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), NULL, (CFNotificationCallback)prefchanged_handler, CFSTR("in.net.mario.tweak.wfloggerfixprefs"), NULL, CFNotificationSuspensionBehaviorCoalesce); 95 | 96 | MSHookMessageEx(%c(WFLogger), @selector(WFLog:message:), (IMP)&mod_WFLogger__WFLog_message_, (IMP *)&orig_WFLogger__WFLog_message_); 97 | } 98 | -------------------------------------------------------------------------------- /WFLoggerFix.plist: -------------------------------------------------------------------------------- 1 | { 2 | Filter = { 3 | Executables = ( 4 | wifid 5 | ); 6 | }; 7 | } -------------------------------------------------------------------------------- /control: -------------------------------------------------------------------------------- 1 | Package: in.net.mario.tweak.wfloggerfix 2 | Name: WiFiNameBugFix 3 | Depends: mobilesubstrate 4 | Version: 0.0.3 5 | Architecture: iphoneos-arm 6 | Description: Fix for WiFi name bug found in June 2021 7 | Maintainer: Mario Cheung 8 | Author: Mario Cheung 9 | Section: Tweaks 10 | -------------------------------------------------------------------------------- /layout/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | killall wifid 3 | -------------------------------------------------------------------------------- /wfloggerfixprefs/Makefile: -------------------------------------------------------------------------------- 1 | ARCHS = arm64 arm64e 2 | include $(THEOS)/makefiles/common.mk 3 | 4 | BUNDLE_NAME = WFLoggerFixPref 5 | WFLoggerFixPref_FILES = WFLFRootListController.m 6 | WFLoggerFixPref_INSTALL_PATH = /Library/PreferenceBundles 7 | WFLoggerFixPref_FRAMEWORKS = UIKit 8 | WFLoggerFixPref_PRIVATE_FRAMEWORKS = Preferences 9 | 10 | include $(THEOS_MAKE_PATH)/bundle.mk 11 | 12 | internal-stage:: 13 | $(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END) 14 | $(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/WFLoggerFixPref.plist$(ECHO_END) 15 | -------------------------------------------------------------------------------- /wfloggerfixprefs/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | WFLoggerFixPref 9 | CFBundleIdentifier 10 | in.net.mario.tweak.wfloggerfixprefs 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | NSPrincipalClass 22 | WFLFRootListController 23 | 24 | 25 | -------------------------------------------------------------------------------- /wfloggerfixprefs/Resources/Root.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | items 6 | 7 | 8 | cell 9 | PSGroupCell 10 | footerText 11 | Keep WFLogger disabled for best protection. 12 | Note: With WFLogger enabled I will try my best to protect you from crashing but there's still a chance of crash with malformed names. 13 | label 14 | For Power Users 15 | 16 | 17 | cell 18 | PSSwitchCell 19 | default 20 | 21 | defaults 22 | in.net.mario.tweak.wfloggerfixprefs 23 | key 24 | enablelog 25 | label 26 | Enable WFLogger 27 | 28 | 29 | action 30 | wifidNotify 31 | cell 32 | PSButtonCell 33 | label 34 | Apply Change 35 | 36 | 37 | title 38 | WiFiNameBugFix 39 | 40 | 41 | -------------------------------------------------------------------------------- /wfloggerfixprefs/WFLFRootListController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | extern CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void); 5 | 6 | @interface WFLFRootListController : PSListController 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /wfloggerfixprefs/WFLFRootListController.m: -------------------------------------------------------------------------------- 1 | #include "WFLFRootListController.h" 2 | 3 | @implementation WFLFRootListController 4 | 5 | - (NSArray *)specifiers { 6 | if (!_specifiers) { 7 | _specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain]; 8 | } 9 | 10 | return _specifiers; 11 | } 12 | 13 | - (void)wifidNotify { 14 | CFNotificationCenterPostNotification(CFNotificationCenterGetDistributedCenter(), CFSTR("in.net.mario.tweak.wfloggerfixprefs"), NULL, NULL, true); 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /wfloggerfixprefs/entry.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | entry 6 | 7 | bundle 8 | WFLoggerFixPref 9 | cell 10 | PSLinkCell 11 | detail 12 | WFLFRootListController 13 | isController 14 | 15 | label 16 | WiFiNameBugFix 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------