-
Notifications
You must be signed in to change notification settings - Fork 2
/
Teleporter.xm
150 lines (122 loc) · 4.22 KB
/
Teleporter.xm
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
///////////////////////////////////////////
//
// MyAltitude
//
// Alters iPhone altitude coordinates to target
//
//
// Made by Jalby
// August 20, 2016
//
//
///////////////////////////////////////////
#import "Teleporter.h"
#import <CoreLocation/CLLocation.h>
#import <CoreLocation/CLHeading.h>
#include <stdlib.h>
#include <substrate.h>
#define ARC4RANDOM_MAX 0x100000000
double deltaX = 0;
double deltaY = 0;
double deltaZ = 0;
double targetZ = 2.012;
double targetX = 37.808472;
double targetY = -122.410119;
BOOL startedOnce = false;
%hook CLHeading
-(void)setCLHeadingComponentValue:(CLHeadingComponentValue)z {
CLHeadingComponentValue newZ = 5.43;
%orig(newZ);
}
- (CLHeadingComponentValue)x {
NSLog(@"someone is getting X heading...");
return %orig;
}
- (CLHeadingComponentValue)y {
NSLog(@"someone is getting Y heading...");
return %orig;
}
- (CLHeadingComponentValue)z {
NSLog(@"someone is getting Z heading...");
CLHeadingComponentValue modZ = 4.92;
return modZ;
}
- (NSString*)description {
NSLog(@"someone is getting heading description.");
return %orig;
}
%end
@interface CLLocation()
- (NSInteger)currentSecond;
- (double)fuzzy;
- (CLLocationCoordinate2D) CLLocationCoordinate2DMake: (CLLocationDegrees)latitude : (CLLocationDegrees)longitude;
@end
%hook CLLocation
%new
- (NSInteger)currentSecond {
NSDate *today = [NSDate date];
NSCalendar *gregorian = [[[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
NSDateComponents *components =
[gregorian components:(NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:today];
return [components second];
}
%new
- (double)fuzzy {
double max = 0.7;
double min = -0.7;
double range = max - min;
double ret = ((double) arc4random()/ARC4RANDOM_MAX) * range + min;
NSLog(@"ret was %f", ret);
return ret;
}
- (CLLocationCoordinate2D)coordinate {
CLLocationCoordinate2D newCoords = %orig;
if (!startedOnce) {
deltaX = targetX - newCoords.latitude;
deltaY = targetY - newCoords.longitude;
startedOnce = YES;
}
newCoords.latitude += deltaX;
newCoords.longitude += deltaY;
NSLog(@"here are current coordinates:%f and %f", newCoords.latitude, newCoords.longitude);
//return [self CLLocationCoordinate2DMake: targetX: targetY];
return newCoords;
}
-(void)setAltitude:(CLLocationDistance)altitude {
CLLocationDistance setAlt = 4.32;
%orig(setAlt);
}
- (CLLocationDistance)altitude {
NSInteger current = [self currentSecond];
if (current % 12 == 0) {
deltaZ = targetZ - %orig;
}
CLLocationDistance modAlt = %orig + deltaZ;
if (modAlt > targetZ + 10.0 || modAlt < targetZ - 10.0)
modAlt = targetZ + [self fuzzy];
if (modAlt < 0)
modAlt = modAlt * -1;
return modAlt;
}
%end
//Here, using Logos's 'hook' construct to access the SpringBoard class. 'Hooking' basically means we want to access this class and modify the methods inside it.
%hook SpringBoard
//Now that logos knows we want to hook the header SpringBoard, we can directly 'hijack' SpringBoard's methods and modify them to run out own code instead of their original code.
//In this example, we are hijacking the method - (void)applicationDidFinishLaunching and making it run our own code. This method takes an argument, (id)application, however, you can rename the argument anything you'd like, such as (id)testName.
-(void)applicationDidFinishLaunching:(id)application {
//Before we do anything, let's call the original method so SpringBoard knows what to do when it finishes launching. '%orig' basically means 'do whatever you were going to do before I got here'.
%orig;
//Now that SpringBoard has finished launching and everything turned out okay, let's make a UIAlertView to tell us that it finished respringing.
UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"Welcome"
message:@"This is a test."
delegate:self
cancelButtonTitle:@"Testing"
otherButtonTitles:nil];
//Now show that alert
[alert1 show];
//And release it. We don't want any memory leaks ;)
[alert1 release];
}
//This lets logos know we're done hooking this header.
%end