-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to string comparisons of file paths to be more robust
- Loading branch information
Showing
5 changed files
with
117 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
#include <spawn.h> | ||
#include "include/cfuncs.h" | ||
#include "include/utility.h" | ||
#import "include/objcutils.h" | ||
|
||
#define _PLIST @"/var/mobile/Library/Preferences/com.kc57.ihideprefs.plist" | ||
#define pref_getValue(key) [[NSDictionary dictionaryWithContentsOfFile:_PLIST] valueForKey:key] | ||
|
@@ -87,98 +88,11 @@ static NSString *nsNotificationString = @"com.kc57.ihideprefs/settingschanged"; | |
|
||
%hook NSFileManager | ||
- (BOOL)fileExistsAtPath:(NSString *)path { | ||
NSArray *common_paths = [NSArray arrayWithObjects: | ||
@"/.bootstrapped_electra", | ||
@"/.cydia_no_stash", | ||
@"/.installed_unc0ver", | ||
@"/Applications/blackra1n.app", | ||
@"/Applications/Cydia.app", | ||
@"/Applications/FakeCarrier.app", | ||
@"/Applications/Filza.app", | ||
@"/Applications/Icy.app", | ||
@"/Applications/IntelliScreen.app", | ||
@"/Applications/MxTube.app", | ||
@"/Applications/RockApp.app", | ||
@"/Applications/SBSettings.app", | ||
@"/Applications/SBSetttings.app", | ||
@"/Applications/Sileo.app", | ||
@"/Applications/Snoop-itConfig.app", | ||
@"/Applications/TrustMe.app", | ||
@"/Applications/WinterBoard.app", | ||
@"/bin/bash", | ||
@"/bin/sh", | ||
@"/etc/apt", | ||
@"/etc/apt/sources.list.d/electra.list", | ||
@"/etc/apt/sources.list.d/sileo.sources", | ||
@"/etc/apt/undecimus/undecimus.list", | ||
@"/etc/ssh/sshd_config", | ||
@"/jb/amfid_payload.dylib", | ||
@"/jb/jailbreakd.plist", | ||
@"/jb/libjailbreak.dylib", | ||
@"/jb/lzma", | ||
@"/jb/offsets.plist", | ||
@"/Library/MobileSubstrate/CydiaSubstrate.dylib", | ||
@"/Library/MobileSubstrate/DynamicLibraries/Liberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/Veency.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zLiberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zzLiberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zzzLiberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zzzzLiberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zzzzzLiberty.plist", | ||
@"/Library/MobileSubstrate/MobileSubstrate.dylib", | ||
@"/Library/PreferenceBundles/ABypassPrefs.bundle", | ||
@"/Library/PreferenceBundles/FlyJBPrefs.bundle", | ||
@"/Library/PreferenceBundles/LibertyPref.bundle", | ||
@"/Library/PreferenceBundles/ShadowPreferences.bundle", | ||
@"/private/etc/apt", | ||
@"/private/etc/dpkg/origins/debian", | ||
@"/private/etc/ssh/sshd_config", | ||
@"/private/var/cache/apt/", | ||
@"/private/var/lib/apt", | ||
@"/private/var/lib/cydia", | ||
@"/private/var/log/syslog", | ||
@"/private/var/mobile/Library/SBSettings/Themes", | ||
@"/private/var/stash", | ||
@"/private/var/tmp/cydia.log", | ||
@"/private/var/Users/", | ||
@"/System/Library/LaunchDaemons/com.ikey.bbot.plist", | ||
@"/System/Library/LaunchDaemons/[email protected]", | ||
@"/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist", | ||
@"/usr/bin/cycript", | ||
@"/usr/bin/ssh", | ||
@"/usr/bin/sshd", | ||
@"/usr/libexec/cydia", | ||
@"/usr/libexec/cydia/firmware.sh", | ||
@"/usr/libexec/sftp-server", | ||
@"/usr/libexec/ssh-keysign", | ||
@"/usr/lib/libcycript.dylib", | ||
@"/usr/lib/libhooker.dylib", | ||
@"/usr/lib/libjailbreak.dylib", | ||
@"/usr/lib/libsubstitute.dylib", | ||
@"/usr/lib/substrate", | ||
@"/usr/lib/TweakInject", | ||
@"/usr/local/bin/cycript", | ||
@"/usr/sbin/frida-server", | ||
@"/usr/sbin/sshd", | ||
@"/usr/share/jailbreak/injectme.plist", | ||
@"/var/binpack", | ||
@"/var/cache/apt", | ||
@"/var/checkra1n.dmg", | ||
@"/var/lib/apt", | ||
@"/var/lib/cydia", | ||
@"/var/lib/dpkg/info/mobilesubstrate.md5sums", | ||
@"/var/log/apt", | ||
@"/var/log/syslog", | ||
@"/var/tmp/cydia.log", | ||
nil]; | ||
|
||
for(NSString *str in common_paths) { | ||
if ([path isEqualToString:str]) { | ||
NSLog(@"[iHide] Hooked fileExistsAtPath -> %@", str); | ||
NSLog(@"[iHide] Patching fileExistsAtPath return: NO"); | ||
return NO; | ||
} | ||
|
||
if (objc_isKnownBadPath(path)) { | ||
NSLog(@"[iHide] Hooked fileExistsAtPath -> %@", path); | ||
NSLog(@"[iHide] Patching fileExistsAtPath return: NO"); | ||
return NO; | ||
} | ||
|
||
// If we didn't find any file checks we care about, return the original value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
bool objc_isKnownBadPath(NSString *path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#import "../include/objcutils.h" | ||
|
||
bool objc_isKnownBadPath(NSString *path) { | ||
NSArray *bad_paths = [NSArray arrayWithObjects: | ||
@"/.bootstrapped_electra", | ||
@"/.cydia_no_stash", | ||
@"/.installed_unc0ver", | ||
@"/Applications/blackra1n.app", | ||
@"/Applications/Cydia.app", | ||
@"/Applications/FakeCarrier.app", | ||
@"/Applications/Filza.app", | ||
@"/Applications/Icy.app", | ||
@"/Applications/IntelliScreen.app", | ||
@"/Applications/MxTube.app", | ||
@"/Applications/RockApp.app", | ||
@"/Applications/SBSettings.app", | ||
@"/Applications/SBSetttings.app", | ||
@"/Applications/Sileo.app", | ||
@"/Applications/Snoop-itConfig.app", | ||
@"/Applications/TrustMe.app", | ||
@"/Applications/WinterBoard.app", | ||
@"/bin/bash", | ||
@"/bin/sh", | ||
@"/etc/apt", | ||
@"/etc/apt/sources.list.d/electra.list", | ||
@"/etc/apt/sources.list.d/sileo.sources", | ||
@"/etc/apt/undecimus/undecimus.list", | ||
@"/etc/ssh/sshd_config", | ||
@"/jb/amfid_payload.dylib", | ||
@"/jb/jailbreakd.plist", | ||
@"/jb/libjailbreak.dylib", | ||
@"/jb/lzma", | ||
@"/jb/offsets.plist", | ||
@"/Library/MobileSubstrate/CydiaSubstrate.dylib", | ||
@"/Library/MobileSubstrate/DynamicLibraries/Liberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/Veency.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zLiberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zzLiberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zzzLiberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zzzzLiberty.plist", | ||
@"/Library/MobileSubstrate/DynamicLibraries/zzzzzLiberty.plist", | ||
@"/Library/MobileSubstrate/MobileSubstrate.dylib", | ||
@"/Library/PreferenceBundles/ABypassPrefs.bundle", | ||
@"/Library/PreferenceBundles/FlyJBPrefs.bundle", | ||
@"/Library/PreferenceBundles/LibertyPref.bundle", | ||
@"/Library/PreferenceBundles/ShadowPreferences.bundle", | ||
@"/private/etc/apt", | ||
@"/private/etc/dpkg/origins/debian", | ||
@"/private/etc/ssh/sshd_config", | ||
@"/private/var/cache/apt", | ||
@"/private/var/lib/apt", | ||
@"/private/var/lib/cydia", | ||
@"/private/var/log/syslog", | ||
@"/private/var/mobile/Library/SBSettings/Themes", | ||
@"/private/var/stash", | ||
@"/private/var/tmp/cydia.log", | ||
@"/private/var/Users", | ||
@"/System/Library/LaunchDaemons/com.ikey.bbot.plist", | ||
@"/System/Library/LaunchDaemons/[email protected]", | ||
@"/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist", | ||
@"/usr/bin/cycript", | ||
@"/usr/bin/ssh", | ||
@"/usr/bin/sshd", | ||
@"/usr/libexec/cydia", | ||
@"/usr/libexec/cydia/firmware.sh", | ||
@"/usr/libexec/sftp-server", | ||
@"/usr/libexec/ssh-keysign", | ||
@"/usr/lib/libcycript.dylib", | ||
@"/usr/lib/libhooker.dylib", | ||
@"/usr/lib/libjailbreak.dylib", | ||
@"/usr/lib/libsubstitute.dylib", | ||
@"/usr/lib/substrate", | ||
@"/usr/lib/TweakInject", | ||
@"/usr/local/bin/cycript", | ||
@"/usr/sbin/frida-server", | ||
@"/usr/sbin/sshd", | ||
@"/usr/share/jailbreak/injectme.plist", | ||
@"/var/binpack", | ||
@"/var/cache/apt", | ||
@"/var/checkra1n.dmg", | ||
@"/var/lib/apt", | ||
@"/var/lib/cydia", | ||
@"/var/lib/dpkg/info/mobilesubstrate.md5sums", | ||
@"/var/log/apt", | ||
@"/var/log/syslog", | ||
@"/var/tmp/cydia.log", | ||
nil]; | ||
for(NSString *str in bad_paths) { | ||
NSString *strParam = path; | ||
if([strParam hasSuffix:@"/"]) { | ||
// Remove trailing '/' | ||
strParam = [strParam substringToIndex:[strParam length]-1]; | ||
} | ||
// do a case insensitive comparison against the paths | ||
if( [str caseInsensitiveCompare:strParam] == NSOrderedSame ) { | ||
//NSLog(@"[iHide] Hooked fileExistsAtPath -> %@", str); | ||
//NSLog(@"[iHide] Patching fileExistsAtPath return: NO"); | ||
return true; | ||
} | ||
} | ||
|
||
// default return if we don't match any paths | ||
return false; | ||
|
||
} |