├── .gitignore ├── HookDetector ├── .idea │ ├── .name │ ├── HookDetector.iml │ ├── encodings.xml │ ├── misc.xml │ ├── modules.xml │ ├── workspace.xml │ └── xcode.xml ├── HookDetector.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── HookDetector │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Core │ ├── RWHookDetector.h │ ├── RWHookDetector.m │ └── offset │ │ ├── offset_arm32.plist │ │ └── offset_arm64.plist │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /HookDetector/.idea/.name: -------------------------------------------------------------------------------- 1 | HookDetector -------------------------------------------------------------------------------- /HookDetector/.idea/HookDetector.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /HookDetector/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /HookDetector/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /HookDetector/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HookDetector/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 82 | 83 | 84 | 85 | 86 | true 87 | 88 | 89 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 127 | 128 | 131 | 132 | 133 | 134 | 137 | 138 | 141 | 142 | 145 | 146 | 147 | 148 | 151 | 152 | 155 | 156 | 159 | 160 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 1457185779299 222 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | -------------------------------------------------------------------------------- /HookDetector/.idea/xcode.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /HookDetector/HookDetector.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6DFDC06F29AA772830AFBA4D /* offset_arm64.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6DFDC94E1EB700F6BD30F692 /* offset_arm64.plist */; }; 11 | 6DFDC1265C154CAFBCC049C1 /* offset_arm32.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6DFDC944BA0973B7DA6C1F54 /* offset_arm32.plist */; }; 12 | 6DFDC366F64355535EFFF805 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6DFDC518DEA458F6BB2424F4 /* main.m */; }; 13 | 6DFDC39092BCD009D4EEE714 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6DFDC371BA6141ED502E7D01 /* LaunchScreen.storyboard */; }; 14 | 6DFDC47EE8998F0B3E3D430D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6DFDCC8127A9A0E46F8D0466 /* Assets.xcassets */; }; 15 | 6DFDC88CAF5917C89A90E801 /* RWHookDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 6DFDC9768C0F77803910733A /* RWHookDetector.m */; }; 16 | 6DFDCADFB528EA010E390877 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6DFDC57D17EB14A4300B6502 /* AppDelegate.m */; }; 17 | 6DFDCC0AEDD2EB4E5C105656 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6DFDC97E4D2241FEDA51260B /* ViewController.m */; }; 18 | 6DFDCD267DE5CD32C5F491F2 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6DFDC5E85A11AC92A4F3B84C /* Info.plist */; }; 19 | 6DFDCF599B3B238D4F154658 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6DFDCCFA59DB945A5B3AD674 /* Main.storyboard */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 6DFDC00CB9CC28B86BB86D03 /* RWHookDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RWHookDetector.h; sourceTree = ""; }; 24 | 6DFDC4A6F29ADCF3F1D43E00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | 6DFDC518DEA458F6BB2424F4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 26 | 6DFDC57D17EB14A4300B6502 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | 6DFDC5E85A11AC92A4F3B84C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.info; path = Info.plist; sourceTree = ""; }; 28 | 6DFDC741F3D41E40629EC8B5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 29 | 6DFDC944BA0973B7DA6C1F54 /* offset_arm32.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = offset_arm32.plist; path = offset/offset_arm32.plist; sourceTree = ""; }; 30 | 6DFDC94E1EB700F6BD30F692 /* offset_arm64.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = offset_arm64.plist; path = offset/offset_arm64.plist; sourceTree = ""; }; 31 | 6DFDC9768C0F77803910733A /* RWHookDetector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RWHookDetector.m; sourceTree = ""; }; 32 | 6DFDC97E4D2241FEDA51260B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 33 | 6DFDCC6894DD60C31B49C32F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 34 | 6DFDCC8127A9A0E46F8D0466 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 35 | 6DFDCD3F501F29C7A958412E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 36 | 6DFDCDA876DFE207F3BA1FAE /* HookDetector.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HookDetector.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | 6DFDCB383E36B1DD07BF6255 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | 6DFDC21CCD7588C09973429E /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 6DFDCDA876DFE207F3BA1FAE /* HookDetector.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 6DFDC3859D48BD16B7D5A6D3 = { 59 | isa = PBXGroup; 60 | children = ( 61 | 6DFDC21CCD7588C09973429E /* Products */, 62 | 6DFDCF5DD586228EBC6F6CE4 /* HookDetector */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 6DFDC97CF4A8B435FEF76C55 /* Core */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 6DFDC944BA0973B7DA6C1F54 /* offset_arm32.plist */, 70 | 6DFDC94E1EB700F6BD30F692 /* offset_arm64.plist */, 71 | 6DFDC9768C0F77803910733A /* RWHookDetector.m */, 72 | 6DFDC00CB9CC28B86BB86D03 /* RWHookDetector.h */, 73 | ); 74 | path = Core; 75 | sourceTree = ""; 76 | }; 77 | 6DFDCDD767D3FE04E184D22B /* Supporting Files */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 6DFDC518DEA458F6BB2424F4 /* main.m */, 81 | ); 82 | name = "Supporting Files"; 83 | sourceTree = ""; 84 | }; 85 | 6DFDCF5DD586228EBC6F6CE4 /* HookDetector */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 6DFDC5E85A11AC92A4F3B84C /* Info.plist */, 89 | 6DFDCC8127A9A0E46F8D0466 /* Assets.xcassets */, 90 | 6DFDC371BA6141ED502E7D01 /* LaunchScreen.storyboard */, 91 | 6DFDCDD767D3FE04E184D22B /* Supporting Files */, 92 | 6DFDC741F3D41E40629EC8B5 /* AppDelegate.h */, 93 | 6DFDC57D17EB14A4300B6502 /* AppDelegate.m */, 94 | 6DFDCCFA59DB945A5B3AD674 /* Main.storyboard */, 95 | 6DFDCD3F501F29C7A958412E /* ViewController.h */, 96 | 6DFDC97E4D2241FEDA51260B /* ViewController.m */, 97 | 6DFDC97CF4A8B435FEF76C55 /* Core */, 98 | ); 99 | path = HookDetector; 100 | sourceTree = ""; 101 | }; 102 | /* End PBXGroup section */ 103 | 104 | /* Begin PBXNativeTarget section */ 105 | 6DFDCC8FE2EA3D9A329556A0 /* HookDetector */ = { 106 | isa = PBXNativeTarget; 107 | buildConfigurationList = 6DFDCF1BA7165A2BF0CCDBAD /* Build configuration list for PBXNativeTarget "HookDetector" */; 108 | buildPhases = ( 109 | 6DFDC0A8CC5C9F4601B36E00 /* Sources */, 110 | 6DFDCB383E36B1DD07BF6255 /* Frameworks */, 111 | 6DFDCF054FC4CF46B6031D19 /* Resources */, 112 | ); 113 | buildRules = ( 114 | ); 115 | dependencies = ( 116 | ); 117 | name = HookDetector; 118 | productName = HookDetector; 119 | productReference = 6DFDCDA876DFE207F3BA1FAE /* HookDetector.app */; 120 | productType = "com.apple.product-type.application"; 121 | }; 122 | /* End PBXNativeTarget section */ 123 | 124 | /* Begin PBXProject section */ 125 | 6DFDC5AD229911915E138319 /* Project object */ = { 126 | isa = PBXProject; 127 | attributes = { 128 | ORGANIZATIONNAME = RW; 129 | }; 130 | buildConfigurationList = 6DFDC8A7915E66A93A19AA7E /* Build configuration list for PBXProject "HookDetector" */; 131 | compatibilityVersion = "Xcode 3.2"; 132 | developmentRegion = English; 133 | hasScannedForEncodings = 0; 134 | knownRegions = ( 135 | en, 136 | ); 137 | mainGroup = 6DFDC3859D48BD16B7D5A6D3; 138 | productRefGroup = 6DFDC21CCD7588C09973429E /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | 6DFDCC8FE2EA3D9A329556A0 /* HookDetector */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | 6DFDCF054FC4CF46B6031D19 /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 6DFDCD267DE5CD32C5F491F2 /* Info.plist in Resources */, 153 | 6DFDC47EE8998F0B3E3D430D /* Assets.xcassets in Resources */, 154 | 6DFDC39092BCD009D4EEE714 /* LaunchScreen.storyboard in Resources */, 155 | 6DFDCF599B3B238D4F154658 /* Main.storyboard in Resources */, 156 | 6DFDC1265C154CAFBCC049C1 /* offset_arm32.plist in Resources */, 157 | 6DFDC06F29AA772830AFBA4D /* offset_arm64.plist in Resources */, 158 | ); 159 | runOnlyForDeploymentPostprocessing = 0; 160 | }; 161 | /* End PBXResourcesBuildPhase section */ 162 | 163 | /* Begin PBXSourcesBuildPhase section */ 164 | 6DFDC0A8CC5C9F4601B36E00 /* Sources */ = { 165 | isa = PBXSourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | 6DFDC366F64355535EFFF805 /* main.m in Sources */, 169 | 6DFDCADFB528EA010E390877 /* AppDelegate.m in Sources */, 170 | 6DFDCC0AEDD2EB4E5C105656 /* ViewController.m in Sources */, 171 | 6DFDC88CAF5917C89A90E801 /* RWHookDetector.m in Sources */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXSourcesBuildPhase section */ 176 | 177 | /* Begin PBXVariantGroup section */ 178 | 6DFDC371BA6141ED502E7D01 /* LaunchScreen.storyboard */ = { 179 | isa = PBXVariantGroup; 180 | children = ( 181 | 6DFDCC6894DD60C31B49C32F /* Base */, 182 | ); 183 | name = LaunchScreen.storyboard; 184 | sourceTree = ""; 185 | }; 186 | 6DFDCCFA59DB945A5B3AD674 /* Main.storyboard */ = { 187 | isa = PBXVariantGroup; 188 | children = ( 189 | 6DFDC4A6F29ADCF3F1D43E00 /* Base */, 190 | ); 191 | name = Main.storyboard; 192 | sourceTree = ""; 193 | }; 194 | /* End PBXVariantGroup section */ 195 | 196 | /* Begin XCBuildConfiguration section */ 197 | 6DFDC397C555BE0709796143 /* Debug */ = { 198 | isa = XCBuildConfiguration; 199 | buildSettings = { 200 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 201 | INFOPLIST_FILE = HookDetector/Info.plist; 202 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 203 | PRODUCT_BUNDLE_IDENTIFIER = RW.HookDetector; 204 | PRODUCT_NAME = "$(TARGET_NAME)"; 205 | }; 206 | name = Debug; 207 | }; 208 | 6DFDCA0849609D2739F94CF7 /* Release */ = { 209 | isa = XCBuildConfiguration; 210 | buildSettings = { 211 | ALWAYS_SEARCH_USER_PATHS = NO; 212 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 213 | CLANG_CXX_LIBRARY = "libc++"; 214 | CLANG_ENABLE_MODULES = YES; 215 | CLANG_ENABLE_OBJC_ARC = YES; 216 | CLANG_WARN_BOOL_CONVERSION = YES; 217 | CLANG_WARN_CONSTANT_CONVERSION = YES; 218 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 219 | CLANG_WARN_EMPTY_BODY = YES; 220 | CLANG_WARN_ENUM_CONVERSION = YES; 221 | CLANG_WARN_INT_CONVERSION = YES; 222 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 223 | CLANG_WARN_UNREACHABLE_CODE = YES; 224 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 225 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 226 | COPY_PHASE_STRIP = NO; 227 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 228 | ENABLE_NS_ASSERTIONS = NO; 229 | ENABLE_STRICT_OBJC_MSGSEND = YES; 230 | GCC_C_LANGUAGE_STANDARD = gnu99; 231 | GCC_NO_COMMON_BLOCKS = YES; 232 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 233 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 234 | GCC_WARN_UNDECLARED_SELECTOR = YES; 235 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 236 | GCC_WARN_UNUSED_FUNCTION = YES; 237 | GCC_WARN_UNUSED_VARIABLE = YES; 238 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 239 | MTL_ENABLE_DEBUG_INFO = NO; 240 | SDKROOT = iphoneos; 241 | VALIDATE_PRODUCT = YES; 242 | }; 243 | name = Release; 244 | }; 245 | 6DFDCBB38B52D76E3DE835DC /* Release */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 249 | INFOPLIST_FILE = HookDetector/Info.plist; 250 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 251 | PRODUCT_BUNDLE_IDENTIFIER = RW.HookDetector; 252 | PRODUCT_NAME = "$(TARGET_NAME)"; 253 | }; 254 | name = Release; 255 | }; 256 | 6DFDCF7B644CDF54D462237C /* Debug */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | ALWAYS_SEARCH_USER_PATHS = NO; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_WARN_BOOL_CONVERSION = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 267 | CLANG_WARN_EMPTY_BODY = YES; 268 | CLANG_WARN_ENUM_CONVERSION = YES; 269 | CLANG_WARN_INT_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 274 | COPY_PHASE_STRIP = NO; 275 | DEBUG_INFORMATION_FORMAT = dwarf; 276 | ENABLE_STRICT_OBJC_MSGSEND = YES; 277 | ENABLE_TESTABILITY = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu99; 279 | GCC_DYNAMIC_NO_PIC = NO; 280 | GCC_NO_COMMON_BLOCKS = YES; 281 | GCC_OPTIMIZATION_LEVEL = 0; 282 | GCC_PREPROCESSOR_DEFINITIONS = ( 283 | "DEBUG=1", 284 | "$(inherited)", 285 | ); 286 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 287 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 288 | GCC_WARN_UNDECLARED_SELECTOR = YES; 289 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 290 | GCC_WARN_UNUSED_FUNCTION = YES; 291 | GCC_WARN_UNUSED_VARIABLE = YES; 292 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 293 | MTL_ENABLE_DEBUG_INFO = YES; 294 | ONLY_ACTIVE_ARCH = YES; 295 | SDKROOT = iphoneos; 296 | }; 297 | name = Debug; 298 | }; 299 | /* End XCBuildConfiguration section */ 300 | 301 | /* Begin XCConfigurationList section */ 302 | 6DFDC8A7915E66A93A19AA7E /* Build configuration list for PBXProject "HookDetector" */ = { 303 | isa = XCConfigurationList; 304 | buildConfigurations = ( 305 | 6DFDCF7B644CDF54D462237C /* Debug */, 306 | 6DFDCA0849609D2739F94CF7 /* Release */, 307 | ); 308 | defaultConfigurationIsVisible = 0; 309 | defaultConfigurationName = Release; 310 | }; 311 | 6DFDCF1BA7165A2BF0CCDBAD /* Build configuration list for PBXNativeTarget "HookDetector" */ = { 312 | isa = XCConfigurationList; 313 | buildConfigurations = ( 314 | 6DFDC397C555BE0709796143 /* Debug */, 315 | 6DFDCBB38B52D76E3DE835DC /* Release */, 316 | ); 317 | defaultConfigurationIsVisible = 0; 318 | }; 319 | /* End XCConfigurationList section */ 320 | }; 321 | rootObject = 6DFDC5AD229911915E138319 /* Project object */; 322 | } 323 | -------------------------------------------------------------------------------- /HookDetector/HookDetector.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HookDetector/HookDetector/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // HookDetector 4 | // 5 | // Created by yuguo on 3/5/16. 6 | // Copyright (c) 2016 RW. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /HookDetector/HookDetector/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // HookDetector 4 | // 5 | // Created by yuguo on 3/5/16. 6 | // Copyright (c) 2016 RW. All rights reserved. 7 | // 8 | 9 | 10 | #import "AppDelegate.h" 11 | 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | // Override point for customization after application launch. 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application { 28 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 29 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 30 | 31 | } 32 | 33 | - (void)applicationDidEnterBackground:(UIApplication *)application { 34 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 35 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 36 | 37 | } 38 | 39 | - (void)applicationWillEnterForeground:(UIApplication *)application { 40 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 41 | } 42 | 43 | - (void)applicationDidBecomeActive:(UIApplication *)application { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | 52 | @end -------------------------------------------------------------------------------- /HookDetector/HookDetector/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /HookDetector/HookDetector/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /HookDetector/HookDetector/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /HookDetector/HookDetector/Core/RWHookDetector.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by yuguo on 3/5/16. 3 | // Copyright (c) 2016 RW. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | BOOL isSiwwzledOrOverridden(Class cls, SEL selector) ; 9 | 10 | #if TARGET_CPU_ARM64 11 | BOOL isSiwwzledOrOverriddenOnArm64(Class cls, SEL selector); 12 | #endif 13 | 14 | bool differs(const char *func, SEL _cmd); 15 | 16 | #define ALERT_IF_METHOD_REPLACED assert(!differs(__PRETTY_FUNCTION__, _cmd)); -------------------------------------------------------------------------------- /HookDetector/HookDetector/Core/RWHookDetector.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by yuguo on 3/5/16. 3 | // Copyright (c) 2016 RW. All rights reserved. 4 | // 5 | 6 | #import "RWHookDetector.h" 7 | 8 | static NSDictionary *offsetDict = nil; 9 | 10 | __unused __attribute__((constructor)) static void _() { 11 | NSString *platform = @""; 12 | #if TARGET_CPU_ARM64 13 | platform = @"arm64"; 14 | #elif TARGET_CPU_ARM 15 | platform = @"arm32"; 16 | #elif TARGET_IPHONE_SIMULATOR 17 | platform = @"simulator"; 18 | #endif 19 | 20 | NSString *fileName = [NSString stringWithFormat:@"offset_%@", platform]; 21 | offsetDict = [NSKeyedUnarchiver unarchiveObjectWithData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fileName ofType:@"plist"]]]; 22 | if (!offsetDict){ 23 | NSLog(@"Failed!"); 24 | } 25 | } 26 | 27 | BOOL isSiwwzledOrOverridden(Class cls, SEL selector) { 28 | if (offsetDict){ 29 | NSNumber *num = offsetDict[[NSString stringWithFormat:@"[%@ %s]", NSStringFromClass(cls), sel_getName(selector)]]; 30 | if (num == nil){ 31 | NSLog(@"Could not find selector!"); 32 | return NO; 33 | } 34 | IMP imp = [cls instanceMethodForSelector:selector]; 35 | int offset = (int) cls - (int) imp; 36 | 37 | if (offset != [num integerValue]) 38 | return YES; 39 | } else{ 40 | 41 | } 42 | return NO; 43 | } 44 | 45 | #if TARGET_CPU_ARM64 46 | BOOL isSiwwzledOrOverriddenOnArm64(Class cls, SEL selector) { 47 | IMP imp = [cls instanceMethodForSelector:selector]; 48 | int offset = (int) cls - (int) imp; 49 | return offset < 0; 50 | } 51 | #endif 52 | 53 | 54 | inline bool differs(const char *func, SEL _cmd) 55 | { 56 | char buff[256] = {'\0'}; 57 | if (strlen(func) > 2) { 58 | char* s = strstr(func, " ") + 1; 59 | char* e = strstr(func, "]"); 60 | memcpy(buff, s, sizeof(char) * (e - s) ); 61 | return strcmp(buff, sel_getName(_cmd)); 62 | } 63 | return false; 64 | } 65 | 66 | -------------------------------------------------------------------------------- /HookDetector/HookDetector/Core/offset/offset_arm32.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deput/RWHookDetector/87624484a3113f9c1c451941ec40561aecd59a41/HookDetector/HookDetector/Core/offset/offset_arm32.plist -------------------------------------------------------------------------------- /HookDetector/HookDetector/Core/offset/offset_arm64.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deput/RWHookDetector/87624484a3113f9c1c451941ec40561aecd59a41/HookDetector/HookDetector/Core/offset/offset_arm64.plist -------------------------------------------------------------------------------- /HookDetector/HookDetector/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CFBundleIdentifier 7 | $(PRODUCT_BUNDLE_IDENTIFIER) 8 | CFBundleInfoDictionaryVersion 9 | 6.0 10 | CFBundleSignature 11 | ???? 12 | 13 | CFBundleExecutable 14 | $(EXECUTABLE_NAME) 15 | 16 | CFBundleName 17 | $(PRODUCT_NAME) 18 | 19 | CFBundleDevelopmentRegion 20 | en 21 | 22 | CFBundleShortVersionString 23 | 1.0 24 | CFBundleVersion 25 | 1 26 | 27 | CFBundlePackageType 28 | APPL 29 | 30 | LSRequiresIPhoneOS 31 | 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UILaunchStoryboardName 37 | LaunchScreen 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | UIMainStoryboardFile 46 | Main 47 | 48 | -------------------------------------------------------------------------------- /HookDetector/HookDetector/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // HookDetector 4 | // 5 | // Created by yuguo on 3/5/16. 6 | // Copyright (c) 2016 RW. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | 13 | @interface ViewController : UIViewController 14 | 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /HookDetector/HookDetector/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // HookDetector 4 | // 5 | // Created by yuguo on 3/5/16. 6 | // Copyright (c) 2016 RW. All rights reserved. 7 | // 8 | 9 | 10 | #import "ViewController.h" 11 | #import 12 | #import "RWHookDetector.h" 13 | 14 | @implementation UIViewController(Category) 15 | + (void)load { 16 | Method ori_method = class_getInstanceMethod([UIViewController class], @selector(viewDidLoad)); 17 | Method replace_method = class_getInstanceMethod([UIViewController class], @selector(viewDidLoad2)); 18 | method_exchangeImplementations(ori_method, replace_method); 19 | } 20 | 21 | - (void)viewDidLoad2 { 22 | //hook 23 | [self viewDidLoad2]; 24 | } 25 | 26 | - (void)viewWillAppear:(BOOL)animated { 27 | //overridden 28 | } 29 | 30 | @end 31 | 32 | 33 | @interface ViewController () 34 | 35 | @end 36 | 37 | @implementation ViewController 38 | 39 | + (void)load { 40 | Method ori_method = class_getInstanceMethod([ViewController class], @selector(sayHello)); 41 | Method replace_method = class_getInstanceMethod([ViewController class], @selector(sayHello2)); 42 | method_exchangeImplementations(ori_method, replace_method); 43 | } 44 | 45 | - (void)viewDidLoad { 46 | [super viewDidLoad]; 47 | 48 | BOOL ret = isSiwwzledOrOverridden([UIViewController class],@selector(viewDidLoad)); 49 | ret = isSiwwzledOrOverridden([UIViewController class],@selector(viewWillAppear:)); 50 | ret = isSiwwzledOrOverridden([UIViewController class],@selector(viewDidAppear:)); 51 | 52 | ret = isSiwwzledOrOverriddenOnArm64([UIViewController class],@selector(viewDidLoad)); 53 | ret = isSiwwzledOrOverriddenOnArm64([UIViewController class],@selector(viewWillAppear:)); 54 | ret = isSiwwzledOrOverriddenOnArm64([UIViewController class],@selector(viewDidAppear:)); 55 | 56 | [self sayHello]; 57 | } 58 | 59 | - (void)didReceiveMemoryWarning { 60 | [super didReceiveMemoryWarning]; 61 | // Dispose of any resources that can be recreated. 62 | } 63 | 64 | 65 | - (void) sayHello 66 | { 67 | ALERT_IF_METHOD_REPLACED 68 | NSLog(@"Hello"); 69 | } 70 | 71 | - (void) sayHello2 72 | { 73 | NSLog(@"Hi"); 74 | [self sayHello2]; 75 | } 76 | @end -------------------------------------------------------------------------------- /HookDetector/HookDetector/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HookDetector 4 | // 5 | // Created by yuguo on 3/5/16. 6 | // Copyright (c) 2016 RW. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | #import "AppDelegate.h" 12 | 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Guo Yu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RWHookDetector 2 | ## Description 3 | RWHookDetector is a set of utility methods to detect whether an Objective-C method is swizzled or overridden in runtime. 4 | 5 | ## Background 6 | In some big project, `method swizzling` is such a annoying thing when being abused everywhere. Programmers encounter unexpected behaviors caused by `method swizzling`, that will mislead the programmer to debug. 7 | 8 | `RWHookDetector` is such a tool to detect if the `method swizzling` is apply on target method. 9 | 10 | ## Usage 11 | ### For method of your own class 12 | - examle: 13 | ```objc 14 | @implementation MyClass 15 | + (void) load{ 16 | Method ori_method = class_getInstanceMethod([MyObject class], @selector(dosth)); 17 | Method replace_method = class_getInstanceMethod([MyObject class], @selector(dosth2)); 18 | method_exchangeImplementations(ori_method, replace_method); 19 | } 20 | - (void) dosth 21 | { 22 | ALERT_IF_METHOD_REPLACED; 23 | } 24 | - (void) dosth2 25 | { 26 | //hooked! lalala 27 | [self dosth2]; 28 | } 29 | ``` 30 | 31 | `ALERT_IF_METHOD_REPLACED` is a macro, it will raise an exception during runtime if the method is swizzled. 32 | 33 | ### For method of built-in class 34 | - example: 35 | ```objc 36 | //here is a private category might be brought from 3rd party 37 | @implementation UIViewController (YouDonKnow) 38 | - (void)viewDidLoad2 { 39 | [self viewDidLoad2]; 40 | } 41 | + (void)load { 42 | Method ori_method = class_getInstanceMethod([UIViewController class], @selector(viewDidLoad)); 43 | Method replace_method = class_getInstanceMethod([UIViewController class], @selector(viewDidLoad2)); 44 | method_exchangeImplementations(ori_method, replace_method); 45 | } 46 | - (void)viewDidAppear:(BOOL)animated { 47 | } 48 | @end 49 | 50 | 51 | // below is the code somewhere else to detect 52 | BOOL ret = isSiwwzledOrOverridden([UIViewController class], @selector(viewDidLoad));//YES, swizzled 53 | ret = isSiwwzledOrOverridden([UIViewController class], @selector(viewDidAppear:));//YES, overridden 54 | ret = isSiwwzledOrOverridden([UIViewController class], @selector(viewWillAppear:))//NO 55 | ``` 56 | 57 | ## How it works 58 | 59 | ## Limitation 60 | 61 | 62 | --------------------------------------------------------------------------------