Created
September 18, 2012 16:00
-
-
Save jeffniblack/3743914 to your computer and use it in GitHub Desktop.
files check for jailbroken iOS devices
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
static inline int | |
files_check(void) | |
__attribute__((always_inline)); | |
int files_check(void) { | |
struct stat sb; | |
int result = 0; | |
if (stat("/bin/bash", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /bin/bash found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/bin/sh", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /bin/sh found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/usr/sbin/sshd", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /usr/sbin/sshd found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/usr/libexec/ssh-keysign", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /usr/libexec/ssh-keysign found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/etc/ssh/sshd_config", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /etc/ssh/sshd_config found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/Library/MobileSubstrate/MobileSubstrate.dylib", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /Library/MobileSubstrate/MobileSubstrate.dylib found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/Applications/Cydia.app", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /Applications/Cydia.app found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/etc/apt", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /etc/apt found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/var/cache/apt", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /var/cache/apt found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/var/lib/apt", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /var/lib/apt found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/var/lib/cydia", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /var/lib/cydia found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/var/log/syslog", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /var/log/syslog found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
if (stat("/var/tmp/cydia.log", &sb) == 0) { | |
#if TARGET_IPHONE_SIMULATOR | |
NSLog(@"files_check -> /var/tmp/cydia.log found on the simulator!"); | |
#else | |
result = 1; | |
#endif | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment