├── .gitignore ├── .gitmodules ├── FLEXLoader.plist ├── Makefile ├── README.md ├── Tweak.xm ├── build_dylib.sh ├── control └── layout └── Library ├── Application Support └── FLEXLoader │ └── libFLEX.dylib └── PreferenceLoader └── Preferences ├── FLEXLoader.plist ├── XCode.png ├── XCode@2x.png └── XCode@3x.png /.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | obj 3 | *.deb 4 | .theos/ 5 | .DS_Store 6 | 7 | src/ 8 | bin/ 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "FLEX"] 2 | path = FLEX 3 | url = https://github.com/Flipboard/FLEX.git 4 | -------------------------------------------------------------------------------- /FLEXLoader.plist: -------------------------------------------------------------------------------- 1 | { Filter = { Bundles = ( "com.apple.UIKit" ); }; } 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | THEOS_DEVICE_IP = localhost 2 | THEOS_DEVICE_PORT = 2222 3 | 4 | include $(THEOS)/makefiles/common.mk 5 | 6 | TWEAK_NAME = FLEXLoader 7 | FLEXLoader_FILES = Tweak.xm 8 | 9 | include $(THEOS_MAKE_PATH)/tweak.mk 10 | 11 | before-package:: 12 | @echo "Run FLEX dylib build script..." 13 | ./build_dylib.sh 14 | 15 | after-install:: 16 | install.exec "killall -9 SpringBoard" 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FLEX iOS Jailbreak Tweak 2 | 3 | FLEXLoader 可以在越狱设备上动态加载 libFLEX.dylib 到任意应用中,以使用 FLEX 进行应用内调试。 4 | 5 | 关于 FLEX 可以参考[它的项目主页](https://github.com/Flipboard/FLEX)。 6 | 7 | 关于本项目更详细的内容,可以参考[我的这篇博客](http://swiftyper.com/2017/06/04/inspect-third-party-app-using-flexloader/)。 8 | 9 | ## 安装 10 | 11 | FLEXLoader 已经提交 Cydia 市场审核,审核通过后可以直接从 Cydia 中进行下载安装。 12 | 13 | ### 手动安装 14 | 15 | 将本项目 clone 到本地,修改 Makefile 中的设备 IP 和 PORT,然后执行 `make package install` 即可。 16 | 17 | ## 使用 18 | 19 | 在系统设置界面中找到 FLEXLoader,选择要你想要调试的程序打开开关。 20 | 21 | 启动对应的应用,就可以在应用中看到调试窗口了。 22 | 23 | ## 效果 24 | 25 | ![](http://7xqonv.com1.z0.glb.clouddn.com/inspect-third-party-app-using-flexloader-pic-2-1.png) 26 | 27 | ## 公众号 28 | 29 | 如果你对本项目有兴趣,可以关注我的公众号。 30 | 31 | ![](http://7xqonv.com1.z0.glb.clouddn.com/offical_wechat_account_qrcode.jpg) 32 | -------------------------------------------------------------------------------- /Tweak.xm: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | @interface FLEXManager 6 | 7 | + (instancetype)sharedManager; 8 | - (void)showExplorer; 9 | 10 | @end 11 | 12 | 13 | @interface FLEXLoader: NSObject 14 | @end 15 | 16 | @implementation FLEXLoader 17 | 18 | + (instancetype)sharedInstance { 19 | static dispatch_once_t onceToken; 20 | static FLEXLoader *loader; 21 | dispatch_once(&onceToken, ^{ 22 | loader = [[FLEXLoader alloc] init]; 23 | }); 24 | 25 | return loader; 26 | } 27 | 28 | - (void)show { 29 | [[objc_getClass("FLEXManager") sharedManager] showExplorer]; 30 | } 31 | 32 | @end 33 | 34 | %ctor { 35 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 36 | 37 | NSDictionary *pref = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.swiftyper.flexloader.plist"]; 38 | NSString *dylibPath = @"/Library/Application Support/FLEXLoader/libFLEX.dylib"; 39 | 40 | if (![[NSFileManager defaultManager] fileExistsAtPath:dylibPath]) { 41 | NSLog(@"FLEXLoader dylib file not found: %@", dylibPath); 42 | return; 43 | } 44 | 45 | NSString *keyPath = [NSString stringWithFormat:@"FLEXLoaderEnabled-%@", [[NSBundle mainBundle] bundleIdentifier]]; 46 | if ([[pref objectForKey:keyPath] boolValue]) { 47 | void *handle = dlopen([dylibPath UTF8String], RTLD_NOW); 48 | if (handle == NULL) { 49 | char *error = dlerror(); 50 | NSLog(@"Load FLEXLoader dylib fail: %s", error); 51 | return; 52 | } 53 | 54 | [[NSNotificationCenter defaultCenter] addObserver:[FLEXLoader sharedInstance] 55 | selector:@selector(show) 56 | name:UIApplicationDidBecomeActiveNotification 57 | object:nil]; 58 | } 59 | 60 | [pool drain]; 61 | } 62 | -------------------------------------------------------------------------------- /build_dylib.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Cleaning up..." 4 | rm -rf bin/ src/ 5 | 6 | echo "Updating submodules..." 7 | git submodule update --init --recursive 8 | 9 | echo "Copying sources..." 10 | mkdir src/ 11 | find FLEX/Classes -type f \( -name "*.h" -o -name "*.m" \) -exec cp {} src/ \; 12 | 13 | BIN_NAME="libFLEX.dylib" 14 | IOS_VERSION_MIN=7.0 15 | 16 | DEVELOPER_DIR="$(xcode-select -print-path)" 17 | #DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" 18 | SDK_ROOT_OS=$DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk 19 | SDK_ROOT_SIMULATOR=$DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk 20 | 21 | ARCHS="armv7 arm64" 22 | INPUT=$(find src -type f -name "*.m") 23 | 24 | for ARCH in ${ARCHS} 25 | do 26 | DIR=bin/${ARCH} 27 | mkdir -p ${DIR} 28 | echo "Building for ${ARCH}..." 29 | if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; 30 | then 31 | SDK_ROOT=${SDK_ROOT_SIMULATOR} 32 | IOS_VERSION_MIN_FLAG=-mios-simulator-version-min 33 | else 34 | SDK_ROOT=${SDK_ROOT_OS} 35 | IOS_VERSION_MIN_FLAG=-mios-version-min 36 | fi 37 | FRAMEWORKS=${SDK_ROOT}/System/Library/Frameworks/ 38 | INCLUDES=${SDK_ROOT}/usr/include/ 39 | LIBRARIES=${SDK_ROOT}/usr/lib/ 40 | 41 | clang -I${INCLUDES} -F${FRAMEWORKS} -L${LIBRARIES} -Os -dynamiclib -isysroot ${SDK_ROOT} -arch ${ARCH} -fobjc-arc ${IOS_VERSION_MIN_FLAG}=${IOS_VERSION_MIN} -framework Foundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework ImageIO -lz -lsqlite3 ${INPUT} -o ${DIR}/${BIN_NAME} 42 | done 43 | 44 | echo "Creating universal binary..." 45 | FAT_BIN_DIR="bin/universal" 46 | mkdir -p ${FAT_BIN_DIR} 47 | lipo -create bin/**/${BIN_NAME} -output ${FAT_BIN_DIR}/${BIN_NAME} 48 | 49 | echo "Copying dylib..." 50 | DYLIB_PATH="./layout/Library/Application Support/FLEXLoader/" 51 | if [ ! -d "$DYLIB_PATH" ]; then 52 | mkdir -p ./layout/Library/Application\ Support/FLEXLoader/ 53 | fi 54 | 55 | cp -f bin/universal/libFLEX.dylib layout/Library/Application\ Support/FLEXLoader 56 | 57 | echo "Done." 58 | -------------------------------------------------------------------------------- /control: -------------------------------------------------------------------------------- 1 | Package: com.swiftyper.flexloader 2 | Name: FLEXLoader 3 | Depends: mobilesubstrate 4 | Version: 0.0.1 5 | Architecture: iphoneos-arm 6 | Description: An awesome MobileSubstrate tweak! 7 | Maintainer: 小锅 8 | Author: 小锅 9 | Section: Tweaks 10 | -------------------------------------------------------------------------------- /layout/Library/Application Support/FLEXLoader/libFLEX.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buginux/FLEXLoader/9072d3d3e600288eea2d88a1406fd1a426d71578/layout/Library/Application Support/FLEXLoader/libFLEX.dylib -------------------------------------------------------------------------------- /layout/Library/PreferenceLoader/Preferences/FLEXLoader.plist: -------------------------------------------------------------------------------- 1 | entry = { 2 | bundle = AppList; 3 | cell = PSLinkCell; 4 | icon = "/Library/PreferenceLoader/Preferences/XCode.png"; 5 | isController = 1; 6 | label = FLEXLoader; 7 | ALSettingsPath = "/var/mobile/Library/Preferences/com.swiftyper.flexloader.plist"; 8 | ALSettingsKeyPrefix = "FLEXLoaderEnabled-"; 9 | ALChangeNotification = "com.swiftyper.flexloader.settingschanged"; 10 | ALSettingsDefaultValue = 0; 11 | ALSectionDescriptors = ( 12 | 13 | { 14 | title = "User Applications"; 15 | predicate = "(isSystemApplication = FALSE)"; 16 | "cell-class-name" = "ALSwitchCell"; 17 | "icon-size" = 29; 18 | "suppress-hidden-apps" = 1; 19 | 20 | }, 21 | { 22 | title = "System Applications"; 23 | predicate = "(isSystemApplication = TRUE)"; 24 | "cell-class-name" = "ALSwitchCell"; 25 | "icon-size" = 29; 26 | "suppress-hidden-apps" = 1; 27 | "footer-title" = "© buginux create for flexloader"; 28 | } 29 | ); 30 | }; 31 | -------------------------------------------------------------------------------- /layout/Library/PreferenceLoader/Preferences/XCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buginux/FLEXLoader/9072d3d3e600288eea2d88a1406fd1a426d71578/layout/Library/PreferenceLoader/Preferences/XCode.png -------------------------------------------------------------------------------- /layout/Library/PreferenceLoader/Preferences/XCode@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buginux/FLEXLoader/9072d3d3e600288eea2d88a1406fd1a426d71578/layout/Library/PreferenceLoader/Preferences/XCode@2x.png -------------------------------------------------------------------------------- /layout/Library/PreferenceLoader/Preferences/XCode@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buginux/FLEXLoader/9072d3d3e600288eea2d88a1406fd1a426d71578/layout/Library/PreferenceLoader/Preferences/XCode@3x.png --------------------------------------------------------------------------------