forked from donato-fiore/TrollDecrypt
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathTDUtils.m
More file actions
551 lines (440 loc) · 22.9 KB
/
TDUtils.m
File metadata and controls
551 lines (440 loc) · 22.9 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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
254
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
#import "TDUtils.h"
#import "TDDumpDecrypted.h"
#import "LSApplicationProxy+AltList.h"
static NSString *getLogPath(void) {
return [NSTemporaryDirectory() stringByAppendingPathComponent:@"lldb_output.log"];
}
static BOOL waitForContentOfFileSync(NSString *filePath, NSString *content, NSTimeInterval timeout) {
int fd = open([filePath UTF8String], O_EVTONLY);
if (fd == -1) {
NSLog(@"[trolldecrypt] Failed to open file for monitoring: %@", filePath);
return NO;
}
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_VNODE, fd, DISPATCH_VNODE_WRITE, queue);
dispatch_source_set_event_handler(source, ^{
NSString *fileContent = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
if ([fileContent containsString:content]) {
NSLog(@"[trolldecrypt] File content matched: %@", filePath);
dispatch_semaphore_signal(semaphore);
}
});
dispatch_resume(source);
int rc = dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)));
dispatch_source_cancel(source);
close(fd);
return (rc == 0);
}
static NSString *lldbQuotedProcessName(const char *executableName) {
if (!executableName) {
return nil;
}
NSString *name = [NSString stringWithUTF8String:executableName];
if (!name) {
return nil;
}
NSCharacterSet *controlSet = [NSCharacterSet controlCharacterSet];
NSMutableString *sanitized = [NSMutableString stringWithCapacity:name.length];
for (NSUInteger i = 0; i < name.length; i++) {
unichar c = [name characterAtIndex:i];
if ([controlSet characterIsMember:c]) {
continue;
}
[sanitized appendFormat:@"%C", c];
}
NSString *escaped = [[sanitized stringByReplacingOccurrencesOfString:@"\" withString:@"\\"]
stringByReplacingOccurrencesOfString:@""" withString:@"\""];
return [NSString stringWithFormat:@""%@"", escaped];
}
UIWindow *alertWindow = NULL;
UIWindow *kw = NULL;
UIViewController *root = NULL;
UIAlertController *alertController = NULL;
UIAlertController *doneController = NULL;
UIAlertController *errorController = NULL;
NSArray *appList(void) {
NSMutableArray *apps = [NSMutableArray array];
NSArray <LSApplicationProxy *> *installedApplications = [[LSApplicationWorkspace defaultWorkspace] atl_allInstalledApplications];
[installedApplications enumerateObjectsUsingBlock:^(LSApplicationProxy *proxy, NSUInteger idx, BOOL *stop) {
if (![proxy atl_isUserApplication]) return;
NSString *bundleID = [proxy atl_bundleIdentifier];
NSString *name = [proxy atl_nameToDisplay];
NSString *version = [proxy atl_shortVersionString];
NSString *executable = proxy.canonicalExecutablePath;
if (!bundleID || !name || !version || !executable) return;
NSDictionary *item = @{
@"bundleID":bundleID,
@"name":name,
@"version":version,
@"executable":executable
};
[apps addObject:item];
}];
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
[apps sortUsingDescriptors:@[descriptor]];
[apps addObject:@{@"bundleID":@"", @"name":@"", @"version":@"", @"executable":@""}];
return [apps copy];
}
NSUInteger iconFormat(void) {
return (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) ? 8 : 10;
}
NSArray *sysctl_ps(void) {
NSMutableArray *array = [[NSMutableArray alloc] init];
int numberOfProcesses = proc_listpids(PROC_ALL_PIDS, 0, NULL, 0);
pid_t pids[numberOfProcesses];
bzero(pids, sizeof(pids));
proc_listpids(PROC_ALL_PIDS, 0, pids, sizeof(pids));
for (int i = 0; i < numberOfProcesses; ++i) {
if (pids[i] == 0) { continue; }
char pathBuffer[PROC_PIDPATHINFO_MAXSIZE];
bzero(pathBuffer, PROC_PIDPATHINFO_MAXSIZE);
proc_pidpath(pids[i], pathBuffer, sizeof(pathBuffer));
if (strlen(pathBuffer) > 0) {
NSString *processID = [[NSString alloc] initWithFormat:@"%d", pids[i]];
NSString *processName = [[NSString stringWithUTF8String:pathBuffer] lastPathComponent];
NSDictionary *dict = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects:processID, processName, nil] forKeys:[NSArray arrayWithObjects:@"pid", @"proc_name", nil]];
[array addObject:dict];
}
}
return [array copy];
}
void decryptApp(NSDictionary *app) {
dispatch_async(dispatch_get_main_queue(), ^{
alertWindow = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].bounds];
alertWindow.rootViewController = [UIViewController new];
alertWindow.windowLevel = UIWindowLevelAlert + 1;
[alertWindow makeKeyAndVisible];
// Show a "Decrypting!" alert on the device and block the UI
kw = alertWindow;
if([kw respondsToSelector:@selector(topmostPresentedViewController)])
root = [kw performSelector:@selector(topmostPresentedViewController)];
else
root = [kw rootViewController];
root.modalPresentationStyle = UIModalPresentationFullScreen;
});
NSLog(@"[trolldecrypt] decrypt...");
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *bundleID = app[@"bundleID"];
NSString *name = app[@"name"];
NSString *version = app[@"version"];
NSString *executable = app[@"executable"];
NSString *binaryName = [executable lastPathComponent];
NSLog(@"[trolldecrypt] bundleID: %@", bundleID);
NSLog(@"[trolldecrypt] name: %@", name);
NSLog(@"[trolldecrypt] version: %@", version);
NSLog(@"[trolldecrypt] executable: %@", executable);
NSLog(@"[trolldecrypt] binaryName: %@", binaryName);
NSLog(@"[trolldecrypt] lldb --waitfor for '%@'...", binaryName);
pid_t lldb_pid = attachLLDBToProcessByName([binaryName UTF8String], -1);//-1 for unknown
if (lldb_pid <= 0) {
dispatch_async(dispatch_get_main_queue(), ^{
errorController = [UIAlertController alertControllerWithTitle:@"Error: lldb" message:@"Failed to start lldb. Make sure lldb is installed." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[errorController dismissViewControllerAnimated:NO completion:nil];
[kw removeFromSuperview];
kw.hidden = YES;
}];
[errorController addAction:okAction];
[root presentViewController:errorController animated:YES completion:nil];
});
return;
}
// Kill existing process if any
NSArray *processes;
NSLog(@"[trolldecrypt] kill existing process if any...");
processes = sysctl_ps();
for (NSDictionary *process in processes) {
NSString *proc_name = process[@"proc_name"];
if ([proc_name isEqualToString:binaryName]) {
pid_t pid = [process[@"pid"] intValue];
NSLog(@"[trolldecrypt] Found app PID: %d (existing)", pid);
kill(pid, SIGKILL);
break;
}
}
NSLog(@"[trolldecrypt] launch app and lldb force pause...");
[[UIApplication sharedApplication] launchApplicationWithIdentifier:bundleID suspended:YES]; // Launch app in suspended state
waitForContentOfFileSync(getLogPath(), @"Architecture set to", 30.0); // Wait for lldb to attach
// Get PID after lldb caught it
pid_t pid = -1;
processes = sysctl_ps();
for (NSDictionary *process in processes) {
NSString *proc_name = process[@"proc_name"];
if ([proc_name isEqualToString:binaryName]) {
pid = [process[@"pid"] intValue];
NSLog(@"[trolldecrypt] Found app PID: %d (paused by lldb)", pid);
break;
}
}
if (pid == -1) {
dispatch_async(dispatch_get_main_queue(), ^{
[alertController dismissViewControllerAnimated:NO completion:nil];
NSLog(@"[trolldecrypt] failed to get pid for binary name: %@", binaryName);
errorController = [UIAlertController alertControllerWithTitle:@"Error: -1" message:[NSString stringWithFormat:@"Failed to get PID for binary name: %@", binaryName] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Ok", @"Ok") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSLog(@"[trolldecrypt] Ok action");
[errorController dismissViewControllerAnimated:NO completion:nil];
[kw removeFromSuperview];
kw.hidden = YES;
}];
[errorController addAction:okAction];
[root presentViewController:errorController animated:YES completion:nil];
});
return;
}
NSLog(@"[trolldecrypt] pid: %d", pid);
bfinject_rocknroll(pid, name, version, lldb_pid);
});
}
pid_t attachLLDBToProcessByName(const char *executableName, pid_t target_pid) {
NSLog(@"[trolldecrypt] Attaching lldb to executable: %s (PID: %d)", executableName, target_pid);
NSString *scriptPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"lldb_attach.txt"];
NSString *quotedName = lldbQuotedProcessName(executableName);
if (!quotedName) {
NSLog(@"[trolldecrypt] Invalid executable name for lldb attach");
return 0;
}
NSString *scriptContent = [NSString stringWithFormat:
@"process attach --name %@ --waitfor
", quotedName];
[scriptContent writeToFile:scriptPath atomically:YES encoding:NSUTF8StringEncoding error:nil];
NSString *logPath = getLogPath();
pid_t lldb_pid = 0;
const char *lldb_path = "/var/jb/usr/bin/lldb"; // TODO: please edit to use auto scheme for rootful/roothide, i'm lazy and forgot to do it
const char *args[] = {
"lldb",
"-s", [scriptPath UTF8String], // Source script file
NULL
};
posix_spawn_file_actions_t actions;
posix_spawn_file_actions_init(&actions);
posix_spawn_file_actions_addopen(&actions, STDOUT_FILENO, [logPath UTF8String], O_WRONLY | O_CREAT | O_TRUNC, 0644);
posix_spawn_file_actions_addopen(&actions, STDERR_FILENO, [logPath UTF8String], O_WRONLY | O_CREAT | O_APPEND, 0644);
int status = posix_spawn(&lldb_pid, lldb_path, &actions, NULL, (char *const *)args, NULL);
posix_spawn_file_actions_destroy(&actions);
if (status == 0) {
NSLog(@"[trolldecrypt] lldb spawned done, lldb PID: %d", lldb_pid);
NSLog(@"[trolldecrypt] lldb output: %@", logPath);
waitForContentOfFileSync(logPath, @"process attach --name", 5.0);
sleep(1); // Give lldb a moment to settle
// Verify lldb is still running
if (kill(lldb_pid, 0) == 0) {
NSLog(@"[trolldecrypt] lldb attached to '%s' (PID: %d)", executableName, target_pid);
} else {
NSLog(@"[trolldecrypt] lldb process died");
lldb_pid = 0;
}
} else {
NSLog(@"[trolldecrypt] fail to spawn lldb: %d", status);
lldb_pid = 0;
}
return lldb_pid;
}
// Detach lldb from process
void detachLLDB(pid_t lldb_pid) {
if (lldb_pid > 0) {
NSLog(@"[trolldecrypt] Detaching lldb (PID: %d)", lldb_pid);
kill(lldb_pid, SIGTERM);
sleep(1);
if (kill(lldb_pid, 0) == 0) {
NSLog(@"[trolldecrypt] lldb still running, sending SIGKILL");
kill(lldb_pid, SIGKILL);
}
NSLog(@"[trolldecrypt] lldb detached successfully");
// Reap the lldb process
int unused;
waitpid(lldb_pid, &unused, WNOHANG);
}
}
void bfinject_rocknroll(pid_t pid, NSString *appName, NSString *version, pid_t lldb_pid) {
NSLog(@"[trolldecrypt] decrypt...");
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{;
NSLog(@"[trolldecrypt] Process PID: %d, lldb PID: %d", pid, lldb_pid);
// Get full path
char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
proc_pidpath(pid, pathbuf, sizeof(pathbuf));
const char *fullPathStr = pathbuf;
NSLog(@"[trolldecrypt] fullPathStr: %s", fullPathStr);
NSLog(@"[trolldecrypt] Process is already PAUSED by lldb");
DumpDecrypted *dd = [[DumpDecrypted alloc] initWithPathToBinary:[NSString stringWithUTF8String:fullPathStr] appName:appName appVersion:version];
if(!dd) {
NSLog(@"[trolldecrypt] ERROR: failed to get DumpDecrypted instance");
return;
}
NSLog(@"[trolldecrypt] Full path to app: %s /// IPA File: %@", fullPathStr, [dd IPAPath]);
dispatch_async(dispatch_get_main_queue(), ^{
alertWindow = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].bounds];
alertWindow.rootViewController = [UIViewController new];
alertWindow.windowLevel = UIWindowLevelAlert + 1;
[alertWindow makeKeyAndVisible];
// Show a "Decrypting!" alert on the device and block the UI
alertController = [UIAlertController
alertControllerWithTitle:@"Decrypting"
message:@"Please wait, this will take a few seconds..."
preferredStyle:UIAlertControllerStyleAlert];
kw = alertWindow;
if([kw respondsToSelector:@selector(topmostPresentedViewController)])
root = [kw performSelector:@selector(topmostPresentedViewController)];
else
root = [kw rootViewController];
root.modalPresentationStyle = UIModalPresentationFullScreen;
[root presentViewController:alertController animated:YES completion:nil];
});
NSLog(@"[trolldecrypt] Starting decryption while process is paused...");
[dd createIPAFile:pid];
NSLog(@"[trolldecrypt] Decryption complete!");
NSLog(@"[trolldecrypt] Detaching lldb...");
detachLLDB(lldb_pid);
// Dismiss the alert box
dispatch_async(dispatch_get_main_queue(), ^{
[alertController dismissViewControllerAnimated:NO completion:nil];
doneController = [UIAlertController alertControllerWithTitle:@"Decryption Complete!" message:[NSString stringWithFormat:@"IPA file saved to:\n%@\n\nThanks to lldb so we can archive this!", [dd IPAPath]] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Ok", @"Ok") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[kw removeFromSuperview];
kw.hidden = YES;
}];
[doneController addAction:okAction];
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"filza://"]]) {
UIAlertAction *openAction = [UIAlertAction actionWithTitle:@"Show in Filza" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[kw removeFromSuperview];
kw.hidden = YES;
NSString *urlString = [NSString stringWithFormat:@"filza://view%@", [dd IPAPath]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:nil];
}];
[doneController addAction:openAction];
}
[root presentViewController:doneController animated:YES completion:nil];
}); // dispatch on main
NSLog(@"[trolldecrypt] Over and out.");
}); // dispatch in background
NSLog(@"[trolldecrypt] All done.");
}
NSArray *decryptedFileList(void) {
NSMutableArray *files = [NSMutableArray array];
NSMutableArray *fileNames = [NSMutableArray array];
// iterate through all files in the Documents directory
NSFileManager *fileManager = [NSFileManager defaultManager];
NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:docPath()];
NSString *file;
while (file = [directoryEnumerator nextObject]) {
if ([[file pathExtension] isEqualToString:@"ipa"]) {
NSString *filePath = [[docPath() stringByAppendingPathComponent:file] stringByStandardizingPath];
NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:filePath error:nil];
NSDate *modificationDate = fileAttributes[NSFileModificationDate];
NSDictionary *fileInfo = @{@"fileName": file, @"modificationDate": modificationDate};
[files addObject:fileInfo];
}
}
// Sort the array based on modification date
NSArray *sortedFiles = [files sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
NSDate *date1 = [obj1 objectForKey:@"modificationDate"];
NSDate *date2 = [obj2 objectForKey:@"modificationDate"];
return [date2 compare:date1];
}];
// Get the file names from the sorted array
for (NSDictionary *fileInfo in sortedFiles) {
[fileNames addObject:[fileInfo objectForKey:@"fileName"]];
}
return [fileNames copy];
}
NSString *docPath(void) {
NSError * error = nil;
[[NSFileManager defaultManager] createDirectoryAtPath:@"/var/mobile/Documents/TrollDecrypt/decrypted" withIntermediateDirectories:YES attributes:nil error:&error];
if (error != nil) {
NSLog(@"[trolldecrypt] error creating directory: %@", error);
}
return @"/var/mobile/Documents/TrollDecrypt/decrypted";
}
void decryptAppWithPID(pid_t pid) {
// generate App NSDictionary object to pass into decryptApp()
// proc_pidpath(self.pid, buffer, sizeof(buffer));
NSString *message = nil;
NSString *error = nil;
dispatch_async(dispatch_get_main_queue(), ^{
alertWindow = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].bounds];
alertWindow.rootViewController = [UIViewController new];
alertWindow.windowLevel = UIWindowLevelAlert + 1;
[alertWindow makeKeyAndVisible];
// Show a "Decrypting!" alert on the device and block the UI
kw = alertWindow;
if([kw respondsToSelector:@selector(topmostPresentedViewController)])
root = [kw performSelector:@selector(topmostPresentedViewController)];
else
root = [kw rootViewController];
root.modalPresentationStyle = UIModalPresentationFullScreen;
});
NSLog(@"[trolldecrypt] pid: %d", pid);
char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
proc_pidpath(pid, pathbuf, sizeof(pathbuf));
NSString *executable = [NSString stringWithUTF8String:pathbuf];
NSString *path = [executable stringByDeletingLastPathComponent];
NSDictionary *infoPlist = [NSDictionary dictionaryWithContentsOfFile:[path stringByAppendingPathComponent:@"Info.plist"]];
NSString *bundleID = infoPlist[@"CFBundleIdentifier"];
if (!bundleID) {
error = @"Error: -2";
message = [NSString stringWithFormat:@"Failed to get bundle id for pid: %d", pid];
}
LSApplicationProxy *app = [LSApplicationProxy applicationProxyForIdentifier:bundleID];
if (!app) {
error = @"Error: -3";
message = [NSString stringWithFormat:@"Failed to get LSApplicationProxy for bundle id: %@", bundleID];
}
if (message) {
dispatch_async(dispatch_get_main_queue(), ^{
[alertController dismissViewControllerAnimated:NO completion:nil];
NSLog(@"[trolldecrypt] failed to get bundleid for pid: %d", pid);
errorController = [UIAlertController alertControllerWithTitle:error message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Ok", @"Ok") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSLog(@"[trolldecrypt] Ok action");
[errorController dismissViewControllerAnimated:NO completion:nil];
[kw removeFromSuperview];
kw.hidden = YES;
}];
[errorController addAction:okAction];
[root presentViewController:errorController animated:YES completion:nil];
});
}
NSLog(@"[trolldecrypt] app: %@", app);
NSDictionary *appInfo = @{
@"bundleID":bundleID,
@"name":[app atl_nameToDisplay],
@"version":[app atl_shortVersionString],
@"executable":executable
};
NSLog(@"[trolldecrypt] appInfo: %@", appInfo);
dispatch_async(dispatch_get_main_queue(), ^{
[alertController dismissViewControllerAnimated:NO completion:nil];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Decrypt" message:[NSString stringWithFormat:@"Decrypt %@?", appInfo[@"name"]] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *decrypt = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
decryptApp(appInfo);
}];
[alert addAction:decrypt];
[alert addAction:cancel];
[root presentViewController:alert animated:YES completion:nil];
});
}
// void github_fetchLatedVersion(NSString *repo, void (^completionHandler)(NSString *latestVersion)) {
// NSString *urlString = [NSString stringWithFormat:@"https://api.github.com/repos/%@/releases/latest", repo];
// NSURL *url = [NSURL URLWithString:urlString];
// NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
// if (!error) {
// if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
// NSError *jsonError;
// NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
// if (!jsonError) {
// NSString *version = [json[@"tag_name"] stringByReplacingOccurrencesOfString:@"v" withString:@""];
// completionHandler(version);
// }
// }
// }
// }];
// [task resume];
// }
void fetchLatestTrollDecryptVersion(void (^completionHandler)(NSString *version)) {
//github_fetchLatedVersion(@"donato-fiore/TrollDecrypt", completionHandler);
}
NSString *trollDecryptVersion(void) {
return [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
}