Skip to content
Browse files

- ETBluetoothMath swizzled

  • Loading branch information...
1 parent 5cab5f3 commit 39f7f1b7c35181b7b3a77cd09cda6476f9356bb2 @sandeepmistry committed Dec 21, 2013
View
12 Estimote Editor.xcodeproj/project.pbxproj
@@ -8,6 +8,8 @@
/* Begin PBXBuildFile section */
AFB8C0671865FE87009D9411 /* CBXpcConnection+Swizzled.m in Sources */ = {isa = PBXBuildFile; fileRef = AFB8C0661865FE87009D9411 /* CBXpcConnection+Swizzled.m */; };
+ AFB8C06A18661611009D9411 /* ESTBeacon+Swizzled.m in Sources */ = {isa = PBXBuildFile; fileRef = AFB8C06918661611009D9411 /* ESTBeacon+Swizzled.m */; };
+ AFB8C06D18662713009D9411 /* ETBluetoothMath+Swizzled.m in Sources */ = {isa = PBXBuildFile; fileRef = AFB8C06C18662713009D9411 /* ETBluetoothMath+Swizzled.m */; };
E10877AD1833D08100ECD3B3 /* EEPowerLevelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E10877AC1833D08100ECD3B3 /* EEPowerLevelViewController.m */; };
E10877B21833DECE00ECD3B3 /* EEProximityView.m in Sources */ = {isa = PBXBuildFile; fileRef = E10877B11833DECE00ECD3B3 /* EEProximityView.m */; };
E17C99A118510F0100B0D0F0 /* libEstimoteSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E17C99A018510F0100B0D0F0 /* libEstimoteSDK.a */; };
@@ -28,6 +30,10 @@
/* Begin PBXFileReference section */
AFB8C0651865FE87009D9411 /* CBXpcConnection+Swizzled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CBXpcConnection+Swizzled.h"; sourceTree = "<group>"; };
AFB8C0661865FE87009D9411 /* CBXpcConnection+Swizzled.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CBXpcConnection+Swizzled.m"; sourceTree = "<group>"; };
+ AFB8C06818661611009D9411 /* ESTBeacon+Swizzled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ESTBeacon+Swizzled.h"; sourceTree = "<group>"; };
+ AFB8C06918661611009D9411 /* ESTBeacon+Swizzled.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ESTBeacon+Swizzled.m"; sourceTree = "<group>"; };
+ AFB8C06B18662713009D9411 /* ETBluetoothMath+Swizzled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ETBluetoothMath+Swizzled.h"; sourceTree = "<group>"; };
+ AFB8C06C18662713009D9411 /* ETBluetoothMath+Swizzled.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ETBluetoothMath+Swizzled.m"; sourceTree = "<group>"; };
E10877AB1833D08100ECD3B3 /* EEPowerLevelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EEPowerLevelViewController.h; sourceTree = "<group>"; };
E10877AC1833D08100ECD3B3 /* EEPowerLevelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EEPowerLevelViewController.m; sourceTree = "<group>"; };
E10877B01833DECE00ECD3B3 /* EEProximityView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EEProximityView.h; sourceTree = "<group>"; };
@@ -139,6 +145,10 @@
E1F1248318338F2700BE137D /* Supporting Files */,
AFB8C0651865FE87009D9411 /* CBXpcConnection+Swizzled.h */,
AFB8C0661865FE87009D9411 /* CBXpcConnection+Swizzled.m */,
+ AFB8C06818661611009D9411 /* ESTBeacon+Swizzled.h */,
+ AFB8C06918661611009D9411 /* ESTBeacon+Swizzled.m */,
+ AFB8C06B18662713009D9411 /* ETBluetoothMath+Swizzled.h */,
+ AFB8C06C18662713009D9411 /* ETBluetoothMath+Swizzled.m */,
);
path = "Estimote Editor";
sourceTree = "<group>";
@@ -249,11 +259,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ AFB8C06D18662713009D9411 /* ETBluetoothMath+Swizzled.m in Sources */,
E10877B21833DECE00ECD3B3 /* EEProximityView.m in Sources */,
E10877AD1833D08100ECD3B3 /* EEPowerLevelViewController.m in Sources */,
E1F1248D18338F2700BE137D /* EEAppDelegate.m in Sources */,
E1F124AF18338F6F00BE137D /* EETableViewController.m in Sources */,
AFB8C0671865FE87009D9411 /* CBXpcConnection+Swizzled.m in Sources */,
+ AFB8C06A18661611009D9411 /* ESTBeacon+Swizzled.m in Sources */,
E1F1248918338F2700BE137D /* main.m in Sources */,
E1F124C0183392C600BE137D /* EEDetailViewController.m in Sources */,
);
View
22 Estimote Editor/ETBluetoothMath+Swizzled.h
@@ -0,0 +1,22 @@
+//
+// ETBluetoothMath+Swizzled.h
+// Estimote Editor
+//
+// Created by Sandeep Mistry on 12/21/2013.
+//
+
+@interface ETBluetoothMath : NSObject
+
+@end
+
+@interface ETBluetoothMath (Swizzled)
+
+// original
++ (unsigned long)Secunit_ModExpWithBase:(unsigned long)arg1 Exp:(unsigned long)arg2 andMod:(unsigned long)arg3;
++ (unsigned long)randomUInt32;
+
+// swizzled
++ (unsigned long)Secunit_ModExpWithBaseSwizzled:(unsigned long)arg1 Exp:(unsigned long)arg2 andMod:(unsigned long)arg3;
++ (unsigned long)randomUInt32Swizzled;
+
+@end
View
46 Estimote Editor/ETBluetoothMath+Swizzled.m
@@ -0,0 +1,46 @@
+//
+// ETBluetoothMath+Swizzled.m
+// Estimote Editor
+//
+// Created by Sandeep Mistry on 12/21/2013.
+//
+
+#import <objc/runtime.h>
+
+
+#import "ETBluetoothMath+Swizzled.h"
+
+@implementation ETBluetoothMath (Swizzled)
+
++ (void)load
+{
+ Method original, swizzled;
+
+ original = class_getClassMethod(self, @selector(Secunit_ModExpWithBase:Exp:andMod:));
+ swizzled = class_getClassMethod(self, @selector(Secunit_ModExpWithBaseSwizzled:Exp:andMod:));
+ method_exchangeImplementations(original, swizzled);
+
+ original = class_getClassMethod(self, @selector(randomUInt32));
+ swizzled = class_getClassMethod(self, @selector(randomUInt32Swizzled));
+ method_exchangeImplementations(original, swizzled);
+}
+
++ (unsigned long)Secunit_ModExpWithBaseSwizzled:(unsigned long)arg1 Exp:(unsigned long)arg2 andMod:(unsigned long)arg3
+{
+ unsigned long secunit = [self Secunit_ModExpWithBaseSwizzled:arg1 Exp:arg2 andMod:arg3];
+
+ NSLog(@"[ETBluetoothMath Secunit_ModExpWithBase:0x%lx Exp:0x%lx andMod:0x%lx ] = 0x%lx", arg1, arg2, arg3, secunit);
+
+ return secunit;
+}
+
++ (unsigned long)randomUInt32Swizzled
+{
+ unsigned long randomUInt32 = [self randomUInt32Swizzled];
+
+ NSLog(@"[ETBluetoothMath randomUInt32] = 0x%lx", randomUInt32);
+
+ return randomUInt32;
+}
+
+@end

0 comments on commit 39f7f1b

Please sign in to comment.
Something went wrong with that request. Please try again.