Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Basic CoreLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Naville committed Jul 30, 2017
1 parent a228a4c commit 274b287
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 111 deletions.
162 changes: 162 additions & 0 deletions Hooks/API/CoreLocation.xm
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#import "../Global.h"
#import <CoreLocation/CoreLocation.h>
#define LogCLRegion(obj) \
WTAdd(obj.identifier,@"identifier");\
WTAdd([NSNumber numberWithDouble:obj.center.latitude],@"center.latitude");\
WTAdd([NSNumber numberWithDouble:obj.center.longitude],@"center.longitude");\
WTAdd([NSNumber numberWithDouble:obj.radius],@"radius");
typedef double CLLocationDegrees;

/*
* CLLocationAccuracy
*
* Discussion:
* Type used to represent a location accuracy level in meters. The lower the value in meters, the
* more physically precise the location is. A negative accuracy value indicates an invalid location.
*/
typedef double CLLocationAccuracy;

/*
* CLLocationSpeed
*
* Discussion:
* Type used to represent the speed in meters per second.
*/
typedef double CLLocationSpeed;

/*
* CLLocationDirection
*
* Discussion:
* Type used to represent the direction in degrees from 0 to 359.9. A negative value indicates an
* invalid direction.
*/
typedef double CLLocationDirection;

%group CoreLocation
%hook CLLocationManager
- (void)startUpdatingLocation{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"startUpdatingLocation");
WTSave;
WTRelease;
}
%orig;
}
- (void)stopMonitoringSignificantLocationChanges{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"stopMonitoringSignificantLocationChanges");
WTSave;
WTRelease;
}
%orig;
}
- (void)startMonitoringSignificantLocationChanges{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"startMonitoringSignificantLocationChanges");
WTSave;
WTRelease;
}
%orig;
}
- (void)stopUpdatingLocation{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"stopUpdatingLocation");
WTSave;
WTRelease;
}
%orig;
}
- (void)stopUpdatingHeading{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"stopUpdatingHeading");
WTSave;
WTRelease;
}
%orig;
}
- (void)stopMonitoringForRegion:(CLRegion *)region{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"stopMonitoringForRegion:");
LogCLRegion(region);
WTSave;
WTRelease;
}
%orig;
}
- (void)startMonitoringForRegion:(CLRegion *)region{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"startMonitoringForRegion:");
LogCLRegion(region);
WTSave;
WTRelease;
}
%orig;
}
- (void)startUpdatingHeading{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"startUpdatingHeading");
WTSave;
WTRelease;
}
%orig;
}
- (void)requestStateForRegion:(CLRegion *)region{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"requestStateForRegion:");
LogCLRegion(region);
WTSave;
WTRelease;
}
%orig;
}
- (void)stopRangingBeaconsInRegion:(CLBeaconRegion *)region{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"stopRangingBeaconsInRegion:");
LogCLRegion(region);
WTAdd(region.proximityUUID,@"proximityUUID");
WTSave;
WTRelease;
}
%orig;
}
- (void)startRangingBeaconsInRegion:(CLBeaconRegion *)region{
if(WTShouldLog){
WTInit(@"CLLocationManager",@"startRangingBeaconsInRegion:");
LogCLRegion(region);
WTAdd(region.proximityUUID,@"proximityUUID");
WTSave;
WTRelease;
}
%orig;
}
%end
/*%hook CLLocation
- (id)initWithLatitude:(CLLocationDegrees)latitude
longitude:(CLLocationDegrees)longitude{
}
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate
altitude:(CLLocationDistance)altitude
horizontalAccuracy:(CLLocationAccuracy)hAccuracy
verticalAccuracy:(CLLocationAccuracy)vAccuracy
timestamp:(NSDate *)timestamp;
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate
altitude:(CLLocationDistance)altitude
horizontalAccuracy:(CLLocationAccuracy)hAccuracy
verticalAccuracy:(CLLocationAccuracy)vAccuracy
course:(CLLocationDirection)course
speed:(CLLocationSpeed)speed
timestamp:(NSDate *)timestamp
- (double)distanceFromLocation:(const CLLocation *)location{
}
%end*/


%end
extern void init_CoreLocation_hook() {
%init(CoreLocation);
}
#undef LogCLRegion
82 changes: 0 additions & 82 deletions Hooks/API/CoreLocation.xm.empty

This file was deleted.

15 changes: 14 additions & 1 deletion Hooks/API/libC.xm
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,24 @@ int replaced_system(char *command){


}

static char* (*original_getenv)(char* name);
char* replaced_getenv(char *command){
char* ret=original_getenv(command);
if (WTShouldLog) {
WTInit(@"C",@"getenv");
WTAdd([NSString stringWithUTF8String:command],@"name");
WTReturn([NSString stringWithUTF8String:ret]);
WTSave;
WTRelease;
return ret;
}
return ret;
}


extern void init_libC_hook(){
WTHookFunction((void *)random, (void *)replaced_random, (void **) &original_random);
WTHookFunction((void *)rand, (void *)replaced_rand, (void **) &original_rand);
WTHookFunction((void *)system, (void *)replaced_system, (void **) &original_system);
WTHookFunction((void *)system, (void *)replaced_getenv, (void **) &original_getenv);
}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
521
522
27 changes: 0 additions & 27 deletions layout/Library/PreferenceLoader/Preferences/WTFJH.plist

This file was deleted.

0 comments on commit 274b287

Please sign in to comment.