├── .gitignore ├── Xgress.plist ├── control ├── Makefile ├── LICENSE └── Tweak.mm /.gitignore: -------------------------------------------------------------------------------- 1 | .theos 2 | obj 3 | packages 4 | *.swp 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /Xgress.plist: -------------------------------------------------------------------------------- 1 | { Filter = { Bundles = ( "com.google.ingress" ); }; } 2 | -------------------------------------------------------------------------------- /control: -------------------------------------------------------------------------------- 1 | Package: me.qusic.xgress 2 | Name: Xgress 3 | Version: 2 4 | Description: Play Ingress on Jailbroken Devices 5 | Section: Tweaks 6 | Depends: mobilesubstrate 7 | Priority: optional 8 | Tag: purpose::extension 9 | Architecture: iphoneos-arm 10 | Author: Qusic 11 | Maintainer: Qusic 12 | Sponsor: Qusic 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TWEAK_NAME = Xgress 2 | Xgress_FILES = Tweak.mm 3 | 4 | export TARGET = iphone:clang 5 | export ARCHS = armv7 arm64 6 | export TARGET_IPHONEOS_DEPLOYMENT_VERSION = 6.0 7 | export ADDITIONAL_OBJCFLAGS = -fobjc-arc -fvisibility=hidden 8 | export INSTALL_TARGET_PROCESSES = Ingress 9 | 10 | include $(THEOS)/makefiles/common.mk 11 | include $(THEOS_MAKE_PATH)/tweak.mk 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Qusic 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Tweak.mm: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | static NSArray *NotAllowedPathPrefixes; 5 | 6 | static BOOL allowAccess(NSString *filename) { 7 | if ([filename hasPrefix:@"/private"]) { 8 | filename = [filename substringFromIndex:@"/private".length]; 9 | } 10 | if (filename.length == 0) { 11 | return YES; 12 | } 13 | for (NSString *prefix in NotAllowedPathPrefixes) { 14 | if ([filename hasPrefix:prefix]) { 15 | return NO; 16 | } 17 | } 18 | return YES; 19 | } 20 | 21 | static int (*original_stat)(const char *filename, struct stat *result); 22 | static int optimized_stat(const char *filename, struct stat *result) { 23 | if (!allowAccess([NSString stringWithUTF8String:filename])) { 24 | filename = ""; 25 | } 26 | return original_stat(filename, result); 27 | } 28 | 29 | static int (*original_lstat)(const char *filename, struct stat *result); 30 | static int optimized_lstat(const char *filename, struct stat *result) { 31 | if (!allowAccess([NSString stringWithUTF8String:filename])) { 32 | filename = ""; 33 | } 34 | return original_lstat(filename, result); 35 | } 36 | 37 | static FILE *(*original_fopen)(const char *filename, const char *mode); 38 | static FILE *optimized_fopen(const char *filename, const char *mode) { 39 | if (!allowAccess([NSString stringWithUTF8String:filename])) { 40 | filename = ""; 41 | } 42 | return original_fopen(filename, mode); 43 | } 44 | 45 | static void __attribute__((constructor)) constructor() { 46 | @autoreleasepool { 47 | NotAllowedPathPrefixes = @[ 48 | @"/bin", 49 | @"/usr/bin", 50 | @"/usr/sbin", 51 | @"/usr/libexec", 52 | @"/etc/passwd", 53 | @"/etc/ssh", 54 | @"/var/log", 55 | @"/var/tmp", 56 | @"/Applications", 57 | @"/Library/MobileSubstrate", 58 | @"/System/Library/LaunchDaemons" 59 | ]; 60 | MSHookFunction((int *)MSFindSymbol(NULL, "_stat"), (int *)optimized_stat, (int **)&original_stat); 61 | MSHookFunction((int *)MSFindSymbol(NULL, "_lstat"), (int *)optimized_lstat, (int **)&original_lstat); 62 | MSHookFunction((FILE **)MSFindSymbol(NULL, "_fopen"), (FILE **)optimized_fopen, (FILE ***)&original_fopen); 63 | } 64 | } 65 | --------------------------------------------------------------------------------