├── MonkeyApp.xctemplate ├── icon.png ├── TemplateIcon.icns ├── Scripts │ └── quick-resign.sh ├── Config │ └── MDConfig.plist └── TemplateInfo.plist ├── Base.xctemplate ├── TemplateIcon.icns └── TemplateInfo.plist ├── MonkeyPod.xctemplate ├── TemplateIcon.icns ├── ___PACKAGENAMEASIDENTIFIER___.m ├── ___PACKAGENAMEASIDENTIFIER___.podspec └── TemplateInfo.plist ├── Logos Tweak.xctemplate ├── TemplateIcon.icns ├── ___PACKAGENAMEASIDENTIFIER___.mm ├── ___PACKAGENAMEASIDENTIFIER___.xm └── TemplateInfo.plist ├── MonkeyAppMac.xctemplate ├── TemplateIcon.png ├── TemplateIcon@2x.png ├── Cocoa___PACKAGENAMEASIDENTIFIER___.h ├── STL___PACKAGENAMEASIDENTIFIER___Priv.hpp ├── STL___PACKAGENAMEASIDENTIFIER___.hpp ├── STL___PACKAGENAMEASIDENTIFIER___.cpp ├── Cocoa___PACKAGENAMEASIDENTIFIER___.m ├── fishhook │ ├── fishhook.h │ └── fishhook.c ├── AntiAntiDebug │ └── AntiAntiDebug.m └── TemplateInfo.plist ├── Debian Package.xctemplate ├── TemplateIcon.icns └── TemplateInfo.plist ├── MonkeyAppLibrary.xctemplate ├── TemplateIcon.icns ├── Logos │ ├── ___PACKAGENAMEASIDENTIFIER___.mm │ └── ___PACKAGENAMEASIDENTIFIER___.xm ├── Tools │ └── LLDBTools.h ├── ___PACKAGENAMEASIDENTIFIER___.h ├── Config │ ├── MDCycriptManager.h │ ├── MDMethodTrace.h │ ├── MDConfigManager.m │ ├── MDConfigManager.h │ └── MDCycriptManager.m ├── Trace │ ├── OCSelectorTrampolines.h │ ├── selectortramps.mac │ ├── OCMethodTrace.h │ ├── a1a2-selectortramps-arm64.s │ ├── a1a2-selectortramps-arm.s │ ├── a2a3-selectortramps-arm.s │ ├── a1a2-selectortramps-x86_64.s │ ├── a2a3-selectortramps-x86_64.s │ └── a2a3-selectortramps-i386.s ├── ___PACKAGENAMEASIDENTIFIER___.m ├── fishhook │ ├── fishhook.h │ └── fishhook.c └── AntiAntiDebug │ └── AntiAntiDebug.m ├── PreferenceLoader.xctemplate ├── TemplateIcon.icns ├── ___PACKAGENAMEASIDENTIFIER___Icon.png ├── ___PACKAGENAMEASIDENTIFIER___Icon@2x.png ├── TemplateInfo.plist └── ___PACKAGENAMEASIDENTIFIER___.plist ├── CaptainHook Tweak.xctemplate ├── TemplateIcon.icns ├── ___PACKAGENAMEASIDENTIFIER___.plist ├── ___PACKAGENAMEASIDENTIFIER___.mm └── TemplateInfo.plist ├── Command-line Tool.xctemplate ├── TemplateIcon.icns ├── monkeydev.entitlements ├── ___PACKAGENAMEASIDENTIFIER___.xcdatamodeld │ └── ___PACKAGENAMEASIDENTIFIER___.xcdatamodel │ │ └── contents └── TemplateInfo.plist ├── README.md └── LICENSE /MonkeyApp.xctemplate/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/MonkeyApp.xctemplate/icon.png -------------------------------------------------------------------------------- /Base.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/Base.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /MonkeyApp.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/MonkeyApp.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /MonkeyPod.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/MonkeyPod.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /Logos Tweak.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/Logos Tweak.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/TemplateIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/MonkeyAppMac.xctemplate/TemplateIcon.png -------------------------------------------------------------------------------- /Debian Package.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/Debian Package.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/TemplateIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/MonkeyAppMac.xctemplate/TemplateIcon@2x.png -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/MonkeyAppLibrary.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /PreferenceLoader.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/PreferenceLoader.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /CaptainHook Tweak.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/CaptainHook Tweak.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /Command-line Tool.xctemplate/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/Command-line Tool.xctemplate/TemplateIcon.icns -------------------------------------------------------------------------------- /PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon.png -------------------------------------------------------------------------------- /PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripeyd/MonKeyDevPatch/HEAD/PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___Icon@2x.png -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/Cocoa___PACKAGENAMEASIDENTIFIER___.h: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | //___FILEHEADER___ 5 | 6 | #import 7 | 8 | -------------------------------------------------------------------------------- /Logos Tweak.xctemplate/___PACKAGENAMEASIDENTIFIER___.mm: -------------------------------------------------------------------------------- 1 | 2 | // *** DO NOT EDIT THIS FILE! *** 3 | // This file is generated by Logos processing using ___PACKAGENAMEASIDENTIFIER___.xm during each build. 4 | 5 | // Logos by Dustin Howett 6 | // See http://iphonedevwiki.net/index.php/Logos 7 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Logos/___PACKAGENAMEASIDENTIFIER___.mm: -------------------------------------------------------------------------------- 1 | 2 | // *** DO NOT EDIT THIS FILE! *** 3 | // This file is generated by Logos processing using ___PACKAGENAMEASIDENTIFIER___.xm during each build. 4 | 5 | // Logos by Dustin Howett 6 | // See http://iphonedevwiki.net/index.php/Logos 7 | -------------------------------------------------------------------------------- /Command-line Tool.xctemplate/monkeydev.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | platform-application 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/STL___PACKAGENAMEASIDENTIFIER___Priv.hpp: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | /* The classes below are not exported */ 4 | #pragma GCC visibility push(hidden) 5 | 6 | class ___PACKAGENAMEASIDENTIFIER___Priv 7 | { 8 | public: 9 | void HelloWorldPriv(const char *); 10 | }; 11 | 12 | #pragma GCC visibility pop 13 | -------------------------------------------------------------------------------- /CaptainHook Tweak.xctemplate/___PACKAGENAMEASIDENTIFIER___.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Filter 6 | 7 | Bundles 8 | 9 | com.target.bundleid 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/STL___PACKAGENAMEASIDENTIFIER___.hpp: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | #ifndef ___PACKAGENAMEASIDENTIFIER____ 4 | #define ___PACKAGENAMEASIDENTIFIER____ 5 | 6 | /* The classes below are exported */ 7 | #pragma GCC visibility push(default) 8 | 9 | class ___PACKAGENAMEASIDENTIFIER___ 10 | { 11 | public: 12 | void HelloWorld(const char *); 13 | }; 14 | 15 | #pragma GCC visibility pop 16 | #endif 17 | -------------------------------------------------------------------------------- /Command-line Tool.xctemplate/___PACKAGENAMEASIDENTIFIER___.xcdatamodeld/___PACKAGENAMEASIDENTIFIER___.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/STL___PACKAGENAMEASIDENTIFIER___.cpp: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | #include 4 | #include "___PACKAGENAMEASIDENTIFIER___.hpp" 5 | #include "___PACKAGENAMEASIDENTIFIER___Priv.hpp" 6 | 7 | void ___PACKAGENAMEASIDENTIFIER___::HelloWorld(const char * s) 8 | { 9 | ___PACKAGENAMEASIDENTIFIER___Priv *theObj = new ___PACKAGENAMEASIDENTIFIER___Priv; 10 | theObj->HelloWorldPriv(s); 11 | delete theObj; 12 | }; 13 | 14 | void ___PACKAGENAMEASIDENTIFIER___Priv::HelloWorldPriv(const char * s) 15 | { 16 | std::cout << s << std::endl; 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /MonkeyApp.xctemplate/Scripts/quick-resign.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Usage 4 | # Must be an absolute path 5 | 6 | # ./quick-resign.sh [insert] "origin.ipa path" "resign.ipa path" 7 | 8 | INSERT_DYLIB=NO 9 | INPUT_PATH=$1 10 | OUTPUT_PATH=$2 11 | 12 | if [[ $1 == "insert" ]];then 13 | INSERT_DYLIB=YES 14 | INPUT_PATH=$2 15 | OUTPUT_PATH=$3 16 | fi 17 | 18 | if [[ ! $OUTPUT_PATH ]];then 19 | OUTPUT_PATH=$PWD 20 | fi 21 | 22 | cp -rf $INPUT_PATH ../TargetApp/ 23 | cd ../../ 24 | xcodebuild MONKEYDEV_INSERT_DYLIB=$INSERT_DYLIB | xcpretty 25 | cd LatestBuild 26 | ./createIPA.command 27 | cp -rf Target.ipa $OUTPUT_PATH 28 | exit 0 -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Tools/LLDBTools.h: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // LLDBTools.h 5 | // MonkeyDev 6 | // 7 | // Created by AloneMonkey on 2018/3/8. 8 | // Copyright © 2018年 AloneMonkey. All rights reserved. 9 | // 10 | 11 | #import 12 | #import 13 | 14 | //(lldb) po pviews() 15 | 16 | NSString* pvc(void); 17 | 18 | NSString* pviews(void); 19 | 20 | NSString* pactions(vm_address_t address); 21 | 22 | NSString* pblock(vm_address_t address); 23 | 24 | NSString* methods(const char * classname); 25 | 26 | NSString* ivars(vm_address_t address); 27 | 28 | NSString* choose(const char* classname); 29 | 30 | NSString* vmmap(); 31 | -------------------------------------------------------------------------------- /MonkeyPod.xctemplate/___PACKAGENAMEASIDENTIFIER___.m: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // ___FILENAME___ 5 | // ___PACKAGENAME___ 6 | // 7 | // Created by ___FULLUSERNAME___ on ___DATE___. 8 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 9 | // 10 | 11 | #import "___FILEBASENAME___.h" 12 | #import 13 | #import 14 | 15 | CHDeclareClass(CustomViewController) 16 | 17 | CHOptimizedMethod(0, self, NSString*, CustomViewController,getMyName){ 18 | return @"MonkeyDevPod"; 19 | } 20 | 21 | CHConstructor{ 22 | CHLoadLateClass(CustomViewController); 23 | CHClassHook(0, CustomViewController, getMyName); 24 | } 25 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/___PACKAGENAMEASIDENTIFIER___.h: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // ___FILENAME___ 5 | // ___PACKAGENAME___ 6 | // 7 | // Created by ___FULLUSERNAME___ on ___DATE___. 8 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 9 | // 10 | 11 | #import 12 | 13 | #define INSERT_SUCCESS_WELCOME " 🎉!!!congratulations!!!🎉\n👍----------------insert dylib success----------------👍\n" 14 | 15 | @interface CustomViewController 16 | 17 | @property (nonatomic, copy) NSString* newProperty; 18 | 19 | + (void)classMethod; 20 | 21 | - (NSString*)getMyName; 22 | 23 | - (void)newMethod:(NSString*) output; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 测试环境 2 | Intel Core i7 / macOS Version 14.0 (Build 23A344) / Xcode 15.0.1 (22266) (Build 15A507) 3 | 4 | # MonKeyDev Patch 5 | 6 | 先安装官方MonkeyDev,然后替换仓库模版到/opt/MonkeyDev/templates 7 | 8 | 官方安装地址:[https://github.com/AloneMonkey/MonkeyDev ](https://github.com/AloneMonkey/MonkeyDev/wiki)https://github.com/AloneMonkey/MonkeyDev/wiki 9 | 10 | 补丁说明: 11 | - 解决Signing for "xxxxx" requires a development team. Select a development team in the Signing & Capabilities editor. 12 | - 解决Build input files cannot be found: '/usr/lib/libstdc++.dylib', '/usr/lib/libc++.dylib'. Did you forget to declare these files as outputs of any script phases or custom build rules which produce them? 13 | - 解决Executable Path is a Directory 14 | - 解决Unable to install "xxxxx" 15 | - 解决Logos 没自动生成mm Hook代码 16 | - 解决FishHook异常 17 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Config/MDCycriptManager.h: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // MDCycriptManager.h 5 | // MonkeyDev 6 | // 7 | // Created by AloneMonkey on 2018/3/8. 8 | // Copyright © 2018年 AloneMonkey. All rights reserved. 9 | // 10 | 11 | #ifndef __OPTIMIZE__ 12 | 13 | #import 14 | 15 | #define PORT 6666 16 | 17 | @interface MDCycriptManager : NSObject 18 | 19 | + (instancetype)sharedInstance; 20 | 21 | 22 | /** 23 | Download script by config.plist 24 | 25 | @param update Force update of all scripts 26 | */ 27 | -(void)loadCycript:(BOOL) update; 28 | 29 | /** 30 | eval javascript by cycript 31 | 32 | @param cycript javascript string 33 | @param error error happened 34 | @return eval result 35 | */ 36 | -(NSString*)evaluateCycript:(NSString*) cycript error:(NSError **) error; 37 | 38 | @end 39 | 40 | #endif -------------------------------------------------------------------------------- /Logos Tweak.xctemplate/___PACKAGENAMEASIDENTIFIER___.xm: -------------------------------------------------------------------------------- 1 | // See http://iphonedevwiki.net/index.php/Logos 2 | 3 | #if TARGET_OS_SIMULATOR 4 | #error Do not support the simulator, please use the real iPhone Device. 5 | #endif 6 | 7 | #import 8 | 9 | %hook ClassName 10 | 11 | + (id)sharedInstance 12 | { 13 | %log; 14 | 15 | return %orig; 16 | } 17 | 18 | - (void)messageWithNoReturnAndOneArgument:(id)originalArgument 19 | { 20 | %log; 21 | 22 | %orig(originalArgument); 23 | 24 | // or, for exmaple, you could use a custom value instead of the original argument: %orig(customValue); 25 | } 26 | 27 | - (id)messageWithReturnAndNoArguments 28 | { 29 | %log; 30 | 31 | id originalReturnOfMessage = %orig; 32 | 33 | // for example, you could modify the original return value before returning it: [SomeOtherClass doSomethingToThisObject:originalReturnOfMessage]; 34 | 35 | return originalReturnOfMessage; 36 | } 37 | 38 | %end 39 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Config/MDMethodTrace.h: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // MDMethodTrace.h 5 | // MonkeyDev 6 | // 7 | // Created by AloneMonkey on 2017/9/7. 8 | // Copyright © 2017年 AloneMonkey. All rights reserved. 9 | // 10 | 11 | #ifndef MethodTrace_h 12 | #define MethodTrace_h 13 | 14 | #define TRACE_README @"\n📚--------------------OCMethodTrace(Usage)-------------------📚\nhttps://github.com/omxcodec/OCMethodTrace/blob/master/README.md\n📚--------------------OCMethodTrace(Usage)-------------------📚" 15 | 16 | #import 17 | 18 | @interface MDMethodTrace : NSObject 19 | 20 | + (instancetype)sharedInstance; 21 | 22 | - (void)addClassTrace:(NSString *) className; 23 | 24 | - (void)addClassTrace:(NSString *)className methodName:(NSString *)methodName; 25 | 26 | - (void)addClassTrace:(NSString *)className methodList:(NSArray *)methodList; 27 | 28 | @end 29 | 30 | #endif /* MethodTrace_h */ 31 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/OCSelectorTrampolines.h: -------------------------------------------------------------------------------- 1 | /* 2 | * OCSelectorTrampolines.mm 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #import 23 | 24 | FOUNDATION_EXTERN IMP imp_implementationWithSelector(SEL aSel, const char *signature); 25 | FOUNDATION_EXTERN SEL imp_getSelector(IMP anImp); 26 | FOUNDATION_EXTERN BOOL imp_removeSelector(IMP anImp); 27 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Config/MDConfigManager.m: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // MDConfigManager.m 5 | // MonkeyDev 6 | // 7 | // Created by AloneMonkey on 2018/4/24. 8 | // Copyright © 2018年 AloneMonkey. All rights reserved. 9 | // 10 | 11 | #define CONFIG_FILE_NAME @"MDConfig" 12 | 13 | #import "MDConfigManager.h" 14 | 15 | @implementation MDConfigManager{ 16 | NSString* _filepath; 17 | } 18 | 19 | + (instancetype)sharedInstance{ 20 | static MDConfigManager *sharedInstance = nil; 21 | if (!sharedInstance){ 22 | sharedInstance = [[MDConfigManager alloc] init]; 23 | } 24 | return sharedInstance; 25 | } 26 | 27 | - (BOOL)isActive{ 28 | _filepath = [[NSBundle mainBundle] pathForResource:CONFIG_FILE_NAME ofType:@"plist"]; 29 | if(_filepath == nil){ 30 | return NO; 31 | } 32 | return YES; 33 | } 34 | 35 | - (NSDictionary*) readConfigByKey:(NSString*) key{ 36 | if([self isActive]){ 37 | NSDictionary* contentDict = [NSDictionary dictionaryWithContentsOfFile:_filepath]; 38 | if([contentDict.allKeys containsObject:key]){ 39 | return contentDict[key]; 40 | }else{ 41 | return nil; 42 | } 43 | }else{ 44 | return nil; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/Cocoa___PACKAGENAMEASIDENTIFIER___.m: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | //___FILEHEADER___ 5 | 6 | #import "___FILEBASENAME___.h" 7 | #import "substrate.h" 8 | 9 | #warning 以下代码只针对QQ,如果是其它应用的话,需要将下面的代码删除 10 | 11 | @class MQAIOChatViewController; 12 | @class QQMessageRevokeEngine; 13 | 14 | static void (*origin_MQAIOChatViewController_revokeMessages)(MQAIOChatViewController*,SEL,id); 15 | static void new_MQAIOChatViewController_revokeMessages(MQAIOChatViewController* self,SEL _cmd,id arrays){ 16 | 17 | } 18 | 19 | static void (*origin_QQMessageRevokeEngine_handleRecallNotify_isOnline)(QQMessageRevokeEngine*,SEL,void*,BOOL); 20 | static void new_QQMessageRevokeEngine_handleRecallNotify_isOnline(QQMessageRevokeEngine* self,SEL _cmd,void* notify,BOOL isOnline){ 21 | 22 | } 23 | 24 | static void __attribute__((constructor)) initialize(void) { 25 | MSHookMessageEx(objc_getClass("MQAIOChatViewController"), @selector(revokeMessages:), (IMP)&new_MQAIOChatViewController_revokeMessages, (IMP*)&origin_MQAIOChatViewController_revokeMessages); 26 | 27 | MSHookMessageEx(objc_getClass("QQMessageRevokeEngine"), @selector(handleRecallNotify:isOnline:), (IMP)&new_QQMessageRevokeEngine_handleRecallNotify_isOnline, (IMP*)&origin_QQMessageRevokeEngine_handleRecallNotify_isOnline); 28 | } 29 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/selectortramps.mac: -------------------------------------------------------------------------------- 1 | /* 2 | * selectortramps.mac 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifdef __x86_64__ 23 | #define PRELOAD(x,f) movq x@GOTPCREL(%rip), %r10; 24 | #define LABEL_ADDR(x,f) %r10 25 | #define LABEL_VALUE(x,f) (%r10) 26 | #define INIT_PIC(f) 27 | #define END_PIC(f) 28 | #elif __i386__ 29 | #define PRELOAD(x,f) leal x-L0## f ##$pb(%ebx), %eax; 30 | #define LABEL_ADDR(x,f) %eax 31 | #define LABEL_VALUE(x,f) (%eax) 32 | #define INIT_PIC(x) \ 33 | push %ebx; \ 34 | call L0## x ##$pb; \ 35 | L0## x ##$pb:; \ 36 | pop %ebx; 37 | #define END_PIC(x) pop %ebx 38 | #endif 39 | -------------------------------------------------------------------------------- /MonkeyPod.xctemplate/___PACKAGENAMEASIDENTIFIER___.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = "___PACKAGENAME___" #Pod的名字 3 | spec.version = "1.0.0" #版本号 4 | spec.summary = "A example pod for MonkeyDev" 5 | spec.description = <<-DESC #Pod的描述 6 | - A example pod for MonkeyDev 7 | DESC 8 | 9 | spec.homepage = "https://github.com/AloneMonkey/MonkeyDevPod" #Pod的地址 10 | 11 | spec.license = { :type => "BSD", :file => "LICENSE" } #License 12 | spec.author = { "AloneMonkey" => "liupeiqing1993@163.com" } #作者 13 | spec.social_media_url = "http://weibo.com/xiaoqing28" #weibo 14 | spec.platform = :ios, "8.0" #平台、版本 15 | spec.source = { :git => "https://github.com/AloneMonkey/MonkeyPod.git", :tag => spec.version.to_s } #代码的git地址以及tag 16 | spec.source_files = "___PACKAGENAME___/**/*.{h,m}" #本地验证,表示当前目录以及子目录的所有h或m结尾的文件 如果发布到MonkeyPodSpecs需要填写git clone下来的对应的路径 17 | spec.public_header_files = "___PACKAGENAME___/___PACKAGENAME___.h" #需要对外导出的头文件 此处为本地验证 18 | spec.requires_arc = true #ARC 19 | spec.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "NO", "HEADER_SEARCH_PATHS" => "/opt/MonkeyDev/include" } #这个必须有,不要修改 20 | end -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Logos/___PACKAGENAMEASIDENTIFIER___.xm: -------------------------------------------------------------------------------- 1 | // See http://iphonedevwiki.net/index.php/Logos 2 | 3 | #import 4 | 5 | @interface CustomViewController 6 | 7 | @property (nonatomic, copy) NSString* newProperty; 8 | 9 | + (void)classMethod; 10 | 11 | - (NSString*)getMyName; 12 | 13 | - (void)newMethod:(NSString*) output; 14 | 15 | @end 16 | 17 | %hook CustomViewController 18 | 19 | + (void)classMethod 20 | { 21 | %log; 22 | 23 | %orig; 24 | } 25 | 26 | %new 27 | -(void)newMethod:(NSString*) output{ 28 | NSLog(@"This is a new method : %@", output); 29 | } 30 | 31 | %new 32 | - (id)newProperty { 33 | return objc_getAssociatedObject(self, @selector(newProperty)); 34 | } 35 | 36 | %new 37 | - (void)setNewProperty:(id)value { 38 | objc_setAssociatedObject(self, @selector(newProperty), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 39 | } 40 | 41 | - (NSString*)getMyName 42 | { 43 | %log; 44 | 45 | NSString* password = MSHookIvar(self,"_password"); 46 | 47 | NSLog(@"password:%@", password); 48 | 49 | [%c(CustomViewController) classMethod]; 50 | 51 | [self newMethod:@"output"]; 52 | 53 | self.newProperty = @"newProperty"; 54 | 55 | NSLog(@"newProperty : %@", self.newProperty); 56 | 57 | return %orig(); 58 | } 59 | 60 | %end 61 | 62 | 63 | // 64 | // 去掉注释可去除应用BundleId校验 65 | // 替换“逆向App Bundle id” 66 | 67 | //%hook NSBundle 68 | //- (NSString *)bundleIdentifier{ 69 | // NSString *str = @"逆向App Bundle ID"; 70 | // NSArray *address = [NSThread callStackReturnAddresses]; 71 | // NSDictionary *dic = [[NSBundle mainBundle]infoDictionary]; 72 | // [dic setValue:@"逆向App Bundle ID" forKey:@"CFBundleIdentifier"]; 73 | // Dl_info info = {0}; 74 | // if(dladdr((void *)[address[2] longLongValue], &info) == 0) return %orig; 75 | // NSString *path = [NSString stringWithUTF8String:info.dli_fname]; 76 | // if ([path hasPrefix:NSBundle.mainBundle.bundlePath]) { 77 | // NSLog(@"!!!!!!!!!!!!!"); 78 | // return str; 79 | // } else { 80 | // // 二进制是系统或者越狱插件 81 | // NSLog(@"!!!!!!系统!!!!!!"); 82 | // return %orig; 83 | // } 84 | //} 85 | //%end -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/___PACKAGENAMEASIDENTIFIER___.m: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // ___FILENAME___ 5 | // ___PACKAGENAME___ 6 | // 7 | // Created by ___FULLUSERNAME___ on ___DATE___. 8 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 9 | // 10 | 11 | #import "___FILEBASENAME___.h" 12 | #import 13 | #import 14 | #import 15 | #import 16 | 17 | CHConstructor{ 18 | printf(INSERT_SUCCESS_WELCOME); 19 | 20 | [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidFinishLaunchingNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) { 21 | 22 | #ifndef __OPTIMIZE__ 23 | CYListenServer(6666); 24 | 25 | MDCycriptManager* manager = [MDCycriptManager sharedInstance]; 26 | [manager loadCycript:NO]; 27 | 28 | NSError* error; 29 | NSString* result = [manager evaluateCycript:@"UIApp" error:&error]; 30 | NSLog(@"result: %@", result); 31 | if(error.code != 0){ 32 | NSLog(@"error: %@", error.localizedDescription); 33 | } 34 | #endif 35 | 36 | }]; 37 | } 38 | 39 | 40 | CHDeclareClass(CustomViewController) 41 | 42 | #pragma clang diagnostic push 43 | #pragma clang diagnostic ignored "-Wstrict-prototypes" 44 | 45 | //add new method 46 | CHDeclareMethod1(void, CustomViewController, newMethod, NSString*, output){ 47 | NSLog(@"This is a new method : %@", output); 48 | } 49 | 50 | #pragma clang diagnostic pop 51 | 52 | CHOptimizedClassMethod0(self, void, CustomViewController, classMethod){ 53 | NSLog(@"hook class method"); 54 | CHSuper0(CustomViewController, classMethod); 55 | } 56 | 57 | CHOptimizedMethod0(self, NSString*, CustomViewController, getMyName){ 58 | //get origin value 59 | NSString* originName = CHSuper(0, CustomViewController, getMyName); 60 | 61 | NSLog(@"origin name is:%@",originName); 62 | 63 | //get property 64 | NSString* password = CHIvar(self,_password,__strong NSString*); 65 | 66 | NSLog(@"password is %@",password); 67 | 68 | [self newMethod:@"output"]; 69 | 70 | //set new property 71 | self.newProperty = @"newProperty"; 72 | 73 | NSLog(@"newProperty : %@", self.newProperty); 74 | 75 | //change the value 76 | return @"___FULLUSERNAME___"; 77 | 78 | } 79 | 80 | //add new property 81 | CHPropertyRetainNonatomic(CustomViewController, NSString*, newProperty, setNewProperty); 82 | 83 | CHConstructor{ 84 | CHLoadLateClass(CustomViewController); 85 | CHClassHook0(CustomViewController, getMyName); 86 | CHClassHook0(CustomViewController, classMethod); 87 | 88 | CHHook0(CustomViewController, newProperty); 89 | CHHook1(CustomViewController, setNewProperty); 90 | } 91 | 92 | -------------------------------------------------------------------------------- /PreferenceLoader.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.monkey.monkeydev.preferenceLoader 9 | Options 10 | 11 | 12 | SortOrder 13 | 2 14 | Default 15 | false 16 | NotPersisted 17 | 18 | Identifier 19 | includePreferenceLoaderSimple 20 | Name 21 | Include Simple PreferenceLoader 22 | Description 23 | Indicates whether a Simple PreferenceLoader (non-bundle) is included. 24 | Type 25 | checkbox 26 | Units 27 | 28 | true 29 | 30 | 31 | Definitions 32 | 33 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___.plist 34 | 35 | Group 36 | 37 | Package 38 | Library 39 | PreferenceLoader 40 | Preferences 41 | 42 | Path 43 | ___PACKAGENAMEASIDENTIFIER___.plist 44 | 45 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___Icon.png 46 | 47 | Group 48 | 49 | Package 50 | Library 51 | PreferenceLoader 52 | Preferences 53 | 54 | Path 55 | ___PACKAGENAMEASIDENTIFIER___Icon.png 56 | 57 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___Icon@2x.png 58 | 59 | Group 60 | 61 | Package 62 | Library 63 | PreferenceLoader 64 | Preferences 65 | 66 | Path 67 | ___PACKAGENAMEASIDENTIFIER___Icon@2x.png 68 | 69 | 70 | Nodes 71 | 72 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___.plist 73 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___Icon.png 74 | Package/Library/PreferenceLoader/Preferences/___PACKAGENAMEASIDENTIFIER___Icon@2x.png 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/OCMethodTrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * OCMethodTrace.h 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #import 23 | 24 | // 方法跟踪条件block 25 | // @param sel 方法名 26 | typedef BOOL (^OMTConditionBlock)(SEL sel); 27 | 28 | // 方法调用前会调用该block 29 | // @param target 跟踪目标对象 30 | // @param cls 调用方法所在的类(可以是target所在的类,也可以是target的父类) 31 | // @param sel 方法名 32 | // @param args 参数列表 33 | // @param deep 调用层次 34 | typedef void (^OMTBeforeBlock)(id target, Class cls, SEL sel, NSArray *args, int deep); 35 | 36 | // 方法调用后会调用该block 37 | // @param target 跟踪目标对象 38 | // @param cls 调用方法所在的类(可以是target所在的类,也可以是target的父类) 39 | // @param sel 方法名 40 | // @param ret 返回值 41 | // @param deep 调用层次 42 | // @param interval 执行方法的ms耗时 43 | typedef void (^OMTAfterBlock)(id target, Class cls, SEL sel, id ret, int deep, NSTimeInterval interval); 44 | 45 | // target位置 46 | typedef NS_ENUM(NSUInteger, OMTTargetPosition) { 47 | OMTTargetPositionBeforeSelf = 0, // before-调用者self 48 | OMTTargetPositionBeforeArgument, // before-参数 49 | OMTTargetPositionAfterSelf, // after-调用者self 50 | OMTTargetPositionAfterReturnValue, // after-返回值 51 | OMTTargetPositionMax, 52 | }; 53 | 54 | // 日志级别 55 | typedef NS_ENUM(NSUInteger, OMTLogLevel) { 56 | OMTLogLevelError = 0, 57 | OMTLogLevelDebug, 58 | OMTLogLevelMax, 59 | }; 60 | 61 | @protocol OCMethodTraceDelegate 62 | 63 | @optional 64 | // 获取target的description回调 65 | - (NSString *)descriptionWithTarget:(id)target class:(Class)cls selector:(SEL)sel targetPosition:(OMTTargetPosition)targetPosition; 66 | // 日志回调 67 | - (void)log:(OMTLogLevel)level format:(NSString *)format, ... NS_FORMAT_FUNCTION(2,3); 68 | 69 | @end 70 | 71 | @interface OCMethodTrace : NSObject 72 | 73 | @property (nonatomic, assign) BOOL disableTrace; // 屏蔽before和after调用,hook完成后默认打开 74 | @property (nonatomic, weak) id delegate; // 回调 75 | @property (nonatomic, assign) OMTLogLevel logLevel; // 日志级别,默认OMTLogLevelDebug 76 | 77 | + (OCMethodTrace *)sharedInstance; 78 | 79 | // 跟踪打印目标(实例或类)方法调用 80 | // @param cls 跟踪打印目标类 81 | // @param condition 判断是否跟踪方法的block 82 | // @param before 被跟踪的方法调用前会调用该block 83 | // @param after 被跟踪的方法调用后会调用该block 84 | - (void)traceMethodWithClass:(Class)cls 85 | condition:(OMTConditionBlock)condition 86 | before:(OMTBeforeBlock)before 87 | after:(OMTAfterBlock)after; 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/fishhook/fishhook.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013, Facebook, Inc. 2 | // All rights reserved. 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are met: 5 | // * Redistributions of source code must retain the above copyright notice, 6 | // this list of conditions and the following disclaimer. 7 | // * Redistributions in binary form must reproduce the above copyright notice, 8 | // this list of conditions and the following disclaimer in the documentation 9 | // and/or other materials provided with the distribution. 10 | // * Neither the name Facebook nor the names of its contributors may be used to 11 | // endorse or promote products derived from this software without specific 12 | // prior written permission. 13 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | #ifndef fishhook_h 25 | #define fishhook_h 26 | 27 | #include 28 | #include 29 | 30 | #if !defined(FISHHOOK_EXPORT) 31 | #define FISHHOOK_VISIBILITY __attribute__((visibility("hidden"))) 32 | #else 33 | #define FISHHOOK_VISIBILITY __attribute__((visibility("default"))) 34 | #endif 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif //__cplusplus 39 | 40 | /* 41 | * A structure representing a particular intended rebinding from a symbol 42 | * name to its replacement 43 | */ 44 | struct rebinding { 45 | const char *name; 46 | void *replacement; 47 | void **replaced; 48 | }; 49 | 50 | /* 51 | * For each rebinding in rebindings, rebinds references to external, indirect 52 | * symbols with the specified name to instead point at replacement for each 53 | * image in the calling process as well as for all future images that are loaded 54 | * by the process. If rebind_functions is called more than once, the symbols to 55 | * rebind are added to the existing list of rebindings, and if a given symbol 56 | * is rebound more than once, the later rebinding will take precedence. 57 | */ 58 | FISHHOOK_VISIBILITY 59 | int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel); 60 | 61 | /* 62 | * Rebinds as above, but only in the specified image. The header should point 63 | * to the mach-o header, the slide should be the slide offset. Others as above. 64 | */ 65 | FISHHOOK_VISIBILITY 66 | int rebind_symbols_image(void *header, 67 | intptr_t slide, 68 | struct rebinding rebindings[], 69 | size_t rebindings_nel); 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif //__cplusplus 74 | 75 | #endif //fishhook_h 76 | 77 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/fishhook/fishhook.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013, Facebook, Inc. 2 | // All rights reserved. 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are met: 5 | // * Redistributions of source code must retain the above copyright notice, 6 | // this list of conditions and the following disclaimer. 7 | // * Redistributions in binary form must reproduce the above copyright notice, 8 | // this list of conditions and the following disclaimer in the documentation 9 | // and/or other materials provided with the distribution. 10 | // * Neither the name Facebook nor the names of its contributors may be used to 11 | // endorse or promote products derived from this software without specific 12 | // prior written permission. 13 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | #ifndef fishhook_h 25 | #define fishhook_h 26 | 27 | #include 28 | #include 29 | 30 | #if !defined(FISHHOOK_EXPORT) 31 | #define FISHHOOK_VISIBILITY __attribute__((visibility("hidden"))) 32 | #else 33 | #define FISHHOOK_VISIBILITY __attribute__((visibility("default"))) 34 | #endif 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif //__cplusplus 39 | 40 | /* 41 | * A structure representing a particular intended rebinding from a symbol 42 | * name to its replacement 43 | */ 44 | struct rebinding { 45 | const char *name; 46 | void *replacement; 47 | void **replaced; 48 | }; 49 | 50 | /* 51 | * For each rebinding in rebindings, rebinds references to external, indirect 52 | * symbols with the specified name to instead point at replacement for each 53 | * image in the calling process as well as for all future images that are loaded 54 | * by the process. If rebind_functions is called more than once, the symbols to 55 | * rebind are added to the existing list of rebindings, and if a given symbol 56 | * is rebound more than once, the later rebinding will take precedence. 57 | */ 58 | FISHHOOK_VISIBILITY 59 | int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel); 60 | 61 | /* 62 | * Rebinds as above, but only in the specified image. The header should point 63 | * to the mach-o header, the slide should be the slide offset. Others as above. 64 | */ 65 | FISHHOOK_VISIBILITY 66 | int rebind_symbols_image(void *header, 67 | intptr_t slide, 68 | struct rebinding rebindings[], 69 | size_t rebindings_nel); 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif //__cplusplus 74 | 75 | #endif //fishhook_h 76 | 77 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Config/MDConfigManager.h: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // MDConfigManager.h 5 | // MonkeyDev 6 | // 7 | // Created by AloneMonkey on 2018/4/24. 8 | // Copyright © 2018年 AloneMonkey. All rights reserved. 9 | // 10 | 11 | #import 12 | 13 | #define MDCONFIG_CYCRIPT_KEY @"Cycript" 14 | #define MDCONFIG_LOADATLAUNCH_KEY @"LoadAtLaunch" 15 | 16 | #define MDCONFIG_TRACE_KEY @"MethodTrace" 17 | #define MDCONFIG_LOG_LEVEL_KEY @"LogLevel" 18 | #define MDCONFIG_LOG_WHEN_KEY @"LogWhen" 19 | #define MDCONFIG_LOG_REGEX_STRING_KEY @"LogRegexString" // 仅LogWhen=MDTraceLogWhenRegexString有效 20 | #define MDCONFIG_TRACE_FLAG_KEY @"TraceFlag" 21 | #define MDCONFIG_TRACE_OBJECT_KEY @"TraceObject" 22 | #define MDCONFIG_CLASS_REGEX_STRING_KEY @"ClassRegexString" // 仅TraceObject=MDTraceObjectRegexClass有效 23 | #define MDCONFIG_CORE_CLASS_LIST @"CORE_CLASS_LIST" 24 | #define MDCONFIG_USER_CLASS_LIST @"USER_CLASS_LIST" 25 | #define MDCONFIG_TRACE_MODE_KEY @"TraceMode" 26 | #define MDCONFIG_METHOD_WHITE_LIST_KEY @"MethodWhiteList" 27 | #define MDCONFIG_METHOD_BLACK_LIST_KEY @"MethodBlackList" 28 | 29 | // Trace日志级别 30 | typedef NS_ENUM(NSUInteger, MDTraceLogLevel) { 31 | MDTraceLogLeveError = 0, // 错误 32 | MDTraceLogLeveDebug = 1, // 调试 33 | MDTraceLogLeveMax 34 | }; 35 | 36 | // Trace日志输出时机 37 | typedef NS_ENUM(NSUInteger, MDTraceLogWhen) { 38 | MDTraceLogWhenStartup = 0, // 启动即输出日志 39 | MDTraceLogWhenVolume = 1, // 根据音量键控制输出日志(增加音量:输出日志;降低音量:关闭日志;默认时关闭日志) 40 | MDTraceLogWhenRegexString = 2, // 日志包含指定正则字符串才输出日志 41 | MDTraceLogWhenMax 42 | }; 43 | 44 | // Trace控制位(尽量在该处扩展) 45 | typedef NS_OPTIONS(NSUInteger, MDTraceFlag) { 46 | MDTraceFlagDoesNotUseDescription = 1 << 0, // 跳过调用对象description方法,避免不正规的description实现导致递归 47 | MDTraceFlagDumpClassListInfo = 1 << 1, // 打印类列表信息,便于调试 48 | MDTraceFlagDumpClassMethod = 1 << 2, // 打印某个类的方法(不包括父类方法),便于调试 49 | MDTraceFlagDumpSuperClassMethod = 1 << 3, // 打印某个类的父类方法(包括递归父类的方法),便于调试 50 | MDTraceFlagMask = 0xF, 51 | 52 | MDTraceFlagDefault = 0, 53 | }; 54 | 55 | // Trace对象 56 | typedef NS_ENUM(NSUInteger, MDTraceObject) { 57 | // 屏蔽trace所有类 58 | MDTraceObjectNone = 0, 59 | // trace引擎指定类的方法(仅测试验证使用),仅需要考虑CORE_CLASS_LIST 60 | MDTraceObjectCoreClass = 1, 61 | // trace用户指定类的方法,需要考虑USER_CLASS_LIST + "USER_CLASS_LIST和CORE_CLASS_LIST交集" 62 | MDTraceObjectUserClass = 2, 63 | // trace用户指定类 + 正则匹配类的方法,需要考虑USER_CLASS_LIST + "USER_CLASS_LIST和CORE_CLASS_LIST交集" + 64 | // "匹配ClassRegexString的CLASS_LIST和CORE_CLASS_LIST交集" 65 | MDTraceObjectRegexClass = 3, 66 | 67 | MDTraceObjectMax 68 | }; 69 | 70 | // Trace模式 71 | typedef NS_ENUM(NSUInteger, MDTraceMode) { 72 | MDTraceModeOff = 0, // 屏蔽trace方法 73 | MDTraceModeAll = 1, // trace所有方法 74 | MDTraceModeIncludeWhiteList = 2, // trace包含"白名单方法列表"的方法 75 | MDTraceModeExcludeBlackList = 3, // trace排除"黑名单方法列表"的方法 76 | MDTraceModeMax 77 | }; 78 | 79 | @interface MDConfigManager : NSObject 80 | 81 | + (instancetype)sharedInstance; 82 | 83 | - (NSDictionary*)readConfigByKey:(NSString*) key; 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /Debian Package.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.monkey.monkeydev.debianPackage 9 | Targets 10 | 11 | 12 | SharedSettings 13 | 14 | MonkeyDevBuildPackageOnAnyBuild 15 | NO 16 | 17 | 18 | 19 | Nodes 20 | 21 | Package/DEBIAN/control 22 | Package/DEBIAN/control:debianControl 23 | 24 | Definitions 25 | 26 | Package/DEBIAN/control 27 | 28 | Group 29 | 30 | Package 31 | DEBIAN 32 | 33 | 34 | *:debianControl 35 | 36 | Beginning 37 | Package: ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 38 | Name: ___VARIABLE_productName___ 39 | Version: 0.1-1 40 | Description: 41 | End 42 | Conflicts: 43 | Replaces: 44 | Priority: optional 45 | Architecture: iphoneos-arm 46 | Author: ___FULLUSERNAME___ 47 | dev: 48 | Homepage: 49 | Depiction: 50 | Maintainer: 51 | Icon: 52 | 53 | 54 | Package/DEBIAN/preinst 55 | 56 | Group 57 | 58 | Package 59 | DEBIAN 60 | 61 | Beginning 62 | #!/bin/sh 63 | 64 | # This script is executed BEFORE the Debian package is INSTALLED 65 | # For information about this file, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts. 66 | 67 | 68 | Package/DEBIAN/postinst 69 | 70 | Group 71 | 72 | Package 73 | DEBIAN 74 | 75 | Beginning 76 | #!/bin/sh 77 | 78 | # This script is executed AFTER the Debian package is INSTALLED 79 | # For information about this file, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts. 80 | 81 | 82 | Package/DEBIAN/prerm 83 | 84 | Group 85 | 86 | Package 87 | DEBIAN 88 | 89 | Beginning 90 | #!/bin/sh 91 | 92 | # This script is executed BEFORE the Debian package is REMOVED 93 | # For information about this file, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts. 94 | 95 | 96 | Package/DEBIAN/postrm 97 | 98 | Group 99 | 100 | Package 101 | DEBIAN 102 | 103 | Beginning 104 | #!/bin/sh 105 | 106 | # This script is executed AFTER the Debian package is REMOVED 107 | # For information about this file, see http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts. 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /CaptainHook Tweak.xctemplate/___PACKAGENAMEASIDENTIFIER___.mm: -------------------------------------------------------------------------------- 1 | // 2 | // ___FILENAME___ 3 | // ___PACKAGENAME___ 4 | // 5 | // Created by ___FULLUSERNAME___ on ___DATE___. 6 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 7 | // 8 | 9 | // CaptainHook by Ryan Petrich 10 | // see https://github.com/rpetrich/CaptainHook/ 11 | 12 | #if TARGET_OS_SIMULATOR 13 | #error Do not support the simulator, please use the real iPhone Device. 14 | #endif 15 | 16 | #import 17 | #import "CaptainHook/CaptainHook.h" 18 | #include // not required; for examples only 19 | 20 | // Objective-C runtime hooking using CaptainHook: 21 | // 1. declare class using CHDeclareClass() 22 | // 2. load class using CHLoadClass() or CHLoadLateClass() in CHConstructor 23 | // 3. hook method using CHOptimizedMethod() 24 | // 4. register hook using CHHook() in CHConstructor 25 | // 5. (optionally) call old method using CHSuper() 26 | 27 | 28 | @interface ___FILEBASENAMEASIDENTIFIER___ : NSObject 29 | 30 | @end 31 | 32 | @implementation ___FILEBASENAMEASIDENTIFIER___ 33 | 34 | -(id)init 35 | { 36 | if ((self = [super init])) 37 | { 38 | } 39 | 40 | return self; 41 | } 42 | 43 | @end 44 | 45 | 46 | @class ClassToHook; 47 | 48 | CHDeclareClass(ClassToHook); // declare class 49 | 50 | CHOptimizedMethod(0, self, void, ClassToHook, messageName) // hook method (with no arguments and no return value) 51 | { 52 | // write code here ... 53 | 54 | CHSuper(0, ClassToHook, messageName); // call old (original) method 55 | } 56 | 57 | CHOptimizedMethod(2, self, BOOL, ClassToHook, arg1, NSString*, value1, arg2, BOOL, value2) // hook method (with 2 arguments and a return value) 58 | { 59 | // write code here ... 60 | 61 | return CHSuper(2, ClassToHook, arg1, value1, arg2, value2); // call old (original) method and return its return value 62 | } 63 | 64 | static void WillEnterForeground(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) 65 | { 66 | // not required; for example only 67 | } 68 | 69 | static void ExternallyPostedNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) 70 | { 71 | // not required; for example only 72 | } 73 | 74 | CHConstructor // code block that runs immediately upon load 75 | { 76 | @autoreleasepool 77 | { 78 | // listen for local notification (not required; for example only) 79 | CFNotificationCenterRef center = CFNotificationCenterGetLocalCenter(); 80 | CFNotificationCenterAddObserver(center, NULL, WillEnterForeground, CFSTR("UIApplicationWillEnterForegroundNotification"), NULL, CFNotificationSuspensionBehaviorCoalesce); 81 | 82 | // listen for system-side notification (not required; for example only) 83 | // this would be posted using: notify_post("___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.eventname"); 84 | CFNotificationCenterRef darwin = CFNotificationCenterGetDarwinNotifyCenter(); 85 | CFNotificationCenterAddObserver(darwin, NULL, ExternallyPostedNotification, CFSTR("___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___.eventname"), NULL, CFNotificationSuspensionBehaviorCoalesce); 86 | 87 | // CHLoadClass(ClassToHook); // load class (that is "available now") 88 | // CHLoadLateClass(ClassToHook); // load class (that will be "available later") 89 | 90 | CHHook(0, ClassToHook, messageName); // register hook 91 | CHHook(2, ClassToHook, arg1, arg2); // register hook 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /CaptainHook Tweak.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.monkey.monkeydev.captainHookTweak 9 | Concrete 10 | 11 | Description 12 | This template builds a CaptainHook-based Substrate Tweak. 13 | Ancestors 14 | 15 | com.monkey.monkeydev.base 16 | 17 | Targets 18 | 19 | 20 | ProductType 21 | com.apple.product-type.library.dynamic 22 | SharedSettings 23 | 24 | CLANG_ENABLE_OBJC_ARC 25 | YES 26 | HEADER_SEARCH_PATHS 27 | $(MonkeyDevPath)/include $(MonkeyDevTheosPath)/vendor/include/** 28 | GCC_PRECOMPILE_PREFIX_HEADER 29 | YES 30 | GCC_PREFIX_HEADER 31 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 32 | INSTALL_PATH 33 | /Library/MobileSubstrate/DynamicLibraries 34 | DYLIB_CURRENT_VERSION 35 | 1 36 | DYLIB_COMPATIBILITY_VERSION 37 | 1 38 | 39 | BuildPhases 40 | 41 | 42 | Class 43 | Sources 44 | 45 | 46 | Class 47 | Frameworks 48 | 49 | 50 | Class 51 | Headers 52 | 53 | 54 | ShellScript 55 | /opt/MonkeyDev/bin/md --xcbp 56 | ShellPath 57 | /bin/sh 58 | RunOnlyForDeploymentPostprocessing 59 | 60 | Class 61 | ShellScript 62 | 63 | 64 | Frameworks 65 | 66 | Foundation 67 | 68 | 69 | 70 | Nodes 71 | 72 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 73 | ___PACKAGENAMEASIDENTIFIER___.mm 74 | Package/DEBIAN/control:debianControl:section 75 | Package/DEBIAN/control:debianControl:depends 76 | Package/Library/MobileSubstrate/DynamicLibraries/___PACKAGENAMEASIDENTIFIER___.plist 77 | 78 | Definitions 79 | 80 | ___PACKAGENAMEASIDENTIFIER___.mm 81 | 82 | Path 83 | ___PACKAGENAMEASIDENTIFIER___.mm 84 | 85 | Package/Library/MobileSubstrate/DynamicLibraries/___PACKAGENAMEASIDENTIFIER___.plist 86 | 87 | Group 88 | 89 | Package 90 | Library 91 | MobileSubstrate 92 | DynamicLibraries 93 | 94 | Path 95 | ___PACKAGENAMEASIDENTIFIER___.plist 96 | 97 | *:debianControl:section 98 | Section: Tweaks 99 | *:debianControl:depends 100 | Depends: firmware (>= 5.0), mobilesubstrate 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/AntiAntiDebug/AntiAntiDebug.m: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // Created by AloneMonkey on 2016/12/10. 5 | // Copyright © 2017年 Coder. All rights reserved. 6 | // 7 | 8 | #if TARGET_OS_SIMULATOR 9 | #error Do not support the simulator, please use the real iPhone Device. 10 | #endif 11 | 12 | #import "fishhook.h" 13 | #import 14 | #import 15 | 16 | typedef int (*ptrace_ptr_t)(int _request,pid_t _pid, caddr_t _addr,int _data); 17 | typedef void* (*dlsym_ptr_t)(void * __handle, const char* __symbol); 18 | typedef int (*syscall_ptr_t)(int, ...); 19 | typedef int (*sysctl_ptr_t)(int *,u_int, void*, size_t*,void*, size_t); 20 | 21 | 22 | static ptrace_ptr_t orig_ptrace = NULL; 23 | static dlsym_ptr_t orig_dlsym = NULL; 24 | static sysctl_ptr_t orig_sysctl = NULL; 25 | static syscall_ptr_t orig_syscall = NULL; 26 | 27 | int my_ptrace(int _request, pid_t _pid, caddr_t _addr, int _data); 28 | void* my_dlsym(void* __handle, const char* __symbol); 29 | int my_sysctl(int * name, u_int namelen, void * info, size_t * infosize, void * newinfo, size_t newinfosize); 30 | int my_syscall(int code, va_list args); 31 | 32 | int my_ptrace(int _request, pid_t _pid, caddr_t _addr, int _data){ 33 | if(_request != 31){ 34 | return orig_ptrace(_request,_pid,_addr,_data); 35 | } 36 | 37 | NSLog(@"[AntiAntiDebug] - ptrace request is PT_DENY_ATTACH"); 38 | 39 | return 0; 40 | } 41 | 42 | void* my_dlsym(void* __handle, const char* __symbol){ 43 | if(strcmp(__symbol, "ptrace") != 0){ 44 | return orig_dlsym(__handle, __symbol); 45 | } 46 | 47 | NSLog(@"[AntiAntiDebug] - dlsym get ptrace symbol"); 48 | 49 | return my_ptrace; 50 | } 51 | 52 | typedef struct kinfo_proc _kinfo_proc; 53 | 54 | int my_sysctl(int * name, u_int namelen, void * info, size_t * infosize, void * newinfo, size_t newinfosize){ 55 | if(namelen == 4 && name[0] == CTL_KERN && name[1] == KERN_PROC && name[2] == KERN_PROC_PID && info && infosize && ((int)*infosize == sizeof(_kinfo_proc))){ 56 | int ret = orig_sysctl(name, namelen, info, infosize, newinfo, newinfosize); 57 | struct kinfo_proc *info_ptr = (struct kinfo_proc *)info; 58 | if(info_ptr && (info_ptr->kp_proc.p_flag & P_TRACED) != 0){ 59 | NSLog(@"[AntiAntiDebug] - sysctl query trace status."); 60 | info_ptr->kp_proc.p_flag ^= P_TRACED; 61 | if((info_ptr->kp_proc.p_flag & P_TRACED) == 0){ 62 | NSLog(@"trace status reomve success!"); 63 | } 64 | } 65 | return ret; 66 | } 67 | return orig_sysctl(name, namelen, info, infosize, newinfo, newinfosize); 68 | } 69 | 70 | int my_syscall(int code, va_list args){ 71 | int request; 72 | va_list newArgs; 73 | va_copy(newArgs, args); 74 | if(code == 26){ 75 | request = va_arg(args, int); 76 | if(request == 31){ 77 | NSLog(@"[AntiAntiDebug] - syscall call ptrace, and request is PT_DENY_ATTACH"); 78 | return 0; 79 | } 80 | } 81 | return orig_syscall(code, newArgs); 82 | } 83 | 84 | __attribute__((constructor)) static void entry(){ 85 | NSLog(@"[AntiAntiDebug Init]"); 86 | 87 | rebind_symbols((struct rebinding[1]){{"ptrace", my_ptrace, (void*)&orig_ptrace}},1); 88 | 89 | rebind_symbols((struct rebinding[1]){{"dlsym", my_dlsym, (void*)&orig_dlsym}},1); 90 | 91 | //some app will crash with _dyld_debugger_notification 92 | rebind_symbols((struct rebinding[1]){{"sysctl", my_sysctl, (void*)&orig_sysctl}},1); 93 | 94 | // rebind_symbols((struct rebinding[1]){{"syscall", my_syscall, (void*)&orig_syscall}},1); 95 | } 96 | 97 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/a1a2-selectortramps-arm64.s: -------------------------------------------------------------------------------- 1 | /* 2 | * a1a2-selectortramps-arm64.s 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #if __arm64__ 23 | 24 | #include 25 | 26 | .text 27 | 28 | .private_extern __a1a2_selectorTrampHead 29 | .private_extern __a1a2_firstSelectorTramp 30 | .private_extern __a1a2_selectorTrampEnd 31 | 32 | msgSend: 33 | .quad 0 34 | 35 | .align PAGE_MAX_SHIFT 36 | __a1a2_selectorTrampHead: 37 | L_a1a2_selectorTrampHead: 38 | // 1. selector 39 | ldr x1, [x17] // selector -> _cmd 40 | // 2. msgSend 41 | adr x17, L_a1a2_selectorTrampHead 42 | sub x17, x17, #PAGE_MAX_SIZE 43 | ldr x16, [x17] 44 | br x16 // tail call msgSend 45 | 46 | // pad up to TrampolineSelectorPagePair header size 47 | nop 48 | nop 49 | nop 50 | 51 | .macro TrampolineEntry 52 | // load address of trampoline data (one page before this instruction) 53 | adr x17, -PAGE_MAX_SIZE 54 | b L_a1a2_selectorTrampHead 55 | .endmacro 56 | 57 | .macro TrampolineEntryX16 58 | TrampolineEntry 59 | TrampolineEntry 60 | TrampolineEntry 61 | TrampolineEntry 62 | 63 | TrampolineEntry 64 | TrampolineEntry 65 | TrampolineEntry 66 | TrampolineEntry 67 | 68 | TrampolineEntry 69 | TrampolineEntry 70 | TrampolineEntry 71 | TrampolineEntry 72 | 73 | TrampolineEntry 74 | TrampolineEntry 75 | TrampolineEntry 76 | TrampolineEntry 77 | .endmacro 78 | 79 | .macro TrampolineEntryX256 80 | TrampolineEntryX16 81 | TrampolineEntryX16 82 | TrampolineEntryX16 83 | TrampolineEntryX16 84 | 85 | TrampolineEntryX16 86 | TrampolineEntryX16 87 | TrampolineEntryX16 88 | TrampolineEntryX16 89 | 90 | TrampolineEntryX16 91 | TrampolineEntryX16 92 | TrampolineEntryX16 93 | TrampolineEntryX16 94 | 95 | TrampolineEntryX16 96 | TrampolineEntryX16 97 | TrampolineEntryX16 98 | TrampolineEntryX16 99 | .endmacro 100 | 101 | .align 3 102 | .private_extern __a1a2_firstSelectorTramp 103 | __a1a2_firstSelectorTramp: 104 | // 2048-4 trampolines to fill 16K page 105 | TrampolineEntryX256 106 | TrampolineEntryX256 107 | TrampolineEntryX256 108 | TrampolineEntryX256 109 | 110 | TrampolineEntryX256 111 | TrampolineEntryX256 112 | TrampolineEntryX256 113 | 114 | TrampolineEntryX16 115 | TrampolineEntryX16 116 | TrampolineEntryX16 117 | TrampolineEntryX16 118 | 119 | TrampolineEntryX16 120 | TrampolineEntryX16 121 | TrampolineEntryX16 122 | TrampolineEntryX16 123 | 124 | TrampolineEntryX16 125 | TrampolineEntryX16 126 | TrampolineEntryX16 127 | TrampolineEntryX16 128 | 129 | TrampolineEntryX16 130 | TrampolineEntryX16 131 | TrampolineEntryX16 132 | 133 | TrampolineEntry 134 | TrampolineEntry 135 | TrampolineEntry 136 | TrampolineEntry 137 | 138 | TrampolineEntry 139 | TrampolineEntry 140 | TrampolineEntry 141 | TrampolineEntry 142 | 143 | TrampolineEntry 144 | TrampolineEntry 145 | TrampolineEntry 146 | TrampolineEntry 147 | 148 | // TrampolineEntry 149 | // TrampolineEntry 150 | // TrampolineEntry 151 | // TrampolineEntry 152 | 153 | .private_extern __a1a2_selectorTrampEnd 154 | __a1a2_selectorTrampEnd: 155 | 156 | #endif 157 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/AntiAntiDebug/AntiAntiDebug.m: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // AntiAntiDebug.m 5 | // MonkeyDev 6 | // 7 | // Created by AloneMonkey on 2016/12/10. 8 | // Copyright © 2017年 MonkeyDev. All rights reserved. 9 | // 10 | 11 | #if TARGET_OS_SIMULATOR 12 | #error Do not support the simulator, please use the real iPhone Device. 13 | #endif 14 | 15 | #import "fishhook.h" 16 | #import 17 | #import 18 | 19 | typedef int (*ptrace_ptr_t)(int _request,pid_t _pid, caddr_t _addr,int _data); 20 | typedef void* (*dlsym_ptr_t)(void * __handle, const char* __symbol); 21 | typedef int (*syscall_ptr_t)(int, ...); 22 | typedef int (*sysctl_ptr_t)(int *,u_int, void*, size_t*,void*, size_t); 23 | 24 | 25 | static ptrace_ptr_t orig_ptrace = NULL; 26 | static dlsym_ptr_t orig_dlsym = NULL; 27 | static sysctl_ptr_t orig_sysctl = NULL; 28 | static syscall_ptr_t orig_syscall = NULL; 29 | 30 | int my_ptrace(int _request, pid_t _pid, caddr_t _addr, int _data); 31 | void* my_dlsym(void* __handle, const char* __symbol); 32 | int my_sysctl(int * name, u_int namelen, void * info, size_t * infosize, void * newinfo, size_t newinfosize); 33 | int my_syscall(int code, va_list args); 34 | 35 | int my_ptrace(int _request, pid_t _pid, caddr_t _addr, int _data){ 36 | if(_request != 31){ 37 | return orig_ptrace(_request,_pid,_addr,_data); 38 | } 39 | 40 | NSLog(@"[AntiAntiDebug] - ptrace request is PT_DENY_ATTACH"); 41 | 42 | return 0; 43 | } 44 | 45 | void* my_dlsym(void* __handle, const char* __symbol){ 46 | if(strcmp(__symbol, "ptrace") != 0){ 47 | return orig_dlsym(__handle, __symbol); 48 | } 49 | 50 | NSLog(@"[AntiAntiDebug] - dlsym get ptrace symbol"); 51 | 52 | return my_ptrace; 53 | } 54 | 55 | typedef struct kinfo_proc _kinfo_proc; 56 | 57 | int my_sysctl(int * name, u_int namelen, void * info, size_t * infosize, void * newinfo, size_t newinfosize){ 58 | if(namelen == 4 && name[0] == CTL_KERN && name[1] == KERN_PROC && name[2] == KERN_PROC_PID && info && infosize && ((int)*infosize == sizeof(_kinfo_proc))){ 59 | int ret = orig_sysctl(name, namelen, info, infosize, newinfo, newinfosize); 60 | struct kinfo_proc *info_ptr = (struct kinfo_proc *)info; 61 | if(info_ptr && (info_ptr->kp_proc.p_flag & P_TRACED) != 0){ 62 | NSLog(@"[AntiAntiDebug] - sysctl query trace status."); 63 | info_ptr->kp_proc.p_flag ^= P_TRACED; 64 | if((info_ptr->kp_proc.p_flag & P_TRACED) == 0){ 65 | NSLog(@"trace status reomve success!"); 66 | } 67 | } 68 | return ret; 69 | } 70 | return orig_sysctl(name, namelen, info, infosize, newinfo, newinfosize); 71 | } 72 | 73 | int my_syscall(int code, va_list args){ 74 | int request; 75 | va_list newArgs; 76 | va_copy(newArgs, args); 77 | if(code == 26){ 78 | #ifdef __LP64__ 79 | __asm__( 80 | "ldr %w[result], [fp, #0x10]\n" 81 | : [result] "=r" (request) 82 | : 83 | : 84 | ); 85 | #else 86 | request = va_arg(args, int); 87 | #endif 88 | if(request == 31){ 89 | NSLog(@"[AntiAntiDebug] - syscall call ptrace, and request is PT_DENY_ATTACH"); 90 | return 0; 91 | } 92 | } 93 | return orig_syscall(code, newArgs); 94 | } 95 | 96 | __attribute__((constructor)) static void entry(void){ 97 | NSLog(@"[AntiAntiDebug Init]"); 98 | 99 | rebind_symbols((struct rebinding[1]){{"ptrace", my_ptrace, (void*)&orig_ptrace}},1); 100 | 101 | rebind_symbols((struct rebinding[1]){{"dlsym", my_dlsym, (void*)&orig_dlsym}},1); 102 | 103 | //some app will crash with _dyld_debugger_notification 104 | // rebind_symbols((struct rebinding[1]){{"sysctl", my_sysctl, (void*)&orig_sysctl}},1); 105 | 106 | rebind_symbols((struct rebinding[1]){{"syscall", my_syscall, (void*)&orig_syscall}},1); 107 | } 108 | 109 | -------------------------------------------------------------------------------- /MonkeyPod.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.monkey.monkeydev.cocoaTouchFramework 9 | Ancestors 10 | 11 | com.apple.dt.unit.languageChoice 12 | com.apple.dt.unit.frameworkBase 13 | com.apple.dt.unit.iosBase 14 | 15 | Concrete 16 | 17 | Description 18 | This template creates a framework that uses UIKit. 19 | SortOrder 20 | 1 21 | AssociatedTargetSpecification 22 | 23 | PopUpTitle 24 | Embed in Application: 25 | PopUpDescription 26 | The application target that will host this new framework. The application will be set up to link to and embed the new framework. 27 | AllowableProductTypes 28 | 29 | com.apple.product-type.application 30 | com.apple.product-type.application.messages 31 | 32 | AllowablePlatforms 33 | 34 | com.apple.platform.iphoneos 35 | 36 | AssociatedTargetIsDependent 37 | 38 | AssociatedTargetNeedsProductBuildPhaseInjection 39 | 40 | 41 | Options 42 | 43 | 44 | Identifier 45 | hasUnitTests 46 | Name 47 | Include Unit Tests 48 | NotPersisted 49 | 50 | SortOrder 51 | 100 52 | Type 53 | checkbox 54 | Default 55 | true 56 | Units 57 | 58 | true 59 | 60 | Components 61 | 62 | 63 | Identifier 64 | com.apple.dt.unit.cocoaTouchFrameworkUnitTestBundle 65 | Name 66 | ___PACKAGENAME___Tests 67 | 68 | 69 | 70 | 71 | 72 | 73 | Targets 74 | 75 | 76 | TargetIdentifier 77 | com.apple.dt.cocoaTouchLibraryOrFrameworkTarget 78 | SharedSettings 79 | 80 | LD_RUNPATH_SEARCH_PATHS 81 | $(inherited) @executable_path/Frameworks @loader_path/Frameworks 82 | 83 | 84 | 85 | Project 86 | 87 | SharedSettings 88 | 89 | HEADER_SEARCH_PATHS 90 | $(inherited) $(MonkeyDevPath)/include 91 | MonkeyDevPath 92 | /opt/MonkeyDev 93 | IPHONEOS_DEPLOYMENT_TARGET 94 | 8.0 95 | 96 | 97 | Nodes 98 | 99 | ___PACKAGENAMEASIDENTIFIER___.m 100 | ___PACKAGENAMEASIDENTIFIER___.podspec 101 | 102 | Definitions 103 | 104 | ___PACKAGENAMEASIDENTIFIER___.m 105 | 106 | Path 107 | ___PACKAGENAMEASIDENTIFIER___.m 108 | 109 | ___PACKAGENAMEASIDENTIFIER___.podspec 110 | 111 | Path 112 | ___PACKAGENAMEASIDENTIFIER___.podspec 113 | 114 | ___TARGETNAME:c99ExtIdentifier___.h 115 | 116 | TargetIdentifiers 117 | 118 | com.apple.dt.cocoaTouchLibraryOrFrameworkTarget 119 | 120 | BuildAttributes 121 | 122 | Public 123 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/a1a2-selectortramps-arm.s: -------------------------------------------------------------------------------- 1 | /* 2 | * a1a2-selectortramps-arm.s 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #if __arm__ 23 | 24 | #include 25 | #include 26 | 27 | .syntax unified 28 | 29 | .text 30 | 31 | .private_extern __a1a2_selectorTrampHead 32 | .private_extern __a1a2_firstSelectorTramp 33 | .private_extern __a1a2_selectorTrampEnd 34 | 35 | // Trampoline machinery assumes the trampolines are Thumb function pointers 36 | #if !__thumb2__ 37 | # error sorry 38 | #endif 39 | 40 | .thumb 41 | .thumb_func __a1a2_selectorTrampHead 42 | .thumb_func __a1a2_firstSelectorTramp 43 | .thumb_func __a1a2_selectorTrampEnd 44 | 45 | .align PAGE_MAX_SHIFT 46 | __a1a2_selectorTrampHead: 47 | // Trampoline's data is one page before the trampoline text. 48 | // Also correct PC bias of 4 bytes. 49 | // 1. selector 50 | sub r12, #PAGE_MAX_SIZE 51 | ldr r1, [r12, #-4] // selector -> _cmd 52 | // 2. msgSend 53 | mov r12, pc 54 | sub r12, #PAGE_MAX_SIZE 55 | ldr pc, [r12, #-12] // tail call msgSend 56 | // not reached 57 | nop 58 | 59 | // Align trampolines to 8 bytes 60 | .align 3 61 | 62 | .macro TrampolineEntry 63 | mov r12, pc 64 | b __a1a2_selectorTrampHead 65 | .align 3 66 | .endmacro 67 | 68 | .macro TrampolineEntryX16 69 | TrampolineEntry 70 | TrampolineEntry 71 | TrampolineEntry 72 | TrampolineEntry 73 | 74 | TrampolineEntry 75 | TrampolineEntry 76 | TrampolineEntry 77 | TrampolineEntry 78 | 79 | TrampolineEntry 80 | TrampolineEntry 81 | TrampolineEntry 82 | TrampolineEntry 83 | 84 | TrampolineEntry 85 | TrampolineEntry 86 | TrampolineEntry 87 | TrampolineEntry 88 | .endmacro 89 | 90 | .macro TrampolineEntryX256 91 | TrampolineEntryX16 92 | TrampolineEntryX16 93 | TrampolineEntryX16 94 | TrampolineEntryX16 95 | 96 | TrampolineEntryX16 97 | TrampolineEntryX16 98 | TrampolineEntryX16 99 | TrampolineEntryX16 100 | 101 | TrampolineEntryX16 102 | TrampolineEntryX16 103 | TrampolineEntryX16 104 | TrampolineEntryX16 105 | 106 | TrampolineEntryX16 107 | TrampolineEntryX16 108 | TrampolineEntryX16 109 | TrampolineEntryX16 110 | .endmacro 111 | 112 | .private_extern __a1a2_firstSelectorTramp 113 | __a1a2_firstSelectorTramp: 114 | // 2048-3 trampolines to fill 16K page 115 | TrampolineEntryX256 116 | TrampolineEntryX256 117 | TrampolineEntryX256 118 | TrampolineEntryX256 119 | 120 | TrampolineEntryX256 121 | TrampolineEntryX256 122 | TrampolineEntryX256 123 | 124 | TrampolineEntryX16 125 | TrampolineEntryX16 126 | TrampolineEntryX16 127 | TrampolineEntryX16 128 | 129 | TrampolineEntryX16 130 | TrampolineEntryX16 131 | TrampolineEntryX16 132 | TrampolineEntryX16 133 | 134 | TrampolineEntryX16 135 | TrampolineEntryX16 136 | TrampolineEntryX16 137 | TrampolineEntryX16 138 | 139 | TrampolineEntryX16 140 | TrampolineEntryX16 141 | TrampolineEntryX16 142 | 143 | TrampolineEntry 144 | TrampolineEntry 145 | TrampolineEntry 146 | TrampolineEntry 147 | 148 | TrampolineEntry 149 | TrampolineEntry 150 | TrampolineEntry 151 | TrampolineEntry 152 | 153 | TrampolineEntry 154 | TrampolineEntry 155 | TrampolineEntry 156 | TrampolineEntry 157 | 158 | TrampolineEntry 159 | // TrampolineEntry 160 | // TrampolineEntry 161 | // TrampolineEntry 162 | 163 | .private_extern __a1a2_selectorTrampEnd 164 | __a1a2_selectorTrampEnd: 165 | 166 | #endif 167 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/a2a3-selectortramps-arm.s: -------------------------------------------------------------------------------- 1 | /* 2 | * a2a3-selectortramps-arm.s 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #if __arm__ 23 | 24 | #include 25 | #include 26 | 27 | .syntax unified 28 | 29 | .text 30 | 31 | .private_extern __a2a3_selectorTrampHead 32 | .private_extern __a2a3_firstSelectorTramp 33 | .private_extern __a2a3_selectorTrampEnd 34 | 35 | // Trampoline machinery assumes the trampolines are Thumb function pointers 36 | #if !__thumb2__ 37 | # error sorry 38 | #endif 39 | 40 | .thumb 41 | .thumb_func __a2a3_selectorTrampHead 42 | .thumb_func __a2a3_firstSelectorTramp 43 | .thumb_func __a2a3_selectorTrampEnd 44 | 45 | .align PAGE_MAX_SHIFT 46 | __a2a3_selectorTrampHead: 47 | // Trampoline's data is one page before the trampoline text. 48 | // Also correct PC bias of 4 bytes. 49 | // 1. selector 50 | sub r12, #PAGE_MAX_SIZE 51 | ldr r2, [r12, #-4] // _cmd = selector 52 | // 2. msgSend. Can't "ldr r12, msgSend", error: out of range pc-relative fixup value 53 | mov r12, pc 54 | sub r12, #PAGE_MAX_SIZE 55 | ldr pc, [r12, #-12] 56 | // not reached 57 | nop 58 | 59 | // Align trampolines to 8 bytes 60 | .align 3 61 | 62 | .macro TrampolineEntry 63 | mov r12, pc 64 | b __a2a3_selectorTrampHead 65 | .align 3 66 | .endmacro 67 | 68 | .macro TrampolineEntryX16 69 | TrampolineEntry 70 | TrampolineEntry 71 | TrampolineEntry 72 | TrampolineEntry 73 | 74 | TrampolineEntry 75 | TrampolineEntry 76 | TrampolineEntry 77 | TrampolineEntry 78 | 79 | TrampolineEntry 80 | TrampolineEntry 81 | TrampolineEntry 82 | TrampolineEntry 83 | 84 | TrampolineEntry 85 | TrampolineEntry 86 | TrampolineEntry 87 | TrampolineEntry 88 | .endmacro 89 | 90 | .macro TrampolineEntryX256 91 | TrampolineEntryX16 92 | TrampolineEntryX16 93 | TrampolineEntryX16 94 | TrampolineEntryX16 95 | 96 | TrampolineEntryX16 97 | TrampolineEntryX16 98 | TrampolineEntryX16 99 | TrampolineEntryX16 100 | 101 | TrampolineEntryX16 102 | TrampolineEntryX16 103 | TrampolineEntryX16 104 | TrampolineEntryX16 105 | 106 | TrampolineEntryX16 107 | TrampolineEntryX16 108 | TrampolineEntryX16 109 | TrampolineEntryX16 110 | .endmacro 111 | 112 | .private_extern __a2a3_firstSelectorTramp 113 | __a2a3_firstSelectorTramp: 114 | // 2048-2 trampolines to fill 16K page 115 | TrampolineEntryX256 116 | TrampolineEntryX256 117 | TrampolineEntryX256 118 | TrampolineEntryX256 119 | 120 | TrampolineEntryX256 121 | TrampolineEntryX256 122 | TrampolineEntryX256 123 | 124 | TrampolineEntryX16 125 | TrampolineEntryX16 126 | TrampolineEntryX16 127 | TrampolineEntryX16 128 | 129 | TrampolineEntryX16 130 | TrampolineEntryX16 131 | TrampolineEntryX16 132 | TrampolineEntryX16 133 | 134 | TrampolineEntryX16 135 | TrampolineEntryX16 136 | TrampolineEntryX16 137 | TrampolineEntryX16 138 | 139 | TrampolineEntryX16 140 | TrampolineEntryX16 141 | TrampolineEntryX16 142 | 143 | TrampolineEntry 144 | TrampolineEntry 145 | TrampolineEntry 146 | TrampolineEntry 147 | 148 | TrampolineEntry 149 | TrampolineEntry 150 | TrampolineEntry 151 | TrampolineEntry 152 | 153 | TrampolineEntry 154 | TrampolineEntry 155 | TrampolineEntry 156 | TrampolineEntry 157 | 158 | TrampolineEntry 159 | // TrampolineEntry 160 | // TrampolineEntry 161 | // TrampolineEntry 162 | 163 | .private_extern __a2a3_selectorTrampEnd 164 | __a2a3_selectorTrampEnd: 165 | 166 | #endif 167 | -------------------------------------------------------------------------------- /Logos Tweak.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.monkey.monkeydev.logosTweak 9 | Concrete 10 | 11 | Description 12 | This template builds a Logos-based Substrate Tweak. 13 | Ancestors 14 | 15 | com.monkey.monkeydev.base 16 | 17 | Targets 18 | 19 | 20 | ProductType 21 | com.apple.product-type.library.dynamic 22 | SharedSettings 23 | 24 | CLANG_ENABLE_OBJC_ARC 25 | YES 26 | INSTALL_PATH 27 | /Library/MobileSubstrate/DynamicLibraries 28 | DYLIB_CURRENT_VERSION 29 | 1 30 | DYLIB_COMPATIBILITY_VERSION 31 | 1 32 | GCC_PREFIX_HEADER 33 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 34 | GCC_PRECOMPILE_PREFIX_HEADER 35 | YES 36 | 37 | BuildPhases 38 | 39 | 40 | ShellScript 41 | /opt/MonkeyDev/bin/md --xcbp-logos 42 | ShellPath 43 | /bin/sh 44 | RunOnlyForDeploymentPostprocessing 45 | 46 | Class 47 | ShellScript 48 | 49 | 50 | Class 51 | Sources 52 | 53 | 54 | Class 55 | Frameworks 56 | 57 | 58 | Class 59 | Headers 60 | 61 | 62 | ShellScript 63 | /opt/MonkeyDev/bin/md --xcbp 64 | ShellPath 65 | /bin/sh 66 | RunOnlyForDeploymentPostprocessing 67 | 68 | Class 69 | ShellScript 70 | 71 | 72 | Frameworks 73 | 74 | UIKit 75 | Foundation 76 | CydiaSubstrate 77 | 78 | 79 | 80 | Nodes 81 | 82 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 83 | ___PACKAGENAME___-Prefix.pch:objC:importTheosPrefix 84 | ___PACKAGENAMEASIDENTIFIER___.xm 85 | ___PACKAGENAMEASIDENTIFIER___.mm 86 | Package/DEBIAN/control:debianControl:section 87 | Package/DEBIAN/control:debianControl:depends 88 | Package/Library/MobileSubstrate/DynamicLibraries/___PACKAGENAMEASIDENTIFIER___.plist 89 | 90 | Definitions 91 | 92 | ___PACKAGENAMEASIDENTIFIER___.xm 93 | 94 | Path 95 | ___PACKAGENAMEASIDENTIFIER___.xm 96 | 97 | ___PACKAGENAMEASIDENTIFIER___.mm 98 | 99 | Path 100 | ___PACKAGENAMEASIDENTIFIER___.mm 101 | 102 | Package/Library/MobileSubstrate/DynamicLibraries/___PACKAGENAMEASIDENTIFIER___.plist 103 | 104 | Group 105 | 106 | Package 107 | Library 108 | MobileSubstrate 109 | DynamicLibraries 110 | 111 | Beginning 112 | <?xml version="1.0" encoding="UTF-8"?> 113 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 114 | <plist version="1.0"> 115 | <dict> 116 | <key>Filter</key> 117 | <dict> 118 | <key>Bundles</key> 119 | <array> 120 | <string>com.apple.springboard</string> 121 | </array> 122 | </dict> 123 | </dict> 124 | </plist> 125 | 126 | *:debianControl:section 127 | Section: System 128 | *:debianControl:depends 129 | Depends: firmware (>= 5.0), mobilesubstrate 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /MonkeyApp.xctemplate/Config/MDConfig.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MethodTrace 6 | 7 | LogLevel 8 | 0 9 | LogWhen 10 | 0 11 | LogRegexString 12 | 13 | TraceFlag 14 | 2 15 | TraceObject 16 | 0 17 | ClassRegexString 18 | 19 | CORE_CLASS_LIST 20 | 21 | MDConfigManager 22 | 23 | MDMethodTrace 24 | 25 | MDTraceClassInfo 26 | 27 | FastCoder 28 | 29 | NSManagedObject 30 | 31 | NSObject 32 | 33 | NSException 34 | 35 | NSTypesetter 36 | 37 | NSString 38 | 39 | NSCache 40 | 41 | NSPlaceholderString 42 | 43 | __NSCFString 44 | 45 | NSURL 46 | 47 | TraceMode 48 | 0 49 | MethodBlackList 50 | 51 | isKindOfClass: 52 | 53 | 54 | NSFont 55 | 56 | OS_object 57 | 58 | OS_xpc_object 59 | 60 | OS_dispatch_object 61 | 62 | OS_dispatch_queue 63 | 64 | NSSet 65 | 66 | NSOrderedSet 67 | 68 | __NSPlaceholderSet 69 | 70 | __NSPlaceholderOrderedSet 71 | 72 | NSMutableOrderedSet 73 | 74 | NSDictionary 75 | 76 | NSMutableDictionary 77 | 78 | __NSCFDictionary 79 | 80 | __NSDictionaryM 81 | 82 | __NSPlaceholderDictionary 83 | 84 | NSArray 85 | 86 | NSMutableArray 87 | 88 | __NSCFArray 89 | 90 | __NSArrayM 91 | 92 | __NSArrayI 93 | 94 | __NSPlaceholderArray 95 | 96 | NSDate 97 | 98 | __NSDate 99 | 100 | __NSPlaceholderDate 101 | 102 | NSNumber 103 | 104 | NSPlaceholderNumber 105 | 106 | NSPredicate 107 | 108 | NSRecursiveLock 109 | 110 | NSConcreteMapTable 111 | 112 | _UIPointVector 113 | 114 | NSConcreteHashTable 115 | 116 | FBSWorkspace 117 | 118 | FBSSerialQueue 119 | 120 | BSDescriptionBuilder 121 | 122 | FBSSceneImpl 123 | 124 | BSSettings 125 | 126 | FBSWorkspaceClient 127 | 128 | AVAudioSession 129 | 130 | 131 | USER_CLASS_LIST 132 | 133 | BaseMsgContentViewController 134 | 135 | TraceMode 136 | 1 137 | TraceFlag 138 | 0 139 | MethodWhiteList 140 | 141 | MethodBlackList 142 | 143 | 144 | CMessageMgr 145 | 146 | TraceMode 147 | 2 148 | TraceFlag 149 | 0 150 | MethodWhiteList 151 | 152 | AsyncOnAddMsg:MsgWrap: 153 | onRevokeMsg: 154 | 155 | MethodBlackList 156 | 157 | 158 | 159 | 160 | Cycript 161 | 162 | nslog 163 | 164 | LoadAtLaunch 165 | 166 | priority 167 | 0 168 | content 169 | NSLog = function() { var types = 'v', args = [], count = arguments.length; for (var i = 0; i != count; ++i) { types += '@'; args.push(arguments[i]); } new Functor(dlsym(RTLD_DEFAULT, "NSLog"), types).apply(null, args); } 170 | 171 | ms 172 | 173 | LoadAtLaunch 174 | 175 | priority 176 | 1 177 | url 178 | https://raw.githubusercontent.com/AloneMonkey/MDCycript/master/MS.cy 179 | 180 | hook 181 | 182 | LoadAtLaunch 183 | 184 | priority 185 | 2 186 | content 187 | try{ 188 | var oldm = {}; 189 | HookMessage(CustomViewController, @selector(showChangeLog:), function(log) { 190 | NSLog("hooked by cycript!!!"); 191 | return oldm->call(this,log); 192 | }, oldm); 193 | }catch(err){ 194 | NSLog(err.toString()) 195 | } 196 | 197 | md 198 | 199 | LoadAtLaunch 200 | 201 | priority 202 | 3 203 | url 204 | https://raw.githubusercontent.com/AloneMonkey/MDCycript/master/md.cy 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /Base.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Identifier 6 | com.monkey.monkeydev.base 7 | Kind 8 | Xcode.Xcode3.ProjectTemplateUnitKind 9 | Ancestors 10 | 11 | com.apple.dt.unit.iosBase 12 | com.monkey.monkeydev.debianPackage 13 | com.monkey.monkeydev.preferenceLoader 14 | 15 | Targets 16 | 17 | 18 | Name 19 | ___PACKAGENAME___ 20 | SharedSettings 21 | 22 | MonkeyDevClearUiCacheOnInstall 23 | NO 24 | MonkeyDevkillProcessOnInstall 25 | SpringBoard 26 | CODE_SIGN_IDENTITY 27 | 28 | PRODUCT_NAME 29 | $(TARGET_NAME) 30 | MonkeyDevDeviceIP 31 | 127.0.0.1 32 | MonkeyDevDevicePort 33 | 3333 34 | MonkeyDevDevicePassword 35 | alpine 36 | MonkeyDevInstallOnProfiling 37 | YES 38 | MonkeyDevCopyOnBuild 39 | NO 40 | MonkeyDevInstallOnAnyBuild 41 | YES 42 | 43 | 44 | 45 | Platforms 46 | 47 | com.apple.platform.iphoneos 48 | 49 | Project 50 | 51 | SharedSettings 52 | 53 | MonkeyDevTheosPath 54 | /opt/theos 55 | TARGETED_DEVICE_FAMILY 56 | 1,2 57 | GCC_WARN_ABOUT_MISSING_PROTOTYPES 58 | YES 59 | GCC_WARN_UNUSED_VARIABLE 60 | YES 61 | GCC_WARN_ABOUT_RETURN_TYPE 62 | YES 63 | GCC_C_LANGUAGE_STANDARD 64 | gnu99 65 | EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES 66 | *.nib *.lproj *.gch (*) .DS_Store CVS .svn .git .hg *.xcodeproj *.xcode *.pbproj *.pbxproj 67 | OTHER_CFLAGS 68 | -DTHEOS_INSTANCE_NAME="\"___PACKAGENAME___\"" 69 | HEADER_SEARCH_PATHS 70 | $(MonkeyDevTheosPath)/vendor/include/** 71 | LIBRARY_SEARCH_PATHS 72 | $(MonkeyDevTheosPath)/vendor/lib/** 73 | MonkeyDevPath 74 | /opt/MonkeyDev 75 | IPHONEOS_DEPLOYMENT_TARGET 76 | 12.0 77 | FRAMEWORK_SEARCH_PATHS 78 | $(MonkeyDevPath)/frameworks/** $(MonkeyDevTheosPath)/vendor/lib 79 | 80 | SDK 81 | iphoneos 82 | Configurations 83 | 84 | Debug 85 | 86 | ONLY_ACTIVE_ARCH 87 | YES 88 | VALIDATE_PRODUCT 89 | NO 90 | GCC_OPTIMIZATION_LEVEL 91 | 0 92 | GCC_PREPROCESSOR_DEFINITIONS 93 | DEBUG=1 $(inherited) 94 | GCC_SYMBOLS_PRIVATE_EXTERN 95 | NO 96 | COPY_PHASE_STRIP 97 | NO 98 | GCC_DYNAMIC_NO_PIC 99 | NO 100 | 101 | Release 102 | 103 | COPY_PHASE_STRIP 104 | YES 105 | VALIDATE_PRODUCT 106 | YES 107 | 108 | 109 | 110 | Options 111 | 112 | 113 | Identifier 114 | productName 115 | Required 116 | 117 | Name 118 | Product Name 119 | NotPersisted 120 | 121 | Description 122 | Your new product's name. 123 | EmptyReplacement 124 | ProductName 125 | Type 126 | text 127 | 128 | 129 | Identifier 130 | bundleIdentifierPrefix 131 | Required 132 | 133 | Name 134 | Company Identifier 135 | Description 136 | Your company's bundle identifier prefix. 137 | EmptyReplacement 138 | com.yourcompany 139 | Type 140 | text 141 | 142 | 143 | Identifier 144 | bundleIdentifier 145 | Name 146 | Bundle Identifier 147 | NotPersisted 148 | 149 | Description 150 | Your new product's bundle identifier. 151 | Default 152 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 153 | Type 154 | static 155 | 156 | 157 | Definitions 158 | 159 | *:*:importTheosPrefix 160 | #import "/opt/theos/Prefix.pch" //path/to/theos/Prefix.pch 161 | *:comments 162 | // 163 | // ___FILENAME___ 164 | // ___PACKAGENAME___ 165 | // 166 | // Created by ___FULLUSERNAME___ on ___DATE___. 167 | // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. 168 | // 169 | 170 | *:import:* 171 | #import "___*___" 172 | 173 | *:*:importFoundation 174 | #import <Foundation/Foundation.h> 175 | 176 | ___PACKAGENAME___-Prefix.pch 177 | 178 | Beginning 179 | // 180 | // Prefix header for all source files of the '___PACKAGENAME___' target in the '___PACKAGENAME___' project 181 | // 182 | 183 | Group 184 | Supporting Files 185 | TargetIndices 186 | 187 | 188 | ___PACKAGENAME___-Prefix.pch:objC 189 | 190 | Beginning 191 | #ifdef __OBJC__ 192 | End 193 | #endif 194 | Indent 195 | 1 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /MonkeyApp.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.monkey.monkeydev.singleViewApplication 9 | Ancestors 10 | 11 | com.apple.dt.unit.bundleBase 12 | com.apple.dt.unit.iosBase 13 | 14 | Concrete 15 | 16 | Description 17 | This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a storyboard or nib file that contains the view. 18 | SortOrder 19 | 1 20 | Nodes 21 | 22 | icon.png 23 | Scripts/quick-resign.sh 24 | Config/MDConfig.plist 25 | Info.plist:PackageType 26 | Info.plist:IconFiles 27 | TargetApp/put ipa or app here 28 | 29 | Definitions 30 | 31 | icon.png 32 | 33 | TargetIndices 34 | 35 | Path 36 | icon.png 37 | 38 | Scripts/quick-resign.sh 39 | 40 | TargetIndices 41 | 42 | Group 43 | 44 | Scripts 45 | 46 | Path 47 | Scripts/quick-resign.sh 48 | 49 | Config/MDConfig.plist 50 | 51 | Group 52 | 53 | Config 54 | 55 | Path 56 | Config/MDConfig.plist 57 | 58 | main.m:main 59 | 60 | Beginning 61 | int main(int argc, const char * argv[]) { 62 | End 63 | } 64 | Indent 65 | 1 66 | 67 | main.m 68 | 69 | SortOrder 70 | 999 71 | 72 | Info.plist:PackageType 73 | <key>CFBundlePackageType</key> 74 | <string>APPL</string> 75 | 76 | Info.plist:IconFiles 77 | <key>CFBundleIconFiles</key> 78 | <array> 79 | <string>___PACKAGENAME___/icon.png</string> 80 | </array> 81 | TargetApp/put ipa or app here 82 | 83 | TargetIndices 84 | 85 | Group 86 | 87 | TargetApp 88 | 89 | 90 | 91 | Targets 92 | 93 | 94 | ProductType 95 | com.apple.product-type.application 96 | SharedSettings 97 | 98 | ENABLE_USER_SCRIPT_SANDBOXING 99 | NO 100 | GENERATE_INFOPLIST_FILE 101 | NO 102 | INFOPLIST_FILE 103 | $TARGET_NAME/info.plist 104 | MONKEYDEV_DEFAULT_BUNDLEID 105 | NO 106 | MONKEYDEV_ADD_SUBSTRATE 107 | YES 108 | MONKEYDEV_TARGET_APP 109 | ___VARIABLE_TargetAppInfo___ 110 | MONKEYDEV_INSERT_DYLIB 111 | YES 112 | PODS_CONFIGURATION_BUILD_DIR 113 | $BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 114 | MONKEYDEV_CLASS_DUMP 115 | NO 116 | MONKEYDEV_RESTORE_SYMBOL 117 | NO 118 | PODS_ROOT 119 | ${SRCROOT}/Pods 120 | ENABLE_BITCODE 121 | NO 122 | 123 | BuildPhases 124 | 125 | 126 | Class 127 | Sources 128 | 129 | 130 | Class 131 | Frameworks 132 | 133 | 134 | RunOnlyForDeploymentPostprocessing 135 | 136 | Class 137 | ShellScript 138 | ShellPath 139 | /bin/sh 140 | ShellScript 141 | /opt/MonkeyDev/Tools/pack.sh 142 | 143 | 144 | Class 145 | Resources 146 | 147 | 148 | RunOnlyForDeploymentPostprocessing 149 | 150 | DstSubfolderSpec 151 | 10 152 | DstPath 153 | 154 | Class 155 | CopyFiles 156 | 157 | 158 | RunOnlyForDeploymentPostprocessing 159 | 160 | Class 161 | ShellScript 162 | ShellPath 163 | /bin/sh 164 | ShellScript 165 | /opt/MonkeyDev/Tools/pack.sh codesign 166 | 167 | 168 | TargetIdentifier 169 | com.monkey.monkeydev.TargetApp 170 | 171 | 172 | Options 173 | 174 | 175 | Identifier 176 | TargetAppInfo 177 | Required 178 | 179 | Name 180 | Target App 181 | NotPersisted 182 | 183 | Description 184 | The displayname or bundle id of the application you debug. 185 | Default 186 | Optional 187 | Type 188 | text 189 | 190 | 191 | Project 192 | 193 | SharedSettings 194 | 195 | IPHONEOS_DEPLOYMENT_TARGET 196 | 12.0 197 | 198 | 199 | Components 200 | 201 | 202 | ProductBuildPhaseInjections 203 | 204 | 205 | TargetIdentifier 206 | com.monkey.monkeydev.TargetApp 207 | 208 | 209 | Identifier 210 | com.monkey.monkeydev.cocoaTouchLibrary 211 | Name 212 | ___PACKAGENAME___Dylib 213 | 214 | 215 | 216 | 217 | -------------------------------------------------------------------------------- /PreferenceLoader.xctemplate/___PACKAGENAMEASIDENTIFIER___.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | entry 6 | 7 | cell 8 | PSLinkCell 9 | icon 10 | ___PACKAGENAMEASIDENTIFIER___Icon.png 11 | label 12 | ___PACKAGENAMEASIDENTIFIER___ 13 | 14 | items 15 | 16 | 17 | cell 18 | PSGroupCell 19 | isStaticText 20 | 21 | label 22 | Text and Secure Cells 23 | 24 | 25 | cell 26 | PSEditTextCell 27 | default 28 | 29 | defaults 30 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 31 | key 32 | EditTextCell1 33 | label 34 | Text 35 | placeholder 36 | Any Text Here 37 | PostNotification 38 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 39 | 40 | 41 | cell 42 | PSSecureEditTextCell 43 | default 44 | 45 | defaults 46 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 47 | key 48 | SecureEditTextCell2 49 | label 50 | Secure 51 | PostNotification 52 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 53 | 54 | 55 | cell 56 | PSGroupCell 57 | footerText 58 | Place text here to provide additional information about the cells above. 59 | 60 | 61 | cell 62 | PSGroupCell 63 | isStaticText 64 | 65 | label 66 | Numeric Cells 67 | 68 | 69 | cell 70 | PSEditTextCell 71 | default 72 | 73 | defaults 74 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 75 | key 76 | EditTextCell3 77 | keyboard 78 | phone 79 | label 80 | Phone 81 | placeholder 82 | Phone Number 83 | PostNotification 84 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 85 | 86 | 87 | cell 88 | PSEditTextCell 89 | default 90 | 91 | defaults 92 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 93 | key 94 | EditTextCel4 95 | keyboard 96 | numbers 97 | label 98 | Numeric 99 | placeholder 100 | Numbers 101 | PostNotification 102 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 103 | 104 | 105 | cell 106 | PSGroupCell 107 | footerText 108 | Place text here to provide additional information about the cells above. 109 | 110 | 111 | cell 112 | PSGroupCell 113 | isStaticText 114 | 115 | label 116 | Switch and Slider Cells 117 | 118 | 119 | cell 120 | PSSwitchCell 121 | default 122 | 123 | defaults 124 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 125 | key 126 | SwitchCell5 127 | label 128 | Switch 129 | PostNotification 130 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 131 | 132 | 133 | cell 134 | PSSliderCell 135 | default 136 | 50 137 | defaults 138 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 139 | key 140 | SliderCell6 141 | min 142 | 1 143 | max 144 | 100 145 | showValue 146 | 147 | PostNotification 148 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 149 | 150 | 151 | cell 152 | PSGroupCell 153 | footerText 154 | Place text here to provide additional information about the cells above. 155 | 156 | 157 | cell 158 | PSGroupCell 159 | isStaticText 160 | 161 | label 162 | List Cell 163 | 164 | 165 | cell 166 | PSLinkListCell 167 | defaults 168 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ 169 | key 170 | LinkListCell7 171 | label 172 | List 173 | detail 174 | PSListItemsController 175 | validTitles 176 | 177 | Item 1 178 | Item 2 179 | Item 3 180 | 181 | validValues 182 | 183 | 1 184 | 2 185 | 3 186 | 187 | default 188 | 1 189 | PostNotification 190 | ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___-preferencesChanged 191 | 192 | 193 | 194 | cell 195 | PSGroupCell 196 | isStaticText 197 | 198 | 199 | 200 | cell 201 | PSGroupCell 202 | footerText 203 | © ___YEAR___ ___ORGANIZATIONNAME___ 204 | 205 | 206 | title 207 | ___PACKAGENAME___ 208 | 209 | 210 | -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.monkey.monkeydev.osxLibrary 9 | Ancestors 10 | 11 | com.apple.dt.unit.base 12 | com.apple.dt.unit.osxBase 13 | 14 | Concrete 15 | 16 | Description 17 | This template builds a library that links against the Cocoa framework. 18 | SortOrder 19 | 10 20 | Targets 21 | 22 | 23 | TargetIdentifier 24 | com.apple.dt.cocoaLibraryOrFrameworkTarget 25 | SharedSettings 26 | 27 | INSTALL_PATH 28 | @executable_path/lib___PACKAGENAME___.dylib 29 | OTHER_LDFLAGS 30 | $(inherited) -lsubstitute 31 | EXECUTABLE_PREFIX 32 | lib 33 | 34 | BuildPhases 35 | 36 | 37 | Class 38 | Sources 39 | 40 | 41 | Class 42 | Frameworks 43 | 44 | 45 | Class 46 | Headers 47 | 48 | 49 | ShellScript 50 | /opt/MonkeyDev/Tools/mpack.sh 51 | ShellPath 52 | /bin/sh 53 | RunOnlyForDeploymentPostprocessing 54 | 55 | Class 56 | ShellScript 57 | 58 | 59 | 60 | 61 | Options 62 | 63 | 64 | Identifier 65 | libraryFramework 66 | Name 67 | Framework: 68 | Description 69 | What system framework the library will be based on 70 | Type 71 | popup 72 | Values 73 | 74 | Cocoa 75 | STL (C++ Library) 76 | None (Plain C/C++ Library) 77 | 78 | Default 79 | Cocoa 80 | Units 81 | 82 | Cocoa 83 | 84 | 85 | Nodes 86 | 87 | ___PACKAGENAMEASIDENTIFIER___.h 88 | ___PACKAGENAMEASIDENTIFIER___.m 89 | 90 | Definitions 91 | 92 | ___PACKAGENAMEASIDENTIFIER___.h 93 | 94 | Path 95 | Cocoa___PACKAGENAMEASIDENTIFIER___.h 96 | 97 | ___PACKAGENAMEASIDENTIFIER___.m 98 | 99 | Path 100 | Cocoa___PACKAGENAMEASIDENTIFIER___.m 101 | 102 | 103 | 104 | 105 | STL (C++ Library) 106 | 107 | 108 | Targets 109 | 110 | 111 | SharedSettings 112 | 113 | GCC_ENABLE_CPP_EXCEPTIONS 114 | YES 115 | GCC_ENABLE_CPP_RTTI 116 | YES 117 | 118 | 119 | 120 | Nodes 121 | 122 | ___PACKAGENAMEASIDENTIFIER___.hpp 123 | ___PACKAGENAMEASIDENTIFIER___Priv.hpp 124 | ___PACKAGENAMEASIDENTIFIER___.cpp 125 | 126 | Definitions 127 | 128 | ___PACKAGENAMEASIDENTIFIER___.hpp 129 | 130 | Path 131 | STL___PACKAGENAMEASIDENTIFIER___.hpp 132 | 133 | ___PACKAGENAMEASIDENTIFIER___.cpp 134 | 135 | Path 136 | STL___PACKAGENAMEASIDENTIFIER___.cpp 137 | 138 | ___PACKAGENAMEASIDENTIFIER___Priv.hpp 139 | 140 | Path 141 | STL___PACKAGENAMEASIDENTIFIER___Priv.hpp 142 | 143 | 144 | 145 | 146 | RequiredOptions 147 | 148 | libraryType 149 | Dynamic 150 | 151 | Targets 152 | 153 | 154 | SharedSettings 155 | 156 | GCC_SYMBOLS_PRIVATE_EXTERN 157 | YES 158 | 159 | 160 | 161 | 162 | 163 | None (Plain C/C++ Library) 164 | 165 | 166 | 167 | 168 | 169 | 170 | Identifier 171 | libraryType 172 | Name 173 | Type: 174 | Description 175 | Which type of library to create 176 | Type 177 | popup 178 | Default 179 | Dynamic 180 | Units 181 | 182 | Dynamic 183 | 184 | 185 | Targets 186 | 187 | 188 | ProductType 189 | com.apple.product-type.library.dynamic 190 | SharedSettings 191 | 192 | DYLIB_COMPATIBILITY_VERSION 193 | 1 194 | DYLIB_CURRENT_VERSION 195 | 1 196 | 197 | 198 | 199 | 200 | 201 | Static 202 | 203 | 204 | Targets 205 | 206 | 207 | ProductType 208 | com.apple.product-type.library.static 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | Project 217 | 218 | SharedSettings 219 | 220 | MonkeyDevPath 221 | /opt/MonkeyDev 222 | LIBRARY_SEARCH_PATHS 223 | $(inherited) $(MonkeyDevPath)/MFrameworks 224 | HEADER_SEARCH_PATHS 225 | $(inherited) $(MonkeyDevPath)/MFrameworks 226 | 227 | 228 | Definitions 229 | 230 | fishhook/fishhook.c 231 | 232 | Path 233 | fishhook/fishhook.c 234 | Group 235 | 236 | fishhook 237 | 238 | 239 | fishhook/fishhook.h 240 | 241 | Path 242 | fishhook/fishhook.h 243 | Group 244 | 245 | fishhook 246 | 247 | 248 | AntiAntiDebug/AntiAntiDebug.m 249 | 250 | Group 251 | 252 | AntiAntiDebug 253 | 254 | Path 255 | AntiAntiDebug/AntiAntiDebug.m 256 | 257 | TargetApp/put mac app here 258 | 259 | Group 260 | 261 | TargetApp 262 | 263 | 264 | 265 | Nodes 266 | 267 | AntiAntiDebug/AntiAntiDebug.m 268 | fishhook/fishhook.c 269 | fishhook/fishhook.h 270 | TargetApp/put mac app here 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /MonkeyAppMac.xctemplate/fishhook/fishhook.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013, Facebook, Inc. 2 | // All rights reserved. 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are met: 5 | // * Redistributions of source code must retain the above copyright notice, 6 | // this list of conditions and the following disclaimer. 7 | // * Redistributions in binary form must reproduce the above copyright notice, 8 | // this list of conditions and the following disclaimer in the documentation 9 | // and/or other materials provided with the distribution. 10 | // * Neither the name Facebook nor the names of its contributors may be used to 11 | // endorse or promote products derived from this software without specific 12 | // prior written permission. 13 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | #import "fishhook.h" 25 | 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | 34 | #ifdef __LP64__ 35 | typedef struct mach_header_64 mach_header_t; 36 | typedef struct segment_command_64 segment_command_t; 37 | typedef struct section_64 section_t; 38 | typedef struct nlist_64 nlist_t; 39 | #define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64 40 | #else 41 | typedef struct mach_header mach_header_t; 42 | typedef struct segment_command segment_command_t; 43 | typedef struct section section_t; 44 | typedef struct nlist nlist_t; 45 | #define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT 46 | #endif 47 | 48 | #ifndef SEG_DATA_CONST 49 | #define SEG_DATA_CONST "__DATA_CONST" 50 | #endif 51 | 52 | struct rebindings_entry { 53 | struct rebinding *rebindings; 54 | size_t rebindings_nel; 55 | struct rebindings_entry *next; 56 | }; 57 | 58 | static struct rebindings_entry *_rebindings_head; 59 | 60 | static int prepend_rebindings(struct rebindings_entry **rebindings_head, 61 | struct rebinding rebindings[], 62 | size_t nel) { 63 | struct rebindings_entry *new_entry = (struct rebindings_entry *) malloc(sizeof(struct rebindings_entry)); 64 | if (!new_entry) { 65 | return -1; 66 | } 67 | new_entry->rebindings = (struct rebinding *) malloc(sizeof(struct rebinding) * nel); 68 | if (!new_entry->rebindings) { 69 | free(new_entry); 70 | return -1; 71 | } 72 | memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel); 73 | new_entry->rebindings_nel = nel; 74 | new_entry->next = *rebindings_head; 75 | *rebindings_head = new_entry; 76 | return 0; 77 | } 78 | 79 | static void perform_rebinding_with_section(struct rebindings_entry *rebindings, 80 | section_t *section, 81 | intptr_t slide, 82 | nlist_t *symtab, 83 | char *strtab, 84 | uint32_t *indirect_symtab) { 85 | uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1; 86 | void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr); 87 | for (uint i = 0; i < section->size / sizeof(void *); i++) { 88 | uint32_t symtab_index = indirect_symbol_indices[i]; 89 | if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL || 90 | symtab_index == (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS)) { 91 | continue; 92 | } 93 | uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx; 94 | char *symbol_name = strtab + strtab_offset; 95 | if (strnlen(symbol_name, 2) < 2) { 96 | continue; 97 | } 98 | struct rebindings_entry *cur = rebindings; 99 | while (cur) { 100 | for (uint j = 0; j < cur->rebindings_nel; j++) { 101 | if (strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) { 102 | if (cur->rebindings[j].replaced != NULL && 103 | indirect_symbol_bindings[i] != cur->rebindings[j].replacement) { 104 | *(cur->rebindings[j].replaced) = indirect_symbol_bindings[i]; 105 | } 106 | indirect_symbol_bindings[i] = cur->rebindings[j].replacement; 107 | goto symbol_loop; 108 | } 109 | } 110 | cur = cur->next; 111 | } 112 | symbol_loop:; 113 | } 114 | } 115 | 116 | static void rebind_symbols_for_image(struct rebindings_entry *rebindings, 117 | const struct mach_header *header, 118 | intptr_t slide) { 119 | Dl_info info; 120 | if (dladdr(header, &info) == 0) { 121 | return; 122 | } 123 | 124 | segment_command_t *cur_seg_cmd; 125 | segment_command_t *linkedit_segment = NULL; 126 | struct symtab_command* symtab_cmd = NULL; 127 | struct dysymtab_command* dysymtab_cmd = NULL; 128 | 129 | uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t); 130 | for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) { 131 | cur_seg_cmd = (segment_command_t *)cur; 132 | if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) { 133 | if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) { 134 | linkedit_segment = cur_seg_cmd; 135 | } 136 | } else if (cur_seg_cmd->cmd == LC_SYMTAB) { 137 | symtab_cmd = (struct symtab_command*)cur_seg_cmd; 138 | } else if (cur_seg_cmd->cmd == LC_DYSYMTAB) { 139 | dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd; 140 | } 141 | } 142 | 143 | if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment || 144 | !dysymtab_cmd->nindirectsyms) { 145 | return; 146 | } 147 | 148 | // Find base symbol/string table addresses 149 | uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff; 150 | nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff); 151 | char *strtab = (char *)(linkedit_base + symtab_cmd->stroff); 152 | 153 | // Get indirect symbol table (array of uint32_t indices into symbol table) 154 | uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff); 155 | 156 | cur = (uintptr_t)header + sizeof(mach_header_t); 157 | for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) { 158 | cur_seg_cmd = (segment_command_t *)cur; 159 | if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) { 160 | if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 && 161 | strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) { 162 | continue; 163 | } 164 | for (uint j = 0; j < cur_seg_cmd->nsects; j++) { 165 | section_t *sect = 166 | (section_t *)(cur + sizeof(segment_command_t)) + j; 167 | if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) { 168 | perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab); 169 | } 170 | if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) { 171 | perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab); 172 | } 173 | } 174 | } 175 | } 176 | } 177 | 178 | static void _rebind_symbols_for_image(const struct mach_header *header, 179 | intptr_t slide) { 180 | rebind_symbols_for_image(_rebindings_head, header, slide); 181 | } 182 | 183 | int rebind_symbols_image(void *header, 184 | intptr_t slide, 185 | struct rebinding rebindings[], 186 | size_t rebindings_nel) { 187 | struct rebindings_entry *rebindings_head = NULL; 188 | int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel); 189 | rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide); 190 | free(rebindings_head); 191 | return retval; 192 | } 193 | 194 | int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) { 195 | int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel); 196 | if (retval < 0) { 197 | return retval; 198 | } 199 | // If this was the first call, register callback for image additions (which is also invoked for 200 | // existing images, otherwise, just run on existing images 201 | if (!_rebindings_head->next) { 202 | _dyld_register_func_for_add_image(_rebind_symbols_for_image); 203 | } else { 204 | uint32_t c = _dyld_image_count(); 205 | for (uint32_t i = 0; i < c; i++) { 206 | _rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i)); 207 | } 208 | } 209 | return retval; 210 | } 211 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/fishhook/fishhook.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013, Facebook, Inc. 2 | // All rights reserved. 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are met: 5 | // * Redistributions of source code must retain the above copyright notice, 6 | // this list of conditions and the following disclaimer. 7 | // * Redistributions in binary form must reproduce the above copyright notice, 8 | // this list of conditions and the following disclaimer in the documentation 9 | // and/or other materials provided with the distribution. 10 | // * Neither the name Facebook nor the names of its contributors may be used to 11 | // endorse or promote products derived from this software without specific 12 | // prior written permission. 13 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | #include "fishhook.h" 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #ifdef __LP64__ 40 | typedef struct mach_header_64 mach_header_t; 41 | typedef struct segment_command_64 segment_command_t; 42 | typedef struct section_64 section_t; 43 | typedef struct nlist_64 nlist_t; 44 | #define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64 45 | #else 46 | typedef struct mach_header mach_header_t; 47 | typedef struct segment_command segment_command_t; 48 | typedef struct section section_t; 49 | typedef struct nlist nlist_t; 50 | #define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT 51 | #endif 52 | 53 | #ifndef SEG_DATA_CONST 54 | #define SEG_DATA_CONST "__DATA_CONST" 55 | #endif 56 | 57 | struct rebindings_entry { 58 | struct rebinding *rebindings; 59 | size_t rebindings_nel; 60 | struct rebindings_entry *next; 61 | }; 62 | 63 | static struct rebindings_entry *_rebindings_head; 64 | 65 | static int prepend_rebindings(struct rebindings_entry **rebindings_head, 66 | struct rebinding rebindings[], 67 | size_t nel) { 68 | struct rebindings_entry *new_entry = (struct rebindings_entry *) malloc(sizeof(struct rebindings_entry)); 69 | if (!new_entry) { 70 | return -1; 71 | } 72 | new_entry->rebindings = (struct rebinding *) malloc(sizeof(struct rebinding) * nel); 73 | if (!new_entry->rebindings) { 74 | free(new_entry); 75 | return -1; 76 | } 77 | memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel); 78 | new_entry->rebindings_nel = nel; 79 | new_entry->next = *rebindings_head; 80 | *rebindings_head = new_entry; 81 | return 0; 82 | } 83 | 84 | #if 0 85 | static int get_protection(void *addr, vm_prot_t *prot, vm_prot_t *max_prot) { 86 | mach_port_t task = mach_task_self(); 87 | vm_size_t size = 0; 88 | vm_address_t address = (vm_address_t)addr; 89 | memory_object_name_t object; 90 | #ifdef __LP64__ 91 | mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT_64; 92 | vm_region_basic_info_data_64_t info; 93 | kern_return_t info_ret = vm_region_64( 94 | task, &address, &size, VM_REGION_BASIC_INFO_64, (vm_region_info_64_t)&info, &count, &object); 95 | #else 96 | mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT; 97 | vm_region_basic_info_data_t info; 98 | kern_return_t info_ret = vm_region(task, &address, &size, VM_REGION_BASIC_INFO, (vm_region_info_t)&info, &count, &object); 99 | #endif 100 | if (info_ret == KERN_SUCCESS) { 101 | if (prot != NULL) 102 | *prot = info.protection; 103 | 104 | if (max_prot != NULL) 105 | *max_prot = info.max_protection; 106 | 107 | return 0; 108 | } 109 | 110 | return -1; 111 | } 112 | #endif 113 | 114 | static void perform_rebinding_with_section(struct rebindings_entry *rebindings, 115 | section_t *section, 116 | intptr_t slide, 117 | nlist_t *symtab, 118 | char *strtab, 119 | uint32_t *indirect_symtab) { 120 | uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1; 121 | void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr); 122 | 123 | for (uint i = 0; i < section->size / sizeof(void *); i++) { 124 | uint32_t symtab_index = indirect_symbol_indices[i]; 125 | if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL || 126 | symtab_index == (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS)) { 127 | continue; 128 | } 129 | uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx; 130 | char *symbol_name = strtab + strtab_offset; 131 | bool symbol_name_longer_than_1 = symbol_name[0] && symbol_name[1]; 132 | struct rebindings_entry *cur = rebindings; 133 | while (cur) { 134 | for (uint j = 0; j < cur->rebindings_nel; j++) { 135 | if (symbol_name_longer_than_1 && strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) { 136 | kern_return_t err; 137 | 138 | if (cur->rebindings[j].replaced != NULL && indirect_symbol_bindings[i] != cur->rebindings[j].replacement) 139 | *(cur->rebindings[j].replaced) = indirect_symbol_bindings[i]; 140 | 141 | /** 142 | * 1. Moved the vm protection modifying codes to here to reduce the 143 | * changing scope. 144 | * 2. Adding VM_PROT_WRITE mode unconditionally because vm_region 145 | * API on some iOS/Mac reports mismatch vm protection attributes. 146 | * -- Lianfu Hao Jun 16th, 2021 147 | **/ 148 | err = vm_protect (mach_task_self (), (uintptr_t)indirect_symbol_bindings, section->size, 0, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_COPY); 149 | if (err == KERN_SUCCESS) { 150 | /** 151 | * Once we failed to change the vm protection, we 152 | * MUST NOT continue the following write actions! 153 | * iOS 15 has corrected the const segments prot. 154 | * -- Lionfore Hao Jun 11th, 2021 155 | **/ 156 | indirect_symbol_bindings[i] = cur->rebindings[j].replacement; 157 | } 158 | goto symbol_loop; 159 | } 160 | } 161 | cur = cur->next; 162 | } 163 | symbol_loop:; 164 | } 165 | } 166 | 167 | static void rebind_symbols_for_image(struct rebindings_entry *rebindings, 168 | const struct mach_header *header, 169 | intptr_t slide) { 170 | Dl_info info; 171 | if (dladdr(header, &info) == 0) { 172 | return; 173 | } 174 | 175 | segment_command_t *cur_seg_cmd; 176 | segment_command_t *linkedit_segment = NULL; 177 | struct symtab_command* symtab_cmd = NULL; 178 | struct dysymtab_command* dysymtab_cmd = NULL; 179 | 180 | uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t); 181 | for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) { 182 | cur_seg_cmd = (segment_command_t *)cur; 183 | if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) { 184 | if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) { 185 | linkedit_segment = cur_seg_cmd; 186 | } 187 | } else if (cur_seg_cmd->cmd == LC_SYMTAB) { 188 | symtab_cmd = (struct symtab_command*)cur_seg_cmd; 189 | } else if (cur_seg_cmd->cmd == LC_DYSYMTAB) { 190 | dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd; 191 | } 192 | } 193 | 194 | if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment || 195 | !dysymtab_cmd->nindirectsyms) { 196 | return; 197 | } 198 | 199 | // Find base symbol/string table addresses 200 | uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff; 201 | nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff); 202 | char *strtab = (char *)(linkedit_base + symtab_cmd->stroff); 203 | 204 | // Get indirect symbol table (array of uint32_t indices into symbol table) 205 | uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff); 206 | 207 | cur = (uintptr_t)header + sizeof(mach_header_t); 208 | for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) { 209 | cur_seg_cmd = (segment_command_t *)cur; 210 | if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) { 211 | if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 && 212 | strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) { 213 | continue; 214 | } 215 | for (uint j = 0; j < cur_seg_cmd->nsects; j++) { 216 | section_t *sect = 217 | (section_t *)(cur + sizeof(segment_command_t)) + j; 218 | if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) { 219 | perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab); 220 | } 221 | if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) { 222 | perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab); 223 | } 224 | } 225 | } 226 | } 227 | } 228 | 229 | static void _rebind_symbols_for_image(const struct mach_header *header, 230 | intptr_t slide) { 231 | rebind_symbols_for_image(_rebindings_head, header, slide); 232 | } 233 | 234 | int rebind_symbols_image(void *header, 235 | intptr_t slide, 236 | struct rebinding rebindings[], 237 | size_t rebindings_nel) { 238 | struct rebindings_entry *rebindings_head = NULL; 239 | int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel); 240 | rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide); 241 | if (rebindings_head) { 242 | free(rebindings_head->rebindings); 243 | } 244 | free(rebindings_head); 245 | return retval; 246 | } 247 | 248 | int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) { 249 | int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel); 250 | if (retval < 0) { 251 | return retval; 252 | } 253 | // If this was the first call, register callback for image additions (which is also invoked for 254 | // existing images, otherwise, just run on existing images 255 | if (!_rebindings_head->next) { 256 | _dyld_register_func_for_add_image(_rebind_symbols_for_image); 257 | } else { 258 | uint32_t c = _dyld_image_count(); 259 | for (uint32_t i = 0; i < c; i++) { 260 | _rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i)); 261 | } 262 | } 263 | return retval; 264 | } 265 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Command-line Tool.xctemplate/TemplateInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kind 6 | Xcode.Xcode3.ProjectTemplateUnitKind 7 | Identifier 8 | com.monkey.monkeydev.commandLineTool 9 | Concrete 10 | 11 | Description 12 | This template builds a command-line tool. 13 | Ancestors 14 | 15 | com.monkey.monkeydev.base 16 | 17 | Targets 18 | 19 | 20 | SharedSettings 21 | 22 | CODE_SIGN_ENTITLEMENTS 23 | ___PACKAGENAME___/monkeydev.entitlements 24 | CLANG_ENABLE_OBJC_ARC 25 | YES 26 | MonkeyDevkillProcessOnInstall 27 | 28 | CODE_SIGN_IDENTITY 29 | iPhone Developer 30 | INSTALL_PATH 31 | /usr/bin 32 | 33 | ProductType 34 | com.apple.product-type.tool 35 | BuildPhases 36 | 37 | 38 | Class 39 | Sources 40 | 41 | 42 | Class 43 | Frameworks 44 | 45 | 46 | ShellScript 47 | /opt/MonkeyDev/bin/md --xcbp 48 | ShellPath 49 | /bin/sh 50 | RunOnlyForDeploymentPostprocessing 51 | 52 | Class 53 | ShellScript 54 | 55 | 56 | 57 | 58 | Options 59 | 60 | 61 | SortOrder 62 | 1 63 | NotPersisted 64 | 65 | Identifier 66 | commandLineType 67 | Name 68 | Type 69 | Description 70 | The type of command-line tool to create. 71 | Default 72 | C 73 | Type 74 | popup 75 | Units 76 | 77 | C 78 | 79 | Nodes 80 | 81 | main.c:comments 82 | main.c:include 83 | main.c:main:content 84 | 85 | Definitions 86 | 87 | main.c:include 88 | #include <stdio.h> 89 | 90 | main.c:main:content 91 | // insert code here... 92 | printf("Hello, World!\n"); 93 | 94 | 95 | 96 | C++ 97 | 98 | Nodes 99 | 100 | main.cpp:comments 101 | main.cpp:include 102 | main.cpp:main:content 103 | 104 | Definitions 105 | 106 | main.cpp:include 107 | #include <iostream> 108 | 109 | main.cpp:main:content 110 | // insert code here... 111 | std::cout << "Hello, World!\n"; 112 | 113 | 114 | 115 | Core Data 116 | 117 | Project 118 | 119 | SharedSettings 120 | 121 | GCC_ENABLE_OBJC_GC 122 | required 123 | 124 | 125 | Targets 126 | 127 | 128 | SharedSettings 129 | 130 | GCC_PRECOMPILE_PREFIX_HEADER 131 | YES 132 | GCC_PREFIX_HEADER 133 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 134 | 135 | Frameworks 136 | 137 | CoreData 138 | Foundation 139 | 140 | 141 | 142 | Nodes 143 | 144 | main.m:comments 145 | main.m:include 146 | main.m:main:content 147 | main.m:coreData 148 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 149 | ___PACKAGENAME___-Prefix.pch:objC:importCoreData 150 | ___PACKAGENAMEASIDENTIFIER___.xcdatamodeld 151 | 152 | Definitions 153 | 154 | main.m:include 155 | NSManagedObjectModel *managedObjectModel(void); 156 | NSManagedObjectContext *managedObjectContext(void); 157 | 158 | main.m:main:content 159 | @autoreleasepool 160 | { 161 | // Create the managed object context 162 | NSManagedObjectContext *context = managedObjectContext(); 163 | 164 | // Custom code here... 165 | // Save the managed object context 166 | NSError *error = nil; 167 | if (![context save:&error]) { 168 | NSLog(@"Error while saving %@", ([error localizedDescription] != nil) ? [error localizedDescription] : @"Unknown Error"); 169 | exit(1); 170 | } 171 | } 172 | 173 | main.m:coreData 174 | NSManagedObjectModel *managedObjectModel() { 175 | 176 | static NSManagedObjectModel *model = nil; 177 | 178 | if (model != nil) { 179 | return model; 180 | } 181 | 182 | NSString *path = [[[NSProcessInfo processInfo] arguments] objectAtIndex:0]; 183 | path = [path stringByDeletingPathExtension]; 184 | NSURL *modelURL = [NSURL fileURLWithPath:[path stringByAppendingPathExtension:@"momd"]]; 185 | model = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; 186 | 187 | return model; 188 | } 189 | 190 | NSManagedObjectContext *managedObjectContext() { 191 | 192 | static NSManagedObjectContext *context = nil; 193 | if (context != nil) { 194 | return context; 195 | } 196 | 197 | @autoreleasepool 198 | { 199 | context = [[NSManagedObjectContext alloc] init]; 200 | 201 | NSPersistentStoreCoordinator *coordinator = ___RP___[[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel()]___AR___; 202 | [context setPersistentStoreCoordinator:coordinator]; 203 | 204 | NSString *STORE_TYPE = NSSQLiteStoreType; 205 | 206 | NSString *path = [[[NSProcessInfo processInfo] arguments] objectAtIndex:0]; 207 | path = [path stringByDeletingPathExtension]; 208 | NSURL *url = [NSURL fileURLWithPath:[path stringByAppendingPathExtension:@"sqlite"]]; 209 | 210 | NSError *error; 211 | NSPersistentStore *newStore = [coordinator addPersistentStoreWithType:STORE_TYPE configuration:nil URL:url options:nil error:&error]; 212 | 213 | if (newStore == nil) { 214 | NSLog(@"Store Configuration Failure %@", ([error localizedDescription] != nil) ? [error localizedDescription] : @"Unknown Error"); 215 | } 216 | } 217 | return context; 218 | } 219 | 220 | ___PACKAGENAME___-Prefix.pch:objC:importCoreData 221 | #import <CoreData/CoreData.h> 222 | ___PACKAGENAMEASIDENTIFIER___.xcdatamodeld 223 | 224 | Path 225 | ___PACKAGENAMEASIDENTIFIER___.xcdatamodeld 226 | 227 | 228 | 229 | Core Foundation 230 | 231 | Targets 232 | 233 | 234 | Frameworks 235 | 236 | CoreFoundation 237 | 238 | 239 | 240 | Nodes 241 | 242 | main.c:comments 243 | main.c:include 244 | main.c:main:content 245 | 246 | Definitions 247 | 248 | main.c:include 249 | #include <CoreFoundation/CoreFoundation.h> 250 | 251 | main.c:main:content 252 | // insert code here... 253 | CFShow(CFSTR("Hello, World!\n")); 254 | 255 | 256 | 257 | Core Services 258 | 259 | Targets 260 | 261 | 262 | Frameworks 263 | 264 | CoreServices 265 | 266 | 267 | 268 | Nodes 269 | 270 | main.c:comments 271 | main.c:include 272 | main.c:main:content 273 | 274 | Definitions 275 | 276 | main.c:include 277 | #include <CoreServices/CoreServices.h> 278 | 279 | main.c:main:content 280 | // insert code here... 281 | printf("Hello, World!\n"); 282 | 283 | 284 | 285 | Foundation 286 | 287 | Targets 288 | 289 | 290 | SharedSettings 291 | 292 | GCC_PRECOMPILE_PREFIX_HEADER 293 | YES 294 | GCC_PREFIX_HEADER 295 | ___PACKAGENAME___/___PACKAGENAME___-Prefix.pch 296 | 297 | Frameworks 298 | 299 | Foundation 300 | 301 | 302 | 303 | Nodes 304 | 305 | main.m:comments 306 | main.m:include 307 | main.m:main:content 308 | ___PACKAGENAME___-Prefix.pch:objC:importFoundation 309 | 310 | Definitions 311 | 312 | main.m:include 313 | #import <Foundation/Foundation.h> 314 | 315 | main.m:main:content 316 | @autoreleasepool 317 | { 318 | // insert code here... 319 | NSLog(@"Hello, World!"); 320 | } 321 | 322 | 323 | 324 | 325 | 326 | 327 | Nodes 328 | 329 | monkeydev.entitlements 330 | Package/DEBIAN/control:debianControl:section 331 | Package/DEBIAN/control:debianControl:depends 332 | Package/usr/bin/0xdeadfa11 333 | 334 | Definitions 335 | 336 | monkeydev.entitlements 337 | 338 | Path 339 | monkeydev.entitlements 340 | 341 | Package/usr/bin/0xdeadfa11 342 | 343 | Group 344 | 345 | Package 346 | usr 347 | bin 348 | 349 | Beginning 350 | 351 | This file was created only to help build the project's group structure, and it can now be deleted. 352 | 353 | Why 0xdeadfa11? See http://developer.apple.com/library/ios/#technotes/tn2151/_index.html. 354 | 355 | *:debianControl:section 356 | Section: System 357 | *:debianControl:depends 358 | Depends: firmware (>= 5.0) 359 | *:main 360 | 361 | Beginning 362 | int main (int argc, const char * argv[]) 363 | { 364 | 365 | End 366 | return 0; 367 | } 368 | 369 | Indent 370 | 1 371 | 372 | *:*:importFoundation 373 | #import <Foundation/Foundation.h> 374 | 375 | 376 | 377 | 378 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Config/MDCycriptManager.m: -------------------------------------------------------------------------------- 1 | // weibo: http://weibo.com/xiaoqing28 2 | // blog: http://www.alonemonkey.com 3 | // 4 | // MDCycriptManager.m 5 | // MonkeyDev 6 | // 7 | // Created by AloneMonkey on 2018/3/8. 8 | // Copyright © 2018年 AloneMonkey. All rights reserved. 9 | // 10 | 11 | #ifndef __OPTIMIZE__ 12 | 13 | #import "MDCycriptManager.h" 14 | #import "MDConfigManager.h" 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | 21 | #define IOS_CELLULAR @"pdp_ip0" 22 | #define IOS_WIFI @"en0" 23 | #define IP_ADDR_IPv4 @"ipv4" 24 | #define IP_ADDR_IPv6 @"ipv6" 25 | #define MDLog(fmt, ...) NSLog((@"[Cycript] " fmt), ##__VA_ARGS__) 26 | 27 | extern JSGlobalContextRef CYGetJSContext(void); 28 | extern void CydgetMemoryParse(const uint16_t **data, size_t *size); 29 | 30 | NSString * const CYErrorLineKey = @"CYErrorLineKey"; 31 | NSString * const CYErrorNameKey = @"CYErrorNameKey"; 32 | NSString * const CYErrorMessageKey = @"CYErrorMessageKey"; 33 | 34 | @interface MDSettingObject : NSObject 35 | 36 | @property (nonatomic, assign) NSInteger priority; 37 | @property (nonatomic, copy) NSString* url; 38 | @property (nonatomic, copy) NSString* content; 39 | @property (nonatomic, assign) BOOL loadAtLaunch; 40 | 41 | -(instancetype)initWithDicationary:(NSDictionary*) dictionary; 42 | 43 | @end 44 | 45 | @implementation MDSettingObject 46 | 47 | -(instancetype)initWithDicationary:(NSDictionary *)dictionary{ 48 | self = [super init]; 49 | if(self){ 50 | self.priority = [dictionary[@"priority"] integerValue]; 51 | self.url = dictionary[@"url"]; 52 | self.content = dictionary[@"content"]; 53 | self.loadAtLaunch = [dictionary objectForKey:MDCONFIG_LOADATLAUNCH_KEY] && [dictionary[MDCONFIG_LOADATLAUNCH_KEY] boolValue]; 54 | } 55 | return self; 56 | } 57 | 58 | @end 59 | 60 | @interface MDCycriptManager() 61 | 62 | @property (nonatomic, strong) NSDictionary* configItem; 63 | @property (nonatomic, copy) NSString* cycriptDirectory; 64 | @property (nonatomic, strong) NSMutableArray* downloading; 65 | @property (nonatomic, strong) NSMutableDictionary* loadAtLaunchModules; 66 | 67 | @end 68 | 69 | @implementation MDCycriptManager 70 | 71 | + (instancetype)sharedInstance{ 72 | static MDCycriptManager *sharedInstance = nil; 73 | if (!sharedInstance){ 74 | sharedInstance = [[MDCycriptManager alloc] init]; 75 | } 76 | return sharedInstance; 77 | } 78 | 79 | - (instancetype)init 80 | { 81 | self = [super init]; 82 | if (self) { 83 | _loadAtLaunchModules = [NSMutableDictionary dictionary]; 84 | _downloading = [NSMutableArray array]; 85 | [self check]; 86 | [self readConfigFile]; 87 | } 88 | return self; 89 | } 90 | 91 | -(void)check{ 92 | NSString* ip = [self getIPAddress]; 93 | if(ip != nil){ 94 | printf("\nDownload cycript(https://cydia.saurik.com/api/latest/3) then run: ./cycript -r %s:%d\n\n", [ip UTF8String], PORT); 95 | }else{ 96 | printf("\nPlease connect wifi before using cycript!\n\n"); 97 | } 98 | 99 | NSFileManager *fileManager = [NSFileManager defaultManager]; 100 | NSString *documentsPath =[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES) firstObject]; 101 | _cycriptDirectory = [documentsPath stringByAppendingPathComponent:@"cycript"]; 102 | [fileManager createDirectoryAtPath:_cycriptDirectory withIntermediateDirectories:YES attributes:nil error:nil]; 103 | } 104 | 105 | -(NSArray*)sortedArray:(NSDictionary*) dictionary{ 106 | NSMutableArray* result = [NSMutableArray arrayWithCapacity:10]; 107 | 108 | NSArray* sortedArray = [dictionary.allKeys sortedArrayUsingComparator:^NSComparisonResult(NSNumber* _Nonnull number1, NSNumber* _Nonnull number2) { 109 | if ([number1 integerValue] > [number2 integerValue]) 110 | return NSOrderedDescending; 111 | return NSOrderedAscending; 112 | }]; 113 | 114 | for (NSNumber* item in sortedArray) { 115 | [result addObject:dictionary[item]]; 116 | } 117 | 118 | return [result copy]; 119 | } 120 | 121 | -(void)readConfigFile{ 122 | MDConfigManager * configManager = [MDConfigManager sharedInstance]; 123 | _configItem = [configManager readConfigByKey:MDCONFIG_CYCRIPT_KEY]; 124 | } 125 | 126 | -(void)loadCycript:(BOOL) update{ 127 | NSFileManager *fileManager = [NSFileManager defaultManager]; 128 | 129 | if(_configItem && _configItem.count > 0){ 130 | 131 | BOOL download = NO; 132 | 133 | for (NSString* moduleName in _configItem.allKeys) { 134 | MDSettingObject * item = [[MDSettingObject alloc] initWithDicationary:_configItem[moduleName]]; 135 | NSString *fullPath = [[_cycriptDirectory stringByAppendingPathComponent:moduleName] stringByAppendingPathExtension:@"cy"]; 136 | 137 | if(item.url){ 138 | if(![fileManager fileExistsAtPath:fullPath] || update){ 139 | download = YES; 140 | [self.downloading addObject:moduleName]; 141 | [self downLoadUrl:item.url saveName:moduleName]; 142 | } 143 | } 144 | 145 | if(item.content){ 146 | if(![fileManager fileExistsAtPath:fullPath] || update){ 147 | NSString* writeContent = [NSString stringWithFormat:@"(function(exports) { %@ })(exports);", item.content]; 148 | [writeContent writeToFile:fullPath atomically:YES encoding:NSUTF8StringEncoding error:nil]; 149 | } 150 | } 151 | 152 | if(item.loadAtLaunch){ 153 | [_loadAtLaunchModules setObject:fullPath forKey:@(item.priority)]; 154 | } 155 | } 156 | 157 | if(!download){ 158 | [self finishDownload]; 159 | } 160 | } 161 | } 162 | 163 | -(void)finishDownload{ 164 | MDLog(@"Finish download all script!"); 165 | NSArray* sortedArray = [self sortedArray:_loadAtLaunchModules]; 166 | for (NSString* fullPath in sortedArray) { 167 | NSError* error; 168 | [self evaluateCycript:[NSString stringWithFormat:@"require('%@');",fullPath] error:&error]; 169 | if(error.code != 0){ 170 | MDLog(@"%@", error.localizedDescription); 171 | } 172 | } 173 | } 174 | 175 | -(void)downLoadUrl:(NSString*) urlString saveName:(NSString*) filename{ 176 | __weak typeof(self) weakSelf = self; 177 | NSURLSession *session = [NSURLSession sharedSession]; 178 | NSURL *url = [NSURL URLWithString:urlString]; 179 | NSURLSessionDownloadTask *downloadTask = [session downloadTaskWithURL:url completionHandler:^(NSURL * _Nullable location, NSURLResponse * _Nullable response, NSError * _Nullable error) { 180 | 181 | if(error){ 182 | MDLog(@"Failed download script [%@]: %@", filename, error.localizedDescription); 183 | }else{ 184 | NSString *fullPath = [[weakSelf.cycriptDirectory stringByAppendingPathComponent:filename] stringByAppendingPathExtension:@"cy"]; 185 | [[NSFileManager defaultManager] moveItemAtURL:location toURL:[NSURL fileURLWithPath:fullPath] error:nil]; 186 | 187 | MDLog(@"Successful download script [%@]", filename); 188 | } 189 | 190 | [weakSelf.downloading removeObject:filename]; 191 | 192 | if(!weakSelf.downloading.count){ 193 | [weakSelf finishDownload]; 194 | } 195 | }]; 196 | [downloadTask resume]; 197 | } 198 | 199 | -(NSString *)evaluateCycript:(NSString *)cycript error:(NSError *__autoreleasing *)error{ 200 | NSString *resultString = nil; 201 | 202 | static pthread_mutex_t cycript_metex = PTHREAD_MUTEX_INITIALIZER; 203 | pthread_mutex_lock(&cycript_metex); { 204 | JSGlobalContextRef context = CYGetJSContext(); 205 | 206 | size_t length = cycript.length; 207 | unichar *buffer = malloc(length * sizeof(unichar)); 208 | [cycript getCharacters:buffer range:NSMakeRange(0, length)]; 209 | const uint16_t *characters = buffer; 210 | CydgetMemoryParse(&characters, &length); 211 | JSStringRef expression = JSStringCreateWithCharacters(characters, length); 212 | 213 | // Evaluate the Javascript 214 | JSValueRef exception = NULL; 215 | JSValueRef result = JSEvaluateScript(context, expression, NULL, NULL, 0, &exception); 216 | JSStringRelease(expression); 217 | 218 | // If a result was returned, convert it into an NSString 219 | if (result) { 220 | JSStringRef string = JSValueToStringCopy(context, result, &exception); 221 | if (string) { 222 | resultString = (__bridge_transfer NSString *)JSStringCopyCFString(kCFAllocatorDefault, string); 223 | JSStringRelease(string); 224 | } 225 | } 226 | 227 | // If an exception was thrown, convert it into an NSError 228 | if (exception && error) { 229 | JSObjectRef exceptionObject = JSValueToObject(context, exception, NULL); 230 | 231 | NSInteger line = (NSInteger)JSValueToNumber(context, JSObjectGetProperty(context, exceptionObject, JSStringCreateWithUTF8CString("line"), NULL), NULL); 232 | JSStringRef string = JSValueToStringCopy(context, JSObjectGetProperty(context, exceptionObject, JSStringCreateWithUTF8CString("name"), NULL), NULL); 233 | NSString *name = (__bridge_transfer NSString *)JSStringCopyCFString(kCFAllocatorDefault, string); 234 | JSStringRelease(string); 235 | string = JSValueToStringCopy(context, JSObjectGetProperty(context, exceptionObject, JSStringCreateWithUTF8CString("message"), NULL), NULL); 236 | NSString *message = (__bridge_transfer NSString *)JSStringCopyCFString(kCFAllocatorDefault, string); 237 | JSStringRelease(string); 238 | string = JSValueToStringCopy(context, exception, NULL); 239 | NSString *description = (__bridge_transfer NSString *)JSStringCopyCFString(kCFAllocatorDefault, string); 240 | JSStringRelease(string); 241 | 242 | NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; 243 | [userInfo setValue:@(line) forKey:CYErrorLineKey]; 244 | [userInfo setValue:name forKey:CYErrorNameKey]; 245 | [userInfo setValue:message forKey:CYErrorMessageKey]; 246 | [userInfo setValue:description forKey:NSLocalizedDescriptionKey]; 247 | *error = [NSError errorWithDomain:@"CYContextDomain" code:0 userInfo:userInfo]; 248 | } 249 | }pthread_mutex_unlock(&cycript_metex); 250 | 251 | return resultString; 252 | } 253 | 254 | - (NSString *)getIPAddress{ 255 | 256 | NSDictionary *addresses = [self getIPAddresses]; 257 | 258 | if([addresses.allKeys containsObject:IOS_WIFI @"/" IP_ADDR_IPv4]){ 259 | return addresses[IOS_WIFI @"/" IP_ADDR_IPv4]; 260 | } 261 | 262 | return nil; 263 | } 264 | 265 | - (NSDictionary *)getIPAddresses{ 266 | NSMutableDictionary *addresses = [NSMutableDictionary dictionaryWithCapacity:8]; 267 | 268 | // retrieve the current interfaces - returns 0 on success 269 | struct ifaddrs *interfaces; 270 | if(!getifaddrs(&interfaces)) { 271 | // Loop through linked list of interfaces 272 | struct ifaddrs *interface; 273 | for(interface=interfaces; interface; interface=interface->ifa_next) { 274 | if(!(interface->ifa_flags & IFF_UP) /* || (interface->ifa_flags & IFF_LOOPBACK) */ ) { 275 | continue; // deeply nested code harder to read 276 | } 277 | const struct sockaddr_in *addr = (const struct sockaddr_in*)interface->ifa_addr; 278 | char addrBuf[ MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) ]; 279 | if(addr && (addr->sin_family==AF_INET || addr->sin_family==AF_INET6)) { 280 | NSString *name = [NSString stringWithUTF8String:interface->ifa_name]; 281 | NSString *type; 282 | if(addr->sin_family == AF_INET) { 283 | if(inet_ntop(AF_INET, &addr->sin_addr, addrBuf, INET_ADDRSTRLEN)) { 284 | type = IP_ADDR_IPv4; 285 | } 286 | } else { 287 | const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6*)interface->ifa_addr; 288 | if(inet_ntop(AF_INET6, &addr6->sin6_addr, addrBuf, INET6_ADDRSTRLEN)) { 289 | type = IP_ADDR_IPv6; 290 | } 291 | } 292 | if(type) { 293 | NSString *key = [NSString stringWithFormat:@"%@/%@", name, type]; 294 | addresses[key] = [NSString stringWithUTF8String:addrBuf]; 295 | } 296 | } 297 | } 298 | // Free memory 299 | freeifaddrs(interfaces); 300 | } 301 | return [addresses count] ? addresses : nil; 302 | } 303 | 304 | @end 305 | 306 | #endif 307 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/a1a2-selectortramps-x86_64.s: -------------------------------------------------------------------------------- 1 | /* 2 | * a1a2-selectortramps-x86_64.s 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifdef __x86_64__ 23 | 24 | #include 25 | #include "selectortramps.mac" 26 | 27 | .text 28 | .private_extern __a1a2_selectorTrampHead 29 | .private_extern __a1a2_firstSelectorTramp 30 | .private_extern __a1a2_nextSelectorTramp 31 | .private_extern __a1a2_selectorTrampEnd 32 | 33 | .align PAGE_SHIFT 34 | __a1a2_selectorTrampHead: 35 | // 1. selector 36 | popq %r10 37 | andq $0xFFFFFFFFFFFFFFF8, %r10 38 | subq $ PAGE_SIZE, %r10 39 | movq (%r10), %rsi // selector -> _cmd 40 | // 2. msgSend 41 | INIT_PIC(__a1a2_selectorTrampHead) 42 | PRELOAD(__a1a2_selectorTrampHead, __a1a2_selectorTrampHead) 43 | subq $ PAGE_SIZE, LABEL_ADDR(__a1a2_selectorTrampHead, __a1a2_selectorTrampHead) 44 | END_PIC() 45 | jmp *0(%r10) // tail call msgSend 46 | 47 | .macro TrampolineEntry 48 | callq __a1a2_selectorTrampHead 49 | nop 50 | nop 51 | nop 52 | .endmacro 53 | 54 | .align 5 55 | __a1a2_firstSelectorTramp: 56 | TrampolineEntry 57 | __a1a2_nextSelectorTramp: 58 | TrampolineEntry 59 | TrampolineEntry 60 | TrampolineEntry 61 | TrampolineEntry 62 | TrampolineEntry 63 | TrampolineEntry 64 | TrampolineEntry 65 | TrampolineEntry 66 | TrampolineEntry 67 | TrampolineEntry 68 | TrampolineEntry 69 | TrampolineEntry 70 | TrampolineEntry 71 | TrampolineEntry 72 | TrampolineEntry 73 | TrampolineEntry 74 | TrampolineEntry 75 | TrampolineEntry 76 | TrampolineEntry 77 | TrampolineEntry 78 | TrampolineEntry 79 | TrampolineEntry 80 | TrampolineEntry 81 | TrampolineEntry 82 | TrampolineEntry 83 | TrampolineEntry 84 | TrampolineEntry 85 | TrampolineEntry 86 | TrampolineEntry 87 | TrampolineEntry 88 | TrampolineEntry 89 | TrampolineEntry 90 | TrampolineEntry 91 | TrampolineEntry 92 | TrampolineEntry 93 | TrampolineEntry 94 | TrampolineEntry 95 | TrampolineEntry 96 | TrampolineEntry 97 | TrampolineEntry 98 | TrampolineEntry 99 | TrampolineEntry 100 | TrampolineEntry 101 | TrampolineEntry 102 | TrampolineEntry 103 | TrampolineEntry 104 | TrampolineEntry 105 | TrampolineEntry 106 | TrampolineEntry 107 | TrampolineEntry 108 | TrampolineEntry 109 | TrampolineEntry 110 | TrampolineEntry 111 | TrampolineEntry 112 | TrampolineEntry 113 | TrampolineEntry 114 | TrampolineEntry 115 | TrampolineEntry 116 | TrampolineEntry 117 | TrampolineEntry 118 | TrampolineEntry 119 | TrampolineEntry 120 | TrampolineEntry 121 | TrampolineEntry 122 | TrampolineEntry 123 | TrampolineEntry 124 | TrampolineEntry 125 | TrampolineEntry 126 | TrampolineEntry 127 | TrampolineEntry 128 | TrampolineEntry 129 | TrampolineEntry 130 | TrampolineEntry 131 | TrampolineEntry 132 | TrampolineEntry 133 | TrampolineEntry 134 | TrampolineEntry 135 | TrampolineEntry 136 | TrampolineEntry 137 | TrampolineEntry 138 | TrampolineEntry 139 | TrampolineEntry 140 | TrampolineEntry 141 | TrampolineEntry 142 | TrampolineEntry 143 | TrampolineEntry 144 | TrampolineEntry 145 | TrampolineEntry 146 | TrampolineEntry 147 | TrampolineEntry 148 | TrampolineEntry 149 | TrampolineEntry 150 | TrampolineEntry 151 | TrampolineEntry 152 | TrampolineEntry 153 | TrampolineEntry 154 | TrampolineEntry 155 | TrampolineEntry 156 | TrampolineEntry 157 | TrampolineEntry 158 | TrampolineEntry 159 | TrampolineEntry 160 | TrampolineEntry 161 | TrampolineEntry 162 | TrampolineEntry 163 | TrampolineEntry 164 | TrampolineEntry 165 | TrampolineEntry 166 | TrampolineEntry 167 | TrampolineEntry 168 | TrampolineEntry 169 | TrampolineEntry 170 | TrampolineEntry 171 | TrampolineEntry 172 | TrampolineEntry 173 | TrampolineEntry 174 | TrampolineEntry 175 | TrampolineEntry 176 | TrampolineEntry 177 | TrampolineEntry 178 | TrampolineEntry 179 | TrampolineEntry 180 | TrampolineEntry 181 | TrampolineEntry 182 | TrampolineEntry 183 | TrampolineEntry 184 | TrampolineEntry 185 | TrampolineEntry 186 | TrampolineEntry 187 | TrampolineEntry 188 | TrampolineEntry 189 | TrampolineEntry 190 | TrampolineEntry 191 | TrampolineEntry 192 | TrampolineEntry 193 | TrampolineEntry 194 | TrampolineEntry 195 | TrampolineEntry 196 | TrampolineEntry 197 | TrampolineEntry 198 | TrampolineEntry 199 | TrampolineEntry 200 | TrampolineEntry 201 | TrampolineEntry 202 | TrampolineEntry 203 | TrampolineEntry 204 | TrampolineEntry 205 | TrampolineEntry 206 | TrampolineEntry 207 | TrampolineEntry 208 | TrampolineEntry 209 | TrampolineEntry 210 | TrampolineEntry 211 | TrampolineEntry 212 | TrampolineEntry 213 | TrampolineEntry 214 | TrampolineEntry 215 | TrampolineEntry 216 | TrampolineEntry 217 | TrampolineEntry 218 | TrampolineEntry 219 | TrampolineEntry 220 | TrampolineEntry 221 | TrampolineEntry 222 | TrampolineEntry 223 | TrampolineEntry 224 | TrampolineEntry 225 | TrampolineEntry 226 | TrampolineEntry 227 | TrampolineEntry 228 | TrampolineEntry 229 | TrampolineEntry 230 | TrampolineEntry 231 | TrampolineEntry 232 | TrampolineEntry 233 | TrampolineEntry 234 | TrampolineEntry 235 | TrampolineEntry 236 | TrampolineEntry 237 | TrampolineEntry 238 | TrampolineEntry 239 | TrampolineEntry 240 | TrampolineEntry 241 | TrampolineEntry 242 | TrampolineEntry 243 | TrampolineEntry 244 | TrampolineEntry 245 | TrampolineEntry 246 | TrampolineEntry 247 | TrampolineEntry 248 | TrampolineEntry 249 | TrampolineEntry 250 | TrampolineEntry 251 | TrampolineEntry 252 | TrampolineEntry 253 | TrampolineEntry 254 | TrampolineEntry 255 | TrampolineEntry 256 | TrampolineEntry 257 | TrampolineEntry 258 | TrampolineEntry 259 | TrampolineEntry 260 | TrampolineEntry 261 | TrampolineEntry 262 | TrampolineEntry 263 | TrampolineEntry 264 | TrampolineEntry 265 | TrampolineEntry 266 | TrampolineEntry 267 | TrampolineEntry 268 | TrampolineEntry 269 | TrampolineEntry 270 | TrampolineEntry 271 | TrampolineEntry 272 | TrampolineEntry 273 | TrampolineEntry 274 | TrampolineEntry 275 | TrampolineEntry 276 | TrampolineEntry 277 | TrampolineEntry 278 | TrampolineEntry 279 | TrampolineEntry 280 | TrampolineEntry 281 | TrampolineEntry 282 | TrampolineEntry 283 | TrampolineEntry 284 | TrampolineEntry 285 | TrampolineEntry 286 | TrampolineEntry 287 | TrampolineEntry 288 | TrampolineEntry 289 | TrampolineEntry 290 | TrampolineEntry 291 | TrampolineEntry 292 | TrampolineEntry 293 | TrampolineEntry 294 | TrampolineEntry 295 | TrampolineEntry 296 | TrampolineEntry 297 | TrampolineEntry 298 | TrampolineEntry 299 | TrampolineEntry 300 | TrampolineEntry 301 | TrampolineEntry 302 | TrampolineEntry 303 | TrampolineEntry 304 | TrampolineEntry 305 | TrampolineEntry 306 | TrampolineEntry 307 | TrampolineEntry 308 | TrampolineEntry 309 | TrampolineEntry 310 | TrampolineEntry 311 | TrampolineEntry 312 | TrampolineEntry 313 | TrampolineEntry 314 | TrampolineEntry 315 | TrampolineEntry 316 | TrampolineEntry 317 | TrampolineEntry 318 | TrampolineEntry 319 | TrampolineEntry 320 | TrampolineEntry 321 | TrampolineEntry 322 | TrampolineEntry 323 | TrampolineEntry 324 | TrampolineEntry 325 | TrampolineEntry 326 | TrampolineEntry 327 | TrampolineEntry 328 | TrampolineEntry 329 | TrampolineEntry 330 | TrampolineEntry 331 | TrampolineEntry 332 | TrampolineEntry 333 | TrampolineEntry 334 | TrampolineEntry 335 | TrampolineEntry 336 | TrampolineEntry 337 | TrampolineEntry 338 | TrampolineEntry 339 | TrampolineEntry 340 | TrampolineEntry 341 | TrampolineEntry 342 | TrampolineEntry 343 | TrampolineEntry 344 | TrampolineEntry 345 | TrampolineEntry 346 | TrampolineEntry 347 | TrampolineEntry 348 | TrampolineEntry 349 | TrampolineEntry 350 | TrampolineEntry 351 | TrampolineEntry 352 | TrampolineEntry 353 | TrampolineEntry 354 | TrampolineEntry 355 | TrampolineEntry 356 | TrampolineEntry 357 | TrampolineEntry 358 | TrampolineEntry 359 | TrampolineEntry 360 | TrampolineEntry 361 | TrampolineEntry 362 | TrampolineEntry 363 | TrampolineEntry 364 | TrampolineEntry 365 | TrampolineEntry 366 | TrampolineEntry 367 | TrampolineEntry 368 | TrampolineEntry 369 | TrampolineEntry 370 | TrampolineEntry 371 | TrampolineEntry 372 | TrampolineEntry 373 | TrampolineEntry 374 | TrampolineEntry 375 | TrampolineEntry 376 | TrampolineEntry 377 | TrampolineEntry 378 | TrampolineEntry 379 | TrampolineEntry 380 | TrampolineEntry 381 | TrampolineEntry 382 | TrampolineEntry 383 | TrampolineEntry 384 | TrampolineEntry 385 | TrampolineEntry 386 | TrampolineEntry 387 | TrampolineEntry 388 | TrampolineEntry 389 | TrampolineEntry 390 | TrampolineEntry 391 | TrampolineEntry 392 | TrampolineEntry 393 | TrampolineEntry 394 | TrampolineEntry 395 | TrampolineEntry 396 | TrampolineEntry 397 | TrampolineEntry 398 | TrampolineEntry 399 | TrampolineEntry 400 | TrampolineEntry 401 | TrampolineEntry 402 | TrampolineEntry 403 | TrampolineEntry 404 | TrampolineEntry 405 | TrampolineEntry 406 | TrampolineEntry 407 | TrampolineEntry 408 | TrampolineEntry 409 | TrampolineEntry 410 | TrampolineEntry 411 | TrampolineEntry 412 | TrampolineEntry 413 | TrampolineEntry 414 | TrampolineEntry 415 | TrampolineEntry 416 | TrampolineEntry 417 | TrampolineEntry 418 | TrampolineEntry 419 | TrampolineEntry 420 | TrampolineEntry 421 | TrampolineEntry 422 | TrampolineEntry 423 | TrampolineEntry 424 | TrampolineEntry 425 | TrampolineEntry 426 | TrampolineEntry 427 | TrampolineEntry 428 | TrampolineEntry 429 | TrampolineEntry 430 | TrampolineEntry 431 | TrampolineEntry 432 | TrampolineEntry 433 | TrampolineEntry 434 | TrampolineEntry 435 | TrampolineEntry 436 | TrampolineEntry 437 | TrampolineEntry 438 | TrampolineEntry 439 | TrampolineEntry 440 | TrampolineEntry 441 | TrampolineEntry 442 | TrampolineEntry 443 | TrampolineEntry 444 | TrampolineEntry 445 | TrampolineEntry 446 | TrampolineEntry 447 | TrampolineEntry 448 | TrampolineEntry 449 | TrampolineEntry 450 | TrampolineEntry 451 | TrampolineEntry 452 | TrampolineEntry 453 | TrampolineEntry 454 | TrampolineEntry 455 | TrampolineEntry 456 | TrampolineEntry 457 | TrampolineEntry 458 | TrampolineEntry 459 | TrampolineEntry 460 | TrampolineEntry 461 | TrampolineEntry 462 | TrampolineEntry 463 | TrampolineEntry 464 | TrampolineEntry 465 | TrampolineEntry 466 | TrampolineEntry 467 | TrampolineEntry 468 | TrampolineEntry 469 | TrampolineEntry 470 | TrampolineEntry 471 | TrampolineEntry 472 | TrampolineEntry 473 | TrampolineEntry 474 | TrampolineEntry 475 | TrampolineEntry 476 | TrampolineEntry 477 | TrampolineEntry 478 | TrampolineEntry 479 | TrampolineEntry 480 | TrampolineEntry 481 | TrampolineEntry 482 | TrampolineEntry 483 | TrampolineEntry 484 | TrampolineEntry 485 | TrampolineEntry 486 | TrampolineEntry 487 | TrampolineEntry 488 | TrampolineEntry 489 | TrampolineEntry 490 | TrampolineEntry 491 | TrampolineEntry 492 | TrampolineEntry 493 | TrampolineEntry 494 | TrampolineEntry 495 | TrampolineEntry 496 | TrampolineEntry 497 | TrampolineEntry 498 | TrampolineEntry 499 | TrampolineEntry 500 | TrampolineEntry 501 | TrampolineEntry 502 | TrampolineEntry 503 | TrampolineEntry 504 | TrampolineEntry 505 | TrampolineEntry 506 | TrampolineEntry 507 | TrampolineEntry 508 | TrampolineEntry 509 | TrampolineEntry 510 | TrampolineEntry 511 | TrampolineEntry 512 | TrampolineEntry 513 | TrampolineEntry 514 | TrampolineEntry 515 | TrampolineEntry 516 | TrampolineEntry 517 | TrampolineEntry 518 | TrampolineEntry 519 | TrampolineEntry 520 | TrampolineEntry 521 | TrampolineEntry 522 | TrampolineEntry 523 | TrampolineEntry 524 | TrampolineEntry 525 | TrampolineEntry 526 | TrampolineEntry 527 | TrampolineEntry 528 | TrampolineEntry 529 | TrampolineEntry 530 | TrampolineEntry 531 | TrampolineEntry 532 | TrampolineEntry 533 | TrampolineEntry 534 | TrampolineEntry 535 | TrampolineEntry 536 | TrampolineEntry 537 | TrampolineEntry 538 | TrampolineEntry 539 | TrampolineEntry 540 | TrampolineEntry 541 | TrampolineEntry 542 | TrampolineEntry 543 | TrampolineEntry 544 | TrampolineEntry 545 | TrampolineEntry 546 | TrampolineEntry 547 | TrampolineEntry 548 | TrampolineEntry 549 | TrampolineEntry 550 | TrampolineEntry 551 | TrampolineEntry 552 | TrampolineEntry 553 | TrampolineEntry 554 | TrampolineEntry 555 | TrampolineEntry 556 | TrampolineEntry 557 | TrampolineEntry 558 | TrampolineEntry 559 | TrampolineEntry 560 | TrampolineEntry 561 | // TrampolineEntry 562 | // TrampolineEntry 563 | // TrampolineEntry 564 | // TrampolineEntry 565 | 566 | __a1a2_selectorTrampEnd: 567 | 568 | #endif 569 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/a2a3-selectortramps-x86_64.s: -------------------------------------------------------------------------------- 1 | /* 2 | * a2a3-selectortramps-x86_64.s 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifdef __x86_64__ 23 | 24 | #include 25 | #include "selectortramps.mac" 26 | 27 | .text 28 | .private_extern __a2a3_selectorTrampHead 29 | .private_extern __a2a3_firstSelectorTramp 30 | .private_extern __a2a3_nextSelectorTramp 31 | .private_extern __a2a3_selectorTrampEnd 32 | 33 | .align PAGE_SHIFT 34 | __a2a3_selectorTrampHead: 35 | // 1. selector 36 | popq %r10 37 | andq $0xFFFFFFFFFFFFFFF8, %r10 38 | subq $ PAGE_SIZE, %r10 39 | movq (%r10), %rdx // selector -> _cmd 40 | // 2. msgSend 41 | INIT_PIC(__a2a3_selectorTrampHead) 42 | PRELOAD(__a2a3_selectorTrampHead, __a2a3_selectorTrampHead) 43 | subq $ PAGE_SIZE, LABEL_ADDR(__a2a3_selectorTrampHead, __a2a3_selectorTrampHead) 44 | END_PIC() 45 | jmp *0(%r10) // tail call msgSend 46 | 47 | .macro TrampolineEntry 48 | callq __a2a3_selectorTrampHead 49 | nop 50 | nop 51 | nop 52 | .endmacro 53 | 54 | .align 5 55 | __a2a3_firstSelectorTramp: 56 | TrampolineEntry 57 | __a2a3_nextSelectorTramp: 58 | TrampolineEntry 59 | TrampolineEntry 60 | TrampolineEntry 61 | TrampolineEntry 62 | TrampolineEntry 63 | TrampolineEntry 64 | TrampolineEntry 65 | TrampolineEntry 66 | TrampolineEntry 67 | TrampolineEntry 68 | TrampolineEntry 69 | TrampolineEntry 70 | TrampolineEntry 71 | TrampolineEntry 72 | TrampolineEntry 73 | TrampolineEntry 74 | TrampolineEntry 75 | TrampolineEntry 76 | TrampolineEntry 77 | TrampolineEntry 78 | TrampolineEntry 79 | TrampolineEntry 80 | TrampolineEntry 81 | TrampolineEntry 82 | TrampolineEntry 83 | TrampolineEntry 84 | TrampolineEntry 85 | TrampolineEntry 86 | TrampolineEntry 87 | TrampolineEntry 88 | TrampolineEntry 89 | TrampolineEntry 90 | TrampolineEntry 91 | TrampolineEntry 92 | TrampolineEntry 93 | TrampolineEntry 94 | TrampolineEntry 95 | TrampolineEntry 96 | TrampolineEntry 97 | TrampolineEntry 98 | TrampolineEntry 99 | TrampolineEntry 100 | TrampolineEntry 101 | TrampolineEntry 102 | TrampolineEntry 103 | TrampolineEntry 104 | TrampolineEntry 105 | TrampolineEntry 106 | TrampolineEntry 107 | TrampolineEntry 108 | TrampolineEntry 109 | TrampolineEntry 110 | TrampolineEntry 111 | TrampolineEntry 112 | TrampolineEntry 113 | TrampolineEntry 114 | TrampolineEntry 115 | TrampolineEntry 116 | TrampolineEntry 117 | TrampolineEntry 118 | TrampolineEntry 119 | TrampolineEntry 120 | TrampolineEntry 121 | TrampolineEntry 122 | TrampolineEntry 123 | TrampolineEntry 124 | TrampolineEntry 125 | TrampolineEntry 126 | TrampolineEntry 127 | TrampolineEntry 128 | TrampolineEntry 129 | TrampolineEntry 130 | TrampolineEntry 131 | TrampolineEntry 132 | TrampolineEntry 133 | TrampolineEntry 134 | TrampolineEntry 135 | TrampolineEntry 136 | TrampolineEntry 137 | TrampolineEntry 138 | TrampolineEntry 139 | TrampolineEntry 140 | TrampolineEntry 141 | TrampolineEntry 142 | TrampolineEntry 143 | TrampolineEntry 144 | TrampolineEntry 145 | TrampolineEntry 146 | TrampolineEntry 147 | TrampolineEntry 148 | TrampolineEntry 149 | TrampolineEntry 150 | TrampolineEntry 151 | TrampolineEntry 152 | TrampolineEntry 153 | TrampolineEntry 154 | TrampolineEntry 155 | TrampolineEntry 156 | TrampolineEntry 157 | TrampolineEntry 158 | TrampolineEntry 159 | TrampolineEntry 160 | TrampolineEntry 161 | TrampolineEntry 162 | TrampolineEntry 163 | TrampolineEntry 164 | TrampolineEntry 165 | TrampolineEntry 166 | TrampolineEntry 167 | TrampolineEntry 168 | TrampolineEntry 169 | TrampolineEntry 170 | TrampolineEntry 171 | TrampolineEntry 172 | TrampolineEntry 173 | TrampolineEntry 174 | TrampolineEntry 175 | TrampolineEntry 176 | TrampolineEntry 177 | TrampolineEntry 178 | TrampolineEntry 179 | TrampolineEntry 180 | TrampolineEntry 181 | TrampolineEntry 182 | TrampolineEntry 183 | TrampolineEntry 184 | TrampolineEntry 185 | TrampolineEntry 186 | TrampolineEntry 187 | TrampolineEntry 188 | TrampolineEntry 189 | TrampolineEntry 190 | TrampolineEntry 191 | TrampolineEntry 192 | TrampolineEntry 193 | TrampolineEntry 194 | TrampolineEntry 195 | TrampolineEntry 196 | TrampolineEntry 197 | TrampolineEntry 198 | TrampolineEntry 199 | TrampolineEntry 200 | TrampolineEntry 201 | TrampolineEntry 202 | TrampolineEntry 203 | TrampolineEntry 204 | TrampolineEntry 205 | TrampolineEntry 206 | TrampolineEntry 207 | TrampolineEntry 208 | TrampolineEntry 209 | TrampolineEntry 210 | TrampolineEntry 211 | TrampolineEntry 212 | TrampolineEntry 213 | TrampolineEntry 214 | TrampolineEntry 215 | TrampolineEntry 216 | TrampolineEntry 217 | TrampolineEntry 218 | TrampolineEntry 219 | TrampolineEntry 220 | TrampolineEntry 221 | TrampolineEntry 222 | TrampolineEntry 223 | TrampolineEntry 224 | TrampolineEntry 225 | TrampolineEntry 226 | TrampolineEntry 227 | TrampolineEntry 228 | TrampolineEntry 229 | TrampolineEntry 230 | TrampolineEntry 231 | TrampolineEntry 232 | TrampolineEntry 233 | TrampolineEntry 234 | TrampolineEntry 235 | TrampolineEntry 236 | TrampolineEntry 237 | TrampolineEntry 238 | TrampolineEntry 239 | TrampolineEntry 240 | TrampolineEntry 241 | TrampolineEntry 242 | TrampolineEntry 243 | TrampolineEntry 244 | TrampolineEntry 245 | TrampolineEntry 246 | TrampolineEntry 247 | TrampolineEntry 248 | TrampolineEntry 249 | TrampolineEntry 250 | TrampolineEntry 251 | TrampolineEntry 252 | TrampolineEntry 253 | TrampolineEntry 254 | TrampolineEntry 255 | TrampolineEntry 256 | TrampolineEntry 257 | TrampolineEntry 258 | TrampolineEntry 259 | TrampolineEntry 260 | TrampolineEntry 261 | TrampolineEntry 262 | TrampolineEntry 263 | TrampolineEntry 264 | TrampolineEntry 265 | TrampolineEntry 266 | TrampolineEntry 267 | TrampolineEntry 268 | TrampolineEntry 269 | TrampolineEntry 270 | TrampolineEntry 271 | TrampolineEntry 272 | TrampolineEntry 273 | TrampolineEntry 274 | TrampolineEntry 275 | TrampolineEntry 276 | TrampolineEntry 277 | TrampolineEntry 278 | TrampolineEntry 279 | TrampolineEntry 280 | TrampolineEntry 281 | TrampolineEntry 282 | TrampolineEntry 283 | TrampolineEntry 284 | TrampolineEntry 285 | TrampolineEntry 286 | TrampolineEntry 287 | TrampolineEntry 288 | TrampolineEntry 289 | TrampolineEntry 290 | TrampolineEntry 291 | TrampolineEntry 292 | TrampolineEntry 293 | TrampolineEntry 294 | TrampolineEntry 295 | TrampolineEntry 296 | TrampolineEntry 297 | TrampolineEntry 298 | TrampolineEntry 299 | TrampolineEntry 300 | TrampolineEntry 301 | TrampolineEntry 302 | TrampolineEntry 303 | TrampolineEntry 304 | TrampolineEntry 305 | TrampolineEntry 306 | TrampolineEntry 307 | TrampolineEntry 308 | TrampolineEntry 309 | TrampolineEntry 310 | TrampolineEntry 311 | TrampolineEntry 312 | TrampolineEntry 313 | TrampolineEntry 314 | TrampolineEntry 315 | TrampolineEntry 316 | TrampolineEntry 317 | TrampolineEntry 318 | TrampolineEntry 319 | TrampolineEntry 320 | TrampolineEntry 321 | TrampolineEntry 322 | TrampolineEntry 323 | TrampolineEntry 324 | TrampolineEntry 325 | TrampolineEntry 326 | TrampolineEntry 327 | TrampolineEntry 328 | TrampolineEntry 329 | TrampolineEntry 330 | TrampolineEntry 331 | TrampolineEntry 332 | TrampolineEntry 333 | TrampolineEntry 334 | TrampolineEntry 335 | TrampolineEntry 336 | TrampolineEntry 337 | TrampolineEntry 338 | TrampolineEntry 339 | TrampolineEntry 340 | TrampolineEntry 341 | TrampolineEntry 342 | TrampolineEntry 343 | TrampolineEntry 344 | TrampolineEntry 345 | TrampolineEntry 346 | TrampolineEntry 347 | TrampolineEntry 348 | TrampolineEntry 349 | TrampolineEntry 350 | TrampolineEntry 351 | TrampolineEntry 352 | TrampolineEntry 353 | TrampolineEntry 354 | TrampolineEntry 355 | TrampolineEntry 356 | TrampolineEntry 357 | TrampolineEntry 358 | TrampolineEntry 359 | TrampolineEntry 360 | TrampolineEntry 361 | TrampolineEntry 362 | TrampolineEntry 363 | TrampolineEntry 364 | TrampolineEntry 365 | TrampolineEntry 366 | TrampolineEntry 367 | TrampolineEntry 368 | TrampolineEntry 369 | TrampolineEntry 370 | TrampolineEntry 371 | TrampolineEntry 372 | TrampolineEntry 373 | TrampolineEntry 374 | TrampolineEntry 375 | TrampolineEntry 376 | TrampolineEntry 377 | TrampolineEntry 378 | TrampolineEntry 379 | TrampolineEntry 380 | TrampolineEntry 381 | TrampolineEntry 382 | TrampolineEntry 383 | TrampolineEntry 384 | TrampolineEntry 385 | TrampolineEntry 386 | TrampolineEntry 387 | TrampolineEntry 388 | TrampolineEntry 389 | TrampolineEntry 390 | TrampolineEntry 391 | TrampolineEntry 392 | TrampolineEntry 393 | TrampolineEntry 394 | TrampolineEntry 395 | TrampolineEntry 396 | TrampolineEntry 397 | TrampolineEntry 398 | TrampolineEntry 399 | TrampolineEntry 400 | TrampolineEntry 401 | TrampolineEntry 402 | TrampolineEntry 403 | TrampolineEntry 404 | TrampolineEntry 405 | TrampolineEntry 406 | TrampolineEntry 407 | TrampolineEntry 408 | TrampolineEntry 409 | TrampolineEntry 410 | TrampolineEntry 411 | TrampolineEntry 412 | TrampolineEntry 413 | TrampolineEntry 414 | TrampolineEntry 415 | TrampolineEntry 416 | TrampolineEntry 417 | TrampolineEntry 418 | TrampolineEntry 419 | TrampolineEntry 420 | TrampolineEntry 421 | TrampolineEntry 422 | TrampolineEntry 423 | TrampolineEntry 424 | TrampolineEntry 425 | TrampolineEntry 426 | TrampolineEntry 427 | TrampolineEntry 428 | TrampolineEntry 429 | TrampolineEntry 430 | TrampolineEntry 431 | TrampolineEntry 432 | TrampolineEntry 433 | TrampolineEntry 434 | TrampolineEntry 435 | TrampolineEntry 436 | TrampolineEntry 437 | TrampolineEntry 438 | TrampolineEntry 439 | TrampolineEntry 440 | TrampolineEntry 441 | TrampolineEntry 442 | TrampolineEntry 443 | TrampolineEntry 444 | TrampolineEntry 445 | TrampolineEntry 446 | TrampolineEntry 447 | TrampolineEntry 448 | TrampolineEntry 449 | TrampolineEntry 450 | TrampolineEntry 451 | TrampolineEntry 452 | TrampolineEntry 453 | TrampolineEntry 454 | TrampolineEntry 455 | TrampolineEntry 456 | TrampolineEntry 457 | TrampolineEntry 458 | TrampolineEntry 459 | TrampolineEntry 460 | TrampolineEntry 461 | TrampolineEntry 462 | TrampolineEntry 463 | TrampolineEntry 464 | TrampolineEntry 465 | TrampolineEntry 466 | TrampolineEntry 467 | TrampolineEntry 468 | TrampolineEntry 469 | TrampolineEntry 470 | TrampolineEntry 471 | TrampolineEntry 472 | TrampolineEntry 473 | TrampolineEntry 474 | TrampolineEntry 475 | TrampolineEntry 476 | TrampolineEntry 477 | TrampolineEntry 478 | TrampolineEntry 479 | TrampolineEntry 480 | TrampolineEntry 481 | TrampolineEntry 482 | TrampolineEntry 483 | TrampolineEntry 484 | TrampolineEntry 485 | TrampolineEntry 486 | TrampolineEntry 487 | TrampolineEntry 488 | TrampolineEntry 489 | TrampolineEntry 490 | TrampolineEntry 491 | TrampolineEntry 492 | TrampolineEntry 493 | TrampolineEntry 494 | TrampolineEntry 495 | TrampolineEntry 496 | TrampolineEntry 497 | TrampolineEntry 498 | TrampolineEntry 499 | TrampolineEntry 500 | TrampolineEntry 501 | TrampolineEntry 502 | TrampolineEntry 503 | TrampolineEntry 504 | TrampolineEntry 505 | TrampolineEntry 506 | TrampolineEntry 507 | TrampolineEntry 508 | TrampolineEntry 509 | TrampolineEntry 510 | TrampolineEntry 511 | TrampolineEntry 512 | TrampolineEntry 513 | TrampolineEntry 514 | TrampolineEntry 515 | TrampolineEntry 516 | TrampolineEntry 517 | TrampolineEntry 518 | TrampolineEntry 519 | TrampolineEntry 520 | TrampolineEntry 521 | TrampolineEntry 522 | TrampolineEntry 523 | TrampolineEntry 524 | TrampolineEntry 525 | TrampolineEntry 526 | TrampolineEntry 527 | TrampolineEntry 528 | TrampolineEntry 529 | TrampolineEntry 530 | TrampolineEntry 531 | TrampolineEntry 532 | TrampolineEntry 533 | TrampolineEntry 534 | TrampolineEntry 535 | TrampolineEntry 536 | TrampolineEntry 537 | TrampolineEntry 538 | TrampolineEntry 539 | TrampolineEntry 540 | TrampolineEntry 541 | TrampolineEntry 542 | TrampolineEntry 543 | TrampolineEntry 544 | TrampolineEntry 545 | TrampolineEntry 546 | TrampolineEntry 547 | TrampolineEntry 548 | TrampolineEntry 549 | TrampolineEntry 550 | TrampolineEntry 551 | TrampolineEntry 552 | TrampolineEntry 553 | TrampolineEntry 554 | TrampolineEntry 555 | TrampolineEntry 556 | TrampolineEntry 557 | TrampolineEntry 558 | TrampolineEntry 559 | TrampolineEntry 560 | TrampolineEntry 561 | // TrampolineEntry 562 | // TrampolineEntry 563 | // TrampolineEntry 564 | // TrampolineEntry 565 | 566 | __a2a3_selectorTrampEnd: 567 | 568 | #endif 569 | -------------------------------------------------------------------------------- /MonkeyAppLibrary.xctemplate/Trace/a2a3-selectortramps-i386.s: -------------------------------------------------------------------------------- 1 | /* 2 | * a2a3-selectortramps-i386.s 3 | * OCMethodTrace 4 | * 5 | * https://github.com/omxcodec/OCMethodTrace.git 6 | * 7 | * Copyright (C) 2018 Michael Chen 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifdef __i386__ 23 | 24 | #include 25 | #include "selectortramps.mac" 26 | 27 | .text 28 | .private_extern __a2a3_selectorTrampHead 29 | .private_extern __a2a3_firstSelectorTramp 30 | .private_extern __a2a3_nextSelectorTramp 31 | .private_extern __a2a3_selectorTrampEnd 32 | 33 | .align PAGE_SHIFT 34 | __a2a3_selectorTrampHead: 35 | // 1. selector 36 | popl %eax 37 | andl $0xFFFFFFF8, %eax 38 | subl $ PAGE_SIZE, %eax 39 | movl (%eax), %ecx // selectorPtr -> ecx 40 | movl %ecx, 12(%esp) // ecx -> _cmd 41 | // 2. msgSend 42 | INIT_PIC(__a2a3_selectorTrampHead) 43 | PRELOAD(__a2a3_selectorTrampHead, __a2a3_selectorTrampHead) 44 | subl $ PAGE_SIZE, LABEL_ADDR(__a2a3_selectorTrampHead, __a2a3_selectorTrampHead) 45 | END_PIC() 46 | jmp *0(%eax) // tail call msgSend 47 | 48 | .macro TrampolineEntry 49 | call __a2a3_selectorTrampHead 50 | nop 51 | nop 52 | nop 53 | .endmacro 54 | 55 | .align 5 56 | __a2a3_firstSelectorTramp: 57 | TrampolineEntry 58 | __a2a3_nextSelectorTramp: 59 | TrampolineEntry 60 | TrampolineEntry 61 | TrampolineEntry 62 | TrampolineEntry 63 | TrampolineEntry 64 | TrampolineEntry 65 | TrampolineEntry 66 | TrampolineEntry 67 | TrampolineEntry 68 | TrampolineEntry 69 | TrampolineEntry 70 | TrampolineEntry 71 | TrampolineEntry 72 | TrampolineEntry 73 | TrampolineEntry 74 | TrampolineEntry 75 | TrampolineEntry 76 | TrampolineEntry 77 | TrampolineEntry 78 | TrampolineEntry 79 | TrampolineEntry 80 | TrampolineEntry 81 | TrampolineEntry 82 | TrampolineEntry 83 | TrampolineEntry 84 | TrampolineEntry 85 | TrampolineEntry 86 | TrampolineEntry 87 | TrampolineEntry 88 | TrampolineEntry 89 | TrampolineEntry 90 | TrampolineEntry 91 | TrampolineEntry 92 | TrampolineEntry 93 | TrampolineEntry 94 | TrampolineEntry 95 | TrampolineEntry 96 | TrampolineEntry 97 | TrampolineEntry 98 | TrampolineEntry 99 | TrampolineEntry 100 | TrampolineEntry 101 | TrampolineEntry 102 | TrampolineEntry 103 | TrampolineEntry 104 | TrampolineEntry 105 | TrampolineEntry 106 | TrampolineEntry 107 | TrampolineEntry 108 | TrampolineEntry 109 | TrampolineEntry 110 | TrampolineEntry 111 | TrampolineEntry 112 | TrampolineEntry 113 | TrampolineEntry 114 | TrampolineEntry 115 | TrampolineEntry 116 | TrampolineEntry 117 | TrampolineEntry 118 | TrampolineEntry 119 | TrampolineEntry 120 | TrampolineEntry 121 | TrampolineEntry 122 | TrampolineEntry 123 | TrampolineEntry 124 | TrampolineEntry 125 | TrampolineEntry 126 | TrampolineEntry 127 | TrampolineEntry 128 | TrampolineEntry 129 | TrampolineEntry 130 | TrampolineEntry 131 | TrampolineEntry 132 | TrampolineEntry 133 | TrampolineEntry 134 | TrampolineEntry 135 | TrampolineEntry 136 | TrampolineEntry 137 | TrampolineEntry 138 | TrampolineEntry 139 | TrampolineEntry 140 | TrampolineEntry 141 | TrampolineEntry 142 | TrampolineEntry 143 | TrampolineEntry 144 | TrampolineEntry 145 | TrampolineEntry 146 | TrampolineEntry 147 | TrampolineEntry 148 | TrampolineEntry 149 | TrampolineEntry 150 | TrampolineEntry 151 | TrampolineEntry 152 | TrampolineEntry 153 | TrampolineEntry 154 | TrampolineEntry 155 | TrampolineEntry 156 | TrampolineEntry 157 | TrampolineEntry 158 | TrampolineEntry 159 | TrampolineEntry 160 | TrampolineEntry 161 | TrampolineEntry 162 | TrampolineEntry 163 | TrampolineEntry 164 | TrampolineEntry 165 | TrampolineEntry 166 | TrampolineEntry 167 | TrampolineEntry 168 | TrampolineEntry 169 | TrampolineEntry 170 | TrampolineEntry 171 | TrampolineEntry 172 | TrampolineEntry 173 | TrampolineEntry 174 | TrampolineEntry 175 | TrampolineEntry 176 | TrampolineEntry 177 | TrampolineEntry 178 | TrampolineEntry 179 | TrampolineEntry 180 | TrampolineEntry 181 | TrampolineEntry 182 | TrampolineEntry 183 | TrampolineEntry 184 | TrampolineEntry 185 | TrampolineEntry 186 | TrampolineEntry 187 | TrampolineEntry 188 | TrampolineEntry 189 | TrampolineEntry 190 | TrampolineEntry 191 | TrampolineEntry 192 | TrampolineEntry 193 | TrampolineEntry 194 | TrampolineEntry 195 | TrampolineEntry 196 | TrampolineEntry 197 | TrampolineEntry 198 | TrampolineEntry 199 | TrampolineEntry 200 | TrampolineEntry 201 | TrampolineEntry 202 | TrampolineEntry 203 | TrampolineEntry 204 | TrampolineEntry 205 | TrampolineEntry 206 | TrampolineEntry 207 | TrampolineEntry 208 | TrampolineEntry 209 | TrampolineEntry 210 | TrampolineEntry 211 | TrampolineEntry 212 | TrampolineEntry 213 | TrampolineEntry 214 | TrampolineEntry 215 | TrampolineEntry 216 | TrampolineEntry 217 | TrampolineEntry 218 | TrampolineEntry 219 | TrampolineEntry 220 | TrampolineEntry 221 | TrampolineEntry 222 | TrampolineEntry 223 | TrampolineEntry 224 | TrampolineEntry 225 | TrampolineEntry 226 | TrampolineEntry 227 | TrampolineEntry 228 | TrampolineEntry 229 | TrampolineEntry 230 | TrampolineEntry 231 | TrampolineEntry 232 | TrampolineEntry 233 | TrampolineEntry 234 | TrampolineEntry 235 | TrampolineEntry 236 | TrampolineEntry 237 | TrampolineEntry 238 | TrampolineEntry 239 | TrampolineEntry 240 | TrampolineEntry 241 | TrampolineEntry 242 | TrampolineEntry 243 | TrampolineEntry 244 | TrampolineEntry 245 | TrampolineEntry 246 | TrampolineEntry 247 | TrampolineEntry 248 | TrampolineEntry 249 | TrampolineEntry 250 | TrampolineEntry 251 | TrampolineEntry 252 | TrampolineEntry 253 | TrampolineEntry 254 | TrampolineEntry 255 | TrampolineEntry 256 | TrampolineEntry 257 | TrampolineEntry 258 | TrampolineEntry 259 | TrampolineEntry 260 | TrampolineEntry 261 | TrampolineEntry 262 | TrampolineEntry 263 | TrampolineEntry 264 | TrampolineEntry 265 | TrampolineEntry 266 | TrampolineEntry 267 | TrampolineEntry 268 | TrampolineEntry 269 | TrampolineEntry 270 | TrampolineEntry 271 | TrampolineEntry 272 | TrampolineEntry 273 | TrampolineEntry 274 | TrampolineEntry 275 | TrampolineEntry 276 | TrampolineEntry 277 | TrampolineEntry 278 | TrampolineEntry 279 | TrampolineEntry 280 | TrampolineEntry 281 | TrampolineEntry 282 | TrampolineEntry 283 | TrampolineEntry 284 | TrampolineEntry 285 | TrampolineEntry 286 | TrampolineEntry 287 | TrampolineEntry 288 | TrampolineEntry 289 | TrampolineEntry 290 | TrampolineEntry 291 | TrampolineEntry 292 | TrampolineEntry 293 | TrampolineEntry 294 | TrampolineEntry 295 | TrampolineEntry 296 | TrampolineEntry 297 | TrampolineEntry 298 | TrampolineEntry 299 | TrampolineEntry 300 | TrampolineEntry 301 | TrampolineEntry 302 | TrampolineEntry 303 | TrampolineEntry 304 | TrampolineEntry 305 | TrampolineEntry 306 | TrampolineEntry 307 | TrampolineEntry 308 | TrampolineEntry 309 | TrampolineEntry 310 | TrampolineEntry 311 | TrampolineEntry 312 | TrampolineEntry 313 | TrampolineEntry 314 | TrampolineEntry 315 | TrampolineEntry 316 | TrampolineEntry 317 | TrampolineEntry 318 | TrampolineEntry 319 | TrampolineEntry 320 | TrampolineEntry 321 | TrampolineEntry 322 | TrampolineEntry 323 | TrampolineEntry 324 | TrampolineEntry 325 | TrampolineEntry 326 | TrampolineEntry 327 | TrampolineEntry 328 | TrampolineEntry 329 | TrampolineEntry 330 | TrampolineEntry 331 | TrampolineEntry 332 | TrampolineEntry 333 | TrampolineEntry 334 | TrampolineEntry 335 | TrampolineEntry 336 | TrampolineEntry 337 | TrampolineEntry 338 | TrampolineEntry 339 | TrampolineEntry 340 | TrampolineEntry 341 | TrampolineEntry 342 | TrampolineEntry 343 | TrampolineEntry 344 | TrampolineEntry 345 | TrampolineEntry 346 | TrampolineEntry 347 | TrampolineEntry 348 | TrampolineEntry 349 | TrampolineEntry 350 | TrampolineEntry 351 | TrampolineEntry 352 | TrampolineEntry 353 | TrampolineEntry 354 | TrampolineEntry 355 | TrampolineEntry 356 | TrampolineEntry 357 | TrampolineEntry 358 | TrampolineEntry 359 | TrampolineEntry 360 | TrampolineEntry 361 | TrampolineEntry 362 | TrampolineEntry 363 | TrampolineEntry 364 | TrampolineEntry 365 | TrampolineEntry 366 | TrampolineEntry 367 | TrampolineEntry 368 | TrampolineEntry 369 | TrampolineEntry 370 | TrampolineEntry 371 | TrampolineEntry 372 | TrampolineEntry 373 | TrampolineEntry 374 | TrampolineEntry 375 | TrampolineEntry 376 | TrampolineEntry 377 | TrampolineEntry 378 | TrampolineEntry 379 | TrampolineEntry 380 | TrampolineEntry 381 | TrampolineEntry 382 | TrampolineEntry 383 | TrampolineEntry 384 | TrampolineEntry 385 | TrampolineEntry 386 | TrampolineEntry 387 | TrampolineEntry 388 | TrampolineEntry 389 | TrampolineEntry 390 | TrampolineEntry 391 | TrampolineEntry 392 | TrampolineEntry 393 | TrampolineEntry 394 | TrampolineEntry 395 | TrampolineEntry 396 | TrampolineEntry 397 | TrampolineEntry 398 | TrampolineEntry 399 | TrampolineEntry 400 | TrampolineEntry 401 | TrampolineEntry 402 | TrampolineEntry 403 | TrampolineEntry 404 | TrampolineEntry 405 | TrampolineEntry 406 | TrampolineEntry 407 | TrampolineEntry 408 | TrampolineEntry 409 | TrampolineEntry 410 | TrampolineEntry 411 | TrampolineEntry 412 | TrampolineEntry 413 | TrampolineEntry 414 | TrampolineEntry 415 | TrampolineEntry 416 | TrampolineEntry 417 | TrampolineEntry 418 | TrampolineEntry 419 | TrampolineEntry 420 | TrampolineEntry 421 | TrampolineEntry 422 | TrampolineEntry 423 | TrampolineEntry 424 | TrampolineEntry 425 | TrampolineEntry 426 | TrampolineEntry 427 | TrampolineEntry 428 | TrampolineEntry 429 | TrampolineEntry 430 | TrampolineEntry 431 | TrampolineEntry 432 | TrampolineEntry 433 | TrampolineEntry 434 | TrampolineEntry 435 | TrampolineEntry 436 | TrampolineEntry 437 | TrampolineEntry 438 | TrampolineEntry 439 | TrampolineEntry 440 | TrampolineEntry 441 | TrampolineEntry 442 | TrampolineEntry 443 | TrampolineEntry 444 | TrampolineEntry 445 | TrampolineEntry 446 | TrampolineEntry 447 | TrampolineEntry 448 | TrampolineEntry 449 | TrampolineEntry 450 | TrampolineEntry 451 | TrampolineEntry 452 | TrampolineEntry 453 | TrampolineEntry 454 | TrampolineEntry 455 | TrampolineEntry 456 | TrampolineEntry 457 | TrampolineEntry 458 | TrampolineEntry 459 | TrampolineEntry 460 | TrampolineEntry 461 | TrampolineEntry 462 | TrampolineEntry 463 | TrampolineEntry 464 | TrampolineEntry 465 | TrampolineEntry 466 | TrampolineEntry 467 | TrampolineEntry 468 | TrampolineEntry 469 | TrampolineEntry 470 | TrampolineEntry 471 | TrampolineEntry 472 | TrampolineEntry 473 | TrampolineEntry 474 | TrampolineEntry 475 | TrampolineEntry 476 | TrampolineEntry 477 | TrampolineEntry 478 | TrampolineEntry 479 | TrampolineEntry 480 | TrampolineEntry 481 | TrampolineEntry 482 | TrampolineEntry 483 | TrampolineEntry 484 | TrampolineEntry 485 | TrampolineEntry 486 | TrampolineEntry 487 | TrampolineEntry 488 | TrampolineEntry 489 | TrampolineEntry 490 | TrampolineEntry 491 | TrampolineEntry 492 | TrampolineEntry 493 | TrampolineEntry 494 | TrampolineEntry 495 | TrampolineEntry 496 | TrampolineEntry 497 | TrampolineEntry 498 | TrampolineEntry 499 | TrampolineEntry 500 | TrampolineEntry 501 | TrampolineEntry 502 | TrampolineEntry 503 | TrampolineEntry 504 | TrampolineEntry 505 | TrampolineEntry 506 | TrampolineEntry 507 | TrampolineEntry 508 | TrampolineEntry 509 | TrampolineEntry 510 | TrampolineEntry 511 | TrampolineEntry 512 | TrampolineEntry 513 | TrampolineEntry 514 | TrampolineEntry 515 | TrampolineEntry 516 | TrampolineEntry 517 | TrampolineEntry 518 | TrampolineEntry 519 | TrampolineEntry 520 | TrampolineEntry 521 | TrampolineEntry 522 | TrampolineEntry 523 | TrampolineEntry 524 | TrampolineEntry 525 | TrampolineEntry 526 | TrampolineEntry 527 | TrampolineEntry 528 | TrampolineEntry 529 | TrampolineEntry 530 | TrampolineEntry 531 | TrampolineEntry 532 | TrampolineEntry 533 | TrampolineEntry 534 | TrampolineEntry 535 | TrampolineEntry 536 | TrampolineEntry 537 | TrampolineEntry 538 | TrampolineEntry 539 | TrampolineEntry 540 | TrampolineEntry 541 | TrampolineEntry 542 | TrampolineEntry 543 | TrampolineEntry 544 | TrampolineEntry 545 | TrampolineEntry 546 | TrampolineEntry 547 | TrampolineEntry 548 | TrampolineEntry 549 | TrampolineEntry 550 | TrampolineEntry 551 | TrampolineEntry 552 | TrampolineEntry 553 | TrampolineEntry 554 | TrampolineEntry 555 | TrampolineEntry 556 | TrampolineEntry 557 | TrampolineEntry 558 | TrampolineEntry 559 | TrampolineEntry 560 | TrampolineEntry 561 | TrampolineEntry 562 | // TrampolineEntry 563 | // TrampolineEntry 564 | // TrampolineEntry 565 | // TrampolineEntry 566 | 567 | __a2a3_selectorTrampEnd: 568 | 569 | #endif 570 | --------------------------------------------------------------------------------