-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathactivator.php
785 lines (752 loc) · 83.2 KB
/
activator.php
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
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
<?php
// POWERED BY: MiUnlockCode
header_remove();
ini_set('default_charset', '');
if (isset($_POST['ActivationInfoXML']) || isset($_POST['activation-info'])) { }
else { die("Error: 473"); }
require('./var/www/crypt/RSA.php');
if ( isset($_GET['generateAppTicket']) ) { $file = './var/www/requests/'.$_GET['generateAppTicket'];
if ( is_file($file) ) { header("Content-Type: text/xml");
header("ARS: ".file_get_contents('./var/www/requests/'.$_GET['saveRequestTicket'].'-ARS.txt'));
$activationinfo = file_get_contents($file);
if (strpos($activationinfo, 'Apple ID') !== false) exit('Please disable "Find My iPhone" and retry.');
else exit($activationinfo);
}
} elseif ( isset($_POST['saveRequestTicket']) ) { actAlbert($_POST['ActivationInfoXML']);
} elseif ( isset($_POST['saveRequestTicketWindows']) ) { actAlbert($_POST['ActivationInfoXML']);
} elseif ( isset($_POST['getHandShake']) ) { getHandShake();
} elseif ( isset($_POST) && !empty($_POST)) { actAlbert($_POST);
} else { die;
}
function actAlbert($activationinfo) {
$ipaddress = get_client_ip();
if (isset($_POST['ActivationInfoXML'])) { $rawactpost = $_POST['ActivationInfoXML']; }
elseif (isset($_POST['activation-info'])) { $rawactpost = $_POST['activation-info']; }
/*if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'iDevice') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'FirstApp') !== false) {
if (strpos($activationinfo, 'activation-info') == false) { $activationinfo = http_build_query(array('activation-info' => $activationinfo )); }
}*/
$activationinfo = http_build_query(array('activation-info' => $activationinfo ));
if (isset($_GET['saveRequestTicket']) && !isset($_GET['update'])) {
if (is_file('./var/www/requests/'.$_GET['saveRequestTicket'].'.html')) {
if (is_file('./var/www/requests/'.$_GET['saveRequestTicket'].'-ARS.txt')) { header("ARS: ".file_get_contents('./var/www/requests/'.$_GET['saveRequestTicket'].'-ARS.txt')); }
exit(file_get_contents('./var/www/requests/'.$_GET['saveRequestTicket'].'.html'));
}
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: text/xml"));
curl_setopt($ch, CURLOPT_URL, "https://albert.apple.com/deviceservices/deviceActivation");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $activationinfo);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$albert = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($albert, 0, $header_size);
$body = substr($albert, $header_size);
curl_close ($ch);
$albertHeaderSize = $header_size;
$albertBodySize = strlen($body);
http_response_code($httpcode);
if (strpos($header, 'ARS') !== false) {
$ARS = explode("\r\nARS: ", $header);
$ARS = explode("\r\n", $ARS[1]);
$ARS = $ARS[0];
header("ARS: " . $ARS);
} else { $ARS = ''; }
foreach (getallheaders() as $name => $value) { $headers[$name] = $value; }
$logfile = "logfilename.log";
$rawpost = json_encode($_POST, true);
$rawget = json_encode($_GET, true);
$rawdata = file_get_contents('php://input');
$boundary = boundary();
if(strpos($body, 'clientInfo ack-received="true') !== false) {
header("Content-Type: application/x-buddyml");
echo $body;
exit;
} elseif(strpos($body, 'AccountToken---Certificate') !== false) {
$data = ActivationRecordXML($body);
$dir = './var/www/requests';
$requestfile = '';
if(isset($_GET['saveRequestTicket'])) { $requestfile .= $_GET['saveRequestTicket']; }
file_put_contents('./var/www/requests/'.$requestfile.'-AccTokenCert.txt' ,$data['AccountTokenCertificate']."\n".urldecode($activationinfo)."\n".$body);
// openssl_sign(base64_decode($data['AccountToken']), $signature, openssl_pkey_get_private(PrivateKeyRaptor()), OPENSSL_ALGO_SHA1);
// $body = str_replace($data['AccountTokenSignature'], '', $body);
// $body = str_replace($data['AccountTokenCertificate'], AccountTokenCertificateTest(), $body);
// $body = str_replace($data['UniqueDeviceCertificate'], '', $body);
// file_put_contents('./var/www/requests/'.$_GET['saveRequestTicket'].'-Body.txt', "\nOur sign:\n".$signature."\nAlb sign:\n".$data['AccountTokenSignature']."\nCert:\n".AccountTokenCertificateTest());
// if (!is_dir('./var/www/requests')) mkdir('./var/www/requests');
$data = call_user_func_array('array_merge', [ActivationRecordXML($body), ActivationRequestInfoXML($rawactpost, 1)]);
$FairPlayKeyData = $data['FairPlayKeyData'];
if(isset($data['SerialNumber'])) {
$data['ARS'] = $ARS;
$data['albertHeaderSize'] = $albertHeaderSize;
$data['albertBodySize'] = $albertBodySize;
$data['outputBodySize'] = strlen($body);
$data['outputHeaders'] = headers_list();
$fileDeviceCertRequest = $dir.'/'.$data['SerialNumber'].'-DeviceCert.pem';
file_put_contents($fileDeviceCertRequest, base64_decode($data['DeviceCertRequest']));
$CSRout = base64_encode(shell_exec("(openssl x509 -req -days 1096 -CA $dir/CAcrt.pem -CAkey $dir/privkey.pem -set_serial 0x$(openssl rand -hex 9) -outform PEM -sha1 -extensions v3_ca -extfile $dir/CSR.cnf -in $fileDeviceCertRequest)"));
// // Replace DeviceCertificate //
// $body = str_replace($data['DeviceCertificate'], $CSRout, $body);
// $body = str_replace($data['ActivationInfoXML'], str_repeat("1", strlen($data['ActivationInfoXML'])), $body);
file_put_contents($fileDeviceCertRequest.".csr", base64_decode($data['DeviceCertRequest'])."\n\n".base64_decode($CSRout));
$file = './var/www/requests/'.$data['SerialNumber'].'-'.$data['DeviceClass'].'-'.$data['RegionCode'].'-'.$data['ProductVersion'].'-'.$data['RegulatoryModelNumber'];
if (is_file($file.'-all.txt')) { file_put_contents($file.'-all.txt', json_encode($data)."\r\n".file_get_contents($file.'-all.txt')); }
else { file_put_contents($file.'-all.txt', json_encode($data)); }
file_put_contents($file.'-raw.txt', $data);
}
} else {
$serverKP = substr(chunk_split(base64_encode(current(explode('</data>', next(explode('<key>serverKP</key><data>', drmHandshake()))))), 68, "\n\t"), 0, -2);
$data = ActivationRequestInfoXML($rawactpost, 1);
$ActivationInfoXML = base64_decode($data['ActivationInfoXML']);
$dataSet = ActivationRequestInfoXMLNew(reqTicket($ActivationInfoXML, $serverKP));
$reqTicketOut = reqTicket(makeTickets($ActivationInfoXML, $dataSet['InternationalMobileEquipmentIdentity'], $dataSet['SerialNumber'], $dataSet['UniqueDeviceID']), $serverKP);
$final = actAlbertTicket($reqTicketOut);
$dataGet = ActivationRecordXML($final);
if ($AccountToken = base64_decode($dataGet['AccountToken'])) {
file_put_contents('./var/www/requests/'.$data['SerialNumber'].'-'.$data['DeviceClass'].'-'.$data['RegionCode'].'-'.$data['ProductVersion'].'-Token.txt', "Before: ".$AccountToken."\n");
if(strpos($AccountToken, 'MobileEquipmentIdentifier') !== false) {
$AccountToken = str_replace($dataGet['InternationalMobileEquipmentIdentity'] , $dataSet['InternationalMobileEquipmentIdentity'], $AccountToken);
$AccountToken = str_replace($dataGet['MobileEquipmentIdentifier'] , $dataSet['MobileEquipmentIdentifier'], $AccountToken);
$AccountToken = str_replace($dataGet['SerialNumber'] , $dataSet['SerialNumber'], $AccountToken);
$AccountToken = str_replace($dataGet['UniqueDeviceID'] , $dataSet['UniqueDeviceID'], $AccountToken);
if (isset($dataGet['ActivationTicket'])) {
$AccountToken = str_replace($dataGet['ActivationTicket'], base64_encode(hex2bin(str_replace(array('35567207227802', '35495707243538'), array(substr($dataSet['InternationalMobileEquipmentIdentity'], 0, 14), substr($dataSet['InternationalMobileEquipmentIdentity'], 0, 14)), bin2hex(base64_decode($dataGet['ActivationTicket']))))), $AccountToken);
} elseif (isset($dataGet['WildcardTicket'])) {
$AccountToken = str_replace($dataGet['WildcardTicket'], base64_encode(hex2bin(str_replace(array('35567207227802', '35495707243538'), array(substr($dataSet['InternationalMobileEquipmentIdentity'], 0, 14), substr($dataSet['InternationalMobileEquipmentIdentity'], 0, 14)), bin2hex(base64_decode($dataGet['WildcardTicket']))))), $AccountToken);
}
}
elseif(strpos($AccountToken, 'InternationalMobileEquipmentIdentity') !== false) {
$AccountToken = str_replace($dataGet['InternationalMobileEquipmentIdentity'] , $dataSet['InternationalMobileEquipmentIdentity'], $AccountToken);
$AccountToken = str_replace($dataGet['SerialNumber'] , $dataSet['SerialNumber'], $AccountToken);
if (isset($dataGet['ActivationTicket'])) {
$AccountToken = str_replace($dataGet['ActivationTicket'], base64_encode(hex2bin(str_replace(array('35567207227802', '35495707243538'), array(substr($dataSet['InternationalMobileEquipmentIdentity'], 0, 14), substr($dataSet['InternationalMobileEquipmentIdentity'], 0, 14)), bin2hex(base64_decode($dataGet['ActivationTicket']))))), $AccountToken);
} elseif (isset($dataGet['WildcardTicket'])) {
$AccountToken = str_replace($dataGet['WildcardTicket'], base64_encode(hex2bin(str_replace(array('35567207227802', '35495707243538'), array(substr($dataSet['InternationalMobileEquipmentIdentity'], 0, 14), substr($dataSet['InternationalMobileEquipmentIdentity'], 0, 14)), bin2hex(base64_decode($dataGet['WildcardTicket']))))), $AccountToken);
}
}
elseif(strpos($AccountToken, 'SerialNumber') !== false) {
$AccountToken = str_replace($dataGet['SerialNumber'] , $dataSet['SerialNumber'], $AccountToken);
} else {
die('Error: 772');
}
// $AccountToken = str_replace('WildcardTicket', 'ActivationTicket', $AccountToken);
$AccountToken = str_replace('ActivationTicket', 'WildcardTicket', $AccountToken);
openssl_sign($AccountToken, $AccountTokenSignature, openssl_pkey_get_private(PrivateKeyRaptor()), OPENSSL_ALGO_SHA1);
$body = str_replace($dataGet['AccountTokenSignature'], base64_encode($AccountTokenSignature), str_replace($dataGet['AccountToken'], base64_encode($AccountToken), $final));
$body = str_replace('<key>DeviceCertificate</key>', '<key>DeviceConfigurationFlags</key><string>0</string><key>DeviceCertificate</key>', $body);
/*
$body = str_replace('<key>FairPlayKeyData</key>', '', $body);
$body = str_replace($dataGet['FairPlayKeyData'], '', $body);
$body = str_replace('<data></data>', '', $body);
*/
}
else {
$ActivationInfoXML = $data['ActivationInfoXML'];
if(isset($data['MobileEquipmentIdentifier']) && isset($data['ActivationRandomness'])) {
$AccountToken = '{
"InternationalMobileEquipmentIdentity" = "'.$data['InternationalMobileEquipmentIdentity'].'";
"MobileEquipmentIdentifier" = "'.$data['MobileEquipmentIdentifier'].'";
"SerialNumber" = "'.$data['SerialNumber'].'";
"ProductType" = "'.$data['ProductType'].'";
"UniqueDeviceID" = "'.$data['UniqueDeviceID'].'";
"ActivationRandomness" = "'.$data['ActivationRandomness'].'";
"ActivityURL" = "https://albert.apple.com/deviceservices/activity";
"PhoneNumberNotificationURL" = "https://albert.apple.com/deviceservices/phoneHome";
"ActivationTicket" = "MIIBlQIBATALBgkqhkiG9w0BAQUxYJ8/BC56C7CfQAThIG8An0sUiTgt/7kRqltcW9/wE3cVASX7moifh20HATiRACURN5+XPQwAAAAA7u7u7u7u7u+flz4EAAAAAJ+XPwQBAAAAn5dABAEAAACfl0wEAAAAAASBgKGhiSVSKmUcLcWBY4/i4hwTL8N9b6d7lEmyZ8fYnFL2+kmrSAFGAS6GILW97/2OEUFD3sMyXKEvQsjHXdMosBIUH33CaMuLi2rgEEvLGFSEYnGo5Bx9E1mtScikaAgPlxtToLyuLdz89+M9UN5xBSqTqF9RG55J5WQUd0nZhlRjo4GdMAsGCSqGSIb3DQEBAQOBjQAwgYkCgYEA7To/ZNHoIJzBUgY0734vsgl+ACxDQ+f4quvmSrPAtgDENSZwaVrHXpF+cRKBABqkDa00YcENx2dtS1tuHLKDNn1zMZLaZRpiK9UeiMPNZL6mlg12BWLwVjlFOGED8U6pfXwOw6D/FCDRgvyGBn7wsw8sEa7AdlYmMHGmkvwgOP0CAwEAAQ==";
}'; }
elseif(isset($data['MobileEquipmentIdentifier'])) {
$AccountToken = '{
"InternationalMobileEquipmentIdentity" = "'.$data['InternationalMobileEquipmentIdentity'].'";
"MobileEquipmentIdentifier" = "'.$data['MobileEquipmentIdentifier'].'";
"SerialNumber" = "'.$data['SerialNumber'].'";
"ProductType" = "'.$data['ProductType'].'";
"UniqueDeviceID" = "'.$data['UniqueDeviceID'].'";
"ActivityURL" = "https://albert.apple.com/deviceservices/activity";
"PhoneNumberNotificationURL" = "https://albert.apple.com/deviceservices/phoneHome";
"ActivationTicket" = "MIIBlQIBATALBgkqhkiG9w0BAQUxYJ8/BC56C7CfQAThIG8An0sUiTgt/7kRqltcW9/wE3cVASX7moifh20HATiRACURN5+XPQwAAAAA7u7u7u7u7u+flz4EAAAAAJ+XPwQBAAAAn5dABAEAAACfl0wEAAAAAASBgKGhiSVSKmUcLcWBY4/i4hwTL8N9b6d7lEmyZ8fYnFL2+kmrSAFGAS6GILW97/2OEUFD3sMyXKEvQsjHXdMosBIUH33CaMuLi2rgEEvLGFSEYnGo5Bx9E1mtScikaAgPlxtToLyuLdz89+M9UN5xBSqTqF9RG55J5WQUd0nZhlRjo4GdMAsGCSqGSIb3DQEBAQOBjQAwgYkCgYEA7To/ZNHoIJzBUgY0734vsgl+ACxDQ+f4quvmSrPAtgDENSZwaVrHXpF+cRKBABqkDa00YcENx2dtS1tuHLKDNn1zMZLaZRpiK9UeiMPNZL6mlg12BWLwVjlFOGED8U6pfXwOw6D/FCDRgvyGBn7wsw8sEa7AdlYmMHGmkvwgOP0CAwEAAQ==";
}'; }
elseif(isset($data['ActivationRandomness'])) {
$AccountToken = '{
"InternationalMobileEquipmentIdentity" = "'.$data['InternationalMobileEquipmentIdentity'].'";
"SerialNumber" = "'.$data['SerialNumber'].'";
"ProductType" = "'.$data['ProductType'].'";
"UniqueDeviceID" = "'.$data['UniqueDeviceID'].'";
"ActivationRandomness" = "'.$data['ActivationRandomness'].'";
"ActivityURL" = "https://albert.apple.com/deviceservices/activity";
"PhoneNumberNotificationURL" = "https://albert.apple.com/deviceservices/phoneHome";
"ActivationTicket" = "MIIBlQIBATALBgkqhkiG9w0BAQUxYJ8/BC56C7CfQAThIG8An0sUiTgt/7kRqltcW9/wE3cVASX7moifh20HATiRACURN5+XPQwAAAAA7u7u7u7u7u+flz4EAAAAAJ+XPwQBAAAAn5dABAEAAACfl0wEAAAAAASBgKGhiSVSKmUcLcWBY4/i4hwTL8N9b6d7lEmyZ8fYnFL2+kmrSAFGAS6GILW97/2OEUFD3sMyXKEvQsjHXdMosBIUH33CaMuLi2rgEEvLGFSEYnGo5Bx9E1mtScikaAgPlxtToLyuLdz89+M9UN5xBSqTqF9RG55J5WQUd0nZhlRjo4GdMAsGCSqGSIb3DQEBAQOBjQAwgYkCgYEA7To/ZNHoIJzBUgY0734vsgl+ACxDQ+f4quvmSrPAtgDENSZwaVrHXpF+cRKBABqkDa00YcENx2dtS1tuHLKDNn1zMZLaZRpiK9UeiMPNZL6mlg12BWLwVjlFOGED8U6pfXwOw6D/FCDRgvyGBn7wsw8sEa7AdlYmMHGmkvwgOP0CAwEAAQ==";
}'; }
else { $AccountToken = '{
"InternationalMobileEquipmentIdentity" = "'.$data['InternationalMobileEquipmentIdentity'].'";
"SerialNumber" = "'.$data['SerialNumber'].'";
"ProductType" = "'.$data['ProductType'].'";
"UniqueDeviceID" = "'.$data['UniqueDeviceID'].'";
"ActivityURL" = "https://albert.apple.com/deviceservices/activity";
"PhoneNumberNotificationURL" = "https://albert.apple.com/deviceservices/phoneHome";
"ActivationTicket" = "MIIBlQIBATALBgkqhkiG9w0BAQUxYJ8/BC56C7CfQAThIG8An0sUiTgt/7kRqltcW9/wE3cVASX7moifh20HATiRACURN5+XPQwAAAAA7u7u7u7u7u+flz4EAAAAAJ+XPwQBAAAAn5dABAEAAACfl0wEAAAAAASBgKGhiSVSKmUcLcWBY4/i4hwTL8N9b6d7lEmyZ8fYnFL2+kmrSAFGAS6GILW97/2OEUFD3sMyXKEvQsjHXdMosBIUH33CaMuLi2rgEEvLGFSEYnGo5Bx9E1mtScikaAgPlxtToLyuLdz89+M9UN5xBSqTqF9RG55J5WQUd0nZhlRjo4GdMAsGCSqGSIb3DQEBAQOBjQAwgYkCgYEA7To/ZNHoIJzBUgY0734vsgl+ACxDQ+f4quvmSrPAtgDENSZwaVrHXpF+cRKBABqkDa00YcENx2dtS1tuHLKDNn1zMZLaZRpiK9UeiMPNZL6mlg12BWLwVjlFOGED8U6pfXwOw6D/FCDRgvyGBn7wsw8sEa7AdlYmMHGmkvwgOP0CAwEAAQ==";
}'; }
$AccountToken = base64_encode($AccountToken);
// iPhone 5S - FPDATA
if (empty($FairPlayKeyData)) {
$FairPlayKeyData = 'LS0tLS1CRUdJTiBDT05UQUlORVItLS0tLQpBQUVBQWNvQkpGVDdsbGVLL01aMUpZZDY0RmhqN2tPV1ZyMDcycXdIYURqZFFsdCtNZUNDUVNKeWVwWktyZGhGCmdXNWJMUStvUjZXamk4VUc5c1JvZUZTOHJsRGRLeVNzOVZkc1BYRUlQdHVLOWJQenZuWEtCTXBLSC9LNXFNSXYKVFN6WEJweTRGY2R6dDVUMGNKRzQ3d0liNlZSYjNLT2dEQmpRR0VGM3luM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hqVVBPTHJkYUNxdmdhUEVYSEZHakg1MWJ0ZWFCbC9YSGRId1gwYwp0K3NPUmdiT3hrRSs1WFYybjE2aWt1TkpMK0xLMUNDUGgrYVpUUmFmNzFQSWwrVXpaNzgvdUF3UUFTR1gzT25pCnUrU045bnNpNGhLUDMrT3BwcVJWM1NtekxEalhqV0czb3dlNXJNSXgzM3ZJQmhzNDYvdHE2a05WSlNHWWFNUTQKTEllS1lLS2dJbThqRldkVFM1WFRQdFYwZjl4R0V6aDNPT05XRjQ1eS93L1d2V0VwaGJJWCtra1QrT0Z5bDFRdgpYbnZuYjkrT2FTUTJSa3VGTGdjczl1MHBENXdxSnZDVHFia0hOeXJHTGdNSXlBcWszeWsxOHgxcGVYbHE3bjY2CkdubkNPRUJUbE5WNlZCMnlvRzBOQWJXMUFiZzhnYUw4TXVhV1NHeU05b3cvVW9KSkoyRTFIR0ptNGF5UEc4aUYKZ1NxZndQLy9KY09SVks2WEgwNFlnaTJ3SzAvQjR3emdtVDM0RHh5bFpwYlBoLzY2R3BxOFVOWVBJWk5RUWVrWgpXUWlOZXhFMytjSXUwblVjU2xBU2hTdmx6bXJ3enRUZndaL1lHUEZkbkhhaG5yUjRkNEI2Mlg0bWR0Tm1lQWg4ClF4Uk5sdVNqN2p4UzZoMWpBelVnRTlFUXFaTGJ3NHpLMWRGaVhqaml5MEJLV29jTVNxRHBaa2R5ZForUE1zakgKSE92SEZnOS9ZMXVSOFVqMjdmNmlWZUZlcC9OU0N5M1FRZVFRbkdxMWovdTJhVHVuCi0tLS0tRU5EIENPTlRBSU5FUi0tLS0tCg==';
openssl_sign(base64_decode($AccountToken), $AccountTokenSignature, openssl_pkey_get_private(PrivateKeyRaptor()), OPENSSL_ALGO_SHA1);
$body = '<plist version="1.0">
<dict>
<key>iphone-activation</key>
<dict>
<key>activation-record</key>
<dict>
<key>AccountTokenCertificate</key>
<data>
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURaekNDQWsrZ0F3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
<data>
'.substr(chunk_split($AccountToken, 68, "\n\t"), 0, -2).'
</data>
<key>AccountTokenSignature</key>
<data>
'.substr(chunk_split(base64_encode($AccountTokenSignature), 68, "\n\t"), 0, -2).'
</data>
</dict>
<key>unbrick</key>
<true/>
<key>show-settings</key>
<true/>
</dict>
</dict>
</plist>
';
$body1 = '<plist version="1.0">
<dict>
<key>iphone-activation</key>
<dict>
<key>unbrick</key>
<true/>
<key>LDActivationVersion</key>
<integer>2</integer>
<key>activation-record</key>
<dict>
<key>AccountTokenCertificate</key>
<data>LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURaekNDQWsrZ0F3SUJBZ0lCQWpBTkJna3Foa2lHOXcwQkFRVUZBREI1TVFzd0NRWURWUVFHRXdKVlV6RVQKTUJFR0ExVUVDaE1LUVhCd2JHVWdTVzVqTGpFbU1DUUdBMVVFQ3hNZFFYQndiR1VnUTJWeWRHbG1hV05oZEdsdgpiaUJCZFhSb2IzSnBkSGt4TFRBckJnTlZCQU1USkVGd2NHeGxJR2xRYUc5dVpTQkRaWEowYVdacFkyRjBhVzl1CklFRjFkR2h2Y21sMGVUQWVGdzB3TnpBME1UWXlNalUxTURKYUZ3MHhOREEwTVRZeU1qVTFNREphTUZzeEN6QUoKQmdOVkJBWVRBbFZUTVJNd0VRWURWUVFLRXdwQmNIQnNaU0JKYm1NdU1SVXdFd1lEVlFRTEV3eEJjSEJzWlNCcApVR2h2Ym1VeElEQWVCZ05WQkFNVEYwRndjR3hsSUdsUWFHOXVaU0JCWTNScGRtRjBhVzl1TUlHZk1BMEdDU3FHClNJYjNEUUVCQVFVQUE0R05BRENCaVFLQmdRREZBWHpSSW1Bcm1vaUhmYlMyb1BjcUFmYkV2MGQxams3R2JuWDcKKzRZVWx5SWZwcnpCVmRsbXoySkhZdjErMDRJekp0TDdjTDk3VUk3ZmswaTBPTVkwYWw4YStKUFFhNFVnNjExVApicUV0K25qQW1Ba2dlM0hYV0RCZEFYRDlNaGtDN1Q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iSnpSa2tTRjZBSm9qSjZkSTd0RzhOd0lTNlQ5dVFTTkdQZzZ6OSt4VnY4RjhWRHNkVUxBMkRyc3h5cmsyClFBYjRTaU9sbDJHcENBWXgrOWpod1Rzd0RxV2lxbDE2OVZXYjllYVRRcEJnK2l4QVVKSlFkUU0vOTVsRUloNVkKQnl0TXk0VVV3Mjdic2FiYVZVNWxQdU40dGNzTHZRa21EMVBDREhYTDdzM3JlQjdPCi0tLS0tRU5EIENPTlRBSU5FUi0tLS0tCg==</data>
<key>AccountToken</key>
<data>'.$AccountToken.'</data>
<key>AccountTokenSignature</key>
<data>'.base64_encode($AccountTokenSignature).'</data>
</dict>
</dict>
</dict>
</plist>
';
$body2 = '<plist version="1.0">
<dict>
<key>ActivationRecord</key>
<dict>
<key>unbrick</key>
<true></true>
<key>AccountTokenCertificate</key>
<data>LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURaekNDQWsrZ0F3SUJBZ0lCQWpBTkJna3Foa2lHOXcwQkFRVUZBREI1TVFzd0NRWURWUVFHRXdKVlV6RVQKTUJFR0ExVUVDaE1LUVhCd2JHVWdTVzVqTGpFbU1DUUdBMVVFQ3hNZFFYQndiR1VnUTJWeWRHbG1hV05oZEdsdgpiaUJCZFhSb2IzSnBkSGt4TFRBckJnTlZCQU1USkVGd2NHeGxJR2xRYUc5dVpTQkRaWEowYVdacFkyRjBhVzl1CklFRjFkR2h2Y21sMGVUQWVGdzB3TnpBME1UWXlNalUxTURKYUZ3MHhOREEwTVRZeU1qVTFNREphTUZzeEN6QUoKQmdOVkJBWVRBbFZUTVJNd0VRWURWUVFLRXdwQmNIQnNaU0JKYm1NdU1SVXdFd1lEVlFRTEV3eEJjSEJzWlNCcApVR2h2Ym1VeElEQWVCZ05WQkFNVEYwRndjR3hsSUdsUWFHOXVaU0JCWTNScGRtRjBhVzl1TUlHZk1BMEdDU3FHClNJYjNEUUVCQVFVQUE0R05BRENCaVFLQmdRREZBWHpSSW1Bcm1va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lBWURWUjBsQVFIL0JCWXdGQVlJCkt3WUJCUVVIQXdFR0NDc0dBUVVGQndNQ01CQUdDaXFHU0liM1kyUUdDZ0lFQWdVQU1BMEdDU3FHU0liM0RRRUIKQlFVQUE0R0JBTE0yYS8yQU1MUmdLVDd3VWlsVEpMdEJYOGk5aDZhVGN2NzJaZC95Ulp2SUlOOWEzVm5mVjc0bApDRXh4S1Btdi9SU3g3bkppYkYwYjFKTU1uc3ppN05Memp5SGtIeDQ0VWNyYVJabUZYVjJHWjBVWXorVzRMQ1hQCndDODlCK242N25ad291b2N5WHNlY3o3VmduelhaRjVFVTBhTHZRamM0Yyt1UEMyTERUZnkKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=</data>
<key>AccountToken</key>
<data>'.$AccountToken.'</data>
<key>AccountTokenSignature</key>
<data>'.base64_encode($AccountTokenSignature).'</data>
<key>UniqueDeviceCertificate</key>
<data>LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURBRENDQXFpZ0F3SUJBZ0lHQVc0Vk1VQjBNQW9HQ0NxR1NNNDlCQU1DTUVVeEV6QVJCZ05WQkFnTUNrTmhiR2xtYjNKdWFXRXhFekFSQmdOVkJBb01Da0Z3Y0d4bElFbHVZeTR4R1RBWEJnTlZCQU1NRUVaRVVrUkRMVlZEVWxRdFUxVkNRMEV3SGhjTk1qQXdOVEUzTURNeU56RTNXaGNOTWpFd05URTNNRE15TnpFM1dqQnZNUk13RVFZRFZRUUlEQXBEWVd4cFptOXlibWxoTVJNd0VRWURWUVFLREFwQmNIQnNaU0JKYm1NdU1SNHdIQVlEVlFRTERCVjFZM0owSUV4bFlXWWdRMlZ5ZEdsbWFXTmhkR1V4SXpBaEJnTlZCQU1NR2pBd01EQTRNREV3TFRBd01ERkZNVEV5UXpFNE5EWTRNekkyTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFR2Q0aEF3M2x1NHZPWUFkcy9NMjhnWjEwdTR6M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FERVVNQklHQTFVRUF3d0wKVTBWUUlGSnZiM1FnUTBFeEV6QVJCZ05WQkFvTUNrRndjR3hsSUVsdVl5NHhFekFSQmdOVkJBZ01Da05oYkdsbQpiM0p1YVdFd0hoY05NVFl3TkRJMU1qTTBOVFEzV2hjTk1qa3dOakkwTWpFME16STBXakJGTVJNd0VRWURWUVFJCkRBcERZV3hwWm05eWJtbGhNUk13RVFZRFZRUUtEQXBCY0hCc1pTQkpibU11TVJrd0Z3WURWUVFEREJCR1JGSkUKUXkxVlExSlVMVk5WUWtOQk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRWFEYzJPL01ydVl2UApWUGFVYktSN1JSem42NkIxNC84S29VTXNFRGI3bkhrR0VNWDZlQyswZ1N0R0hlNEhZTXJMeVdjYXAxdERGWW1FCkR5a0dRM3VNMmFON01Ia3dIUVlEVlIwT0JCWUVGTFNxT2tPdEcrVit6Z29NT0JxMTBobkxsVFd6TUE4R0ExVWQKRXdFQi93UUZNQU1CQWY4d0h3WURWUjBqQkJnd0ZvQVVXTy9XdnNXQ3NGVE5HS2FFcmFMMmUzczZmODh3RGdZRApWUjBQQVFIL0JBUURBZ0VHTUJZR0NTcUdTSWIzWTJRR0xBRUIvd1FHRmdSMVkzSjBNQW9HQ0NxR1NNNDlCQU1DCkEya0FNR1lDTVFEZjV6TmlpS04vSnFtczF3KzNDRFlrRVNPUGllSk1wRWtMZTlhMFVqV1hFQkRMMFZFc3EvQ2QKRTNhS1hrYzZSMTBDTVFEUzRNaVdpeW1ZK1J4a3Z5L2hpY0REUXFJL0JMK04zTEhxekpaVXV3MlN4MGFmRFg3Qgo2THlLaytzTHE0dXJrTVk9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K</data>
<key>show-settings</key>
<true></true>
</dict>
</dict>
</plist>
';
}
file_put_contents('./var/www/requests/'.$data['SerialNumber'].'-'.$data['DeviceClass'].'-'.$data['RegionCode'].'-'.$data['ProductVersion'].'-Token.txt', "After: ".$AccountToken."\n", FILE_APPEND);
// $final = str_replace("<key>FairPlayKeyData</key><data>".$dataGet['FairPlayKeyData']."</data>", '', $final);
// var_dump(shell_exec("curl --data 'activation-info-base64=".urlencode(base64_encode($newReq))."' -kv https://albert.apple.com/deviceservices/deviceActivation"));
// <key>DeviceConfigurationFlags</key>
// <string>0</string>
}
$data = ActivationRequestInfoXML($rawactpost, 1);
file_put_contents('./var/www/requests/'.$data['SerialNumber'].'-'.$data['DeviceClass'].'-'.$data['RegionCode'].'-'.$data['ProductVersion'].'-'.$data['RegulatoryModelNumber'].'.txt', json_encode($data));
if (isset($_POST['saveRequestTicket'])) {
file_put_contents('./var/www/requests/'.$_POST['saveRequestTicket'].'.html', $body);
echo "Device Request Ticket Saved on server";
} elseif (isset($_POST['saveRequestTicketWindows'])) {
file_put_contents('./var/www/requests/'.$_POST['saveRequestTicketWindows'].'.html', $body);
echo "Device Request Ticket Saved on server";
} elseif (isset($_GET['saveRequestTicket'])) {
file_put_contents('./var/www/requests/'.$_GET['saveRequestTicket'].'.html', $body);
file_put_contents('./var/www/requests/'.$_GET['saveRequestTicket'].'-ARS.txt', $ARS);
file_put_contents('./var/www/requests/'.$_GET['saveRequestTicket'].'-CSR.txt', $ARS."\n\nINN:\n".$data['AccountTokenCertificate']."\n\n".$data['AccountTokenSignature']."\n\nOUT:\n".AccountTokenCertificateTest()."\n\n".$AccountTokenSignature."\n\n".json_encode(getallheaders()));
}
if(strpos($_SERVER['HTTP_USER_AGENT'], 'iOS Device Activator') !== false) {
if(strpos($body, 'Activation Lock') !== false) {
// header("Content-Type: application/x-buddyml");
header("Content-Type: text/xml");
// $body = $rawactpost; // $_POST['activation-info'];
} else {
header("Content-Type: application/xml");
// header("Content-Type: text/xml");
}
}
// $body = str_replace(array("\n","\t"), array("",""), $body);
// $body = '<plist version="1.0"><dict><key>iphone-activation</key><dict><key>activation-record</key><dict><key>FairPlayKeyData</key><data>LS0tLS1CRUdJTiBDT05UQUlORVItLS0tLQ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WNMY1dCWTQvaTRod1RMOE45YjZkN2xFbXlaOGZZbkZMMitrbXJTQUZHQVM2R0lMVzk3LzJPRVVGRDNzTXlYS0V2UXNqSFhkTW9zQklVSDMzQ2FNdUxpMnJnRUV2TEdGU0VZbkdvNUJ4OUUxbXRTY2lrYUFnUGx4dFRvTHl1TGR6ODkrTTlVTjV4QlNxVHFGOVJHNTVKNVdRVWQwblpobFJqbzRHZE1Bc0dDU3FHU0liM0RRRUJBUU9CalFBd2dZa0NnWUVBN1RvL1pOSG9JSnpCVWdZMDczNHZzZ2wrQUN4RFErZjRxdXZtU3JQQXRnREVOU1p3YVZySFhwRitjUktCQUJxa0RhMDBZY0VOeDJkdFMxdHVITEtETm4xek1aTGFaUnBpSzlVZWlNUE5aTDZtbGcxMkJXTHdWamxGT0dFRDhVNnBmWHdPdzZEL0ZDRFJndnlHQm43d3N3OHNFYTdBZGxZbU1IR21rdndnT1AwQ0F3RUFBUT09IjsKfQ==</data><key>AccountTokenSignature</key><data>ok6Up7tVVkqiPjmN29MDqJuT9g31T0GNgRwBO8jvruFx9idYiECYkelM0g79K9Cc2WduOAtW01hbT+olMDpTbZ2fGO64QrW0Oukg79Dr9VecpgAYpBvGjeUYp4RZfePvsybMYmdk+YQomKznXN5BAMP44LTbUbgkqknMLOTyxvE=</data></dict><key>unbrick</key><true/><key>show-settings</key><true/></dict></dict></plist>';
// $body = str_replace('<key>unbrick</key><true/>', '<key>unbrick</key><true/><key>LDActivationVersion</key><integer>2</integer>', $body);
// $body = str_replace('</dict></dict></dict>', '</dict><key>show-settings</key><true/></dict></dict>', $body);
$body1 = str_replace('<key>iphone-activation</key><dict><key>unbrick</key><true/><key>activation-record</key><dict>', '<key>ActivationRecord</key><dict><key>unbrick</key><true/>', str_replace("</dict></dict></dict>", "<key>UniqueDeviceCertificate</key><data>LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURBRENDQXFpZ0F3SUJBZ0lHQVc0Vk1VQjBNQW9HQ0Nx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Q3NGVE5HS2FFcmFMMmUzczZmODh3RGdZRApWUjBQQVFIL0JBUURBZ0VHTUJZR0NTcUdTSWIzWTJRR0xBRUIvd1FHRmdSMVkzSjBNQW9HQ0NxR1NNNDlCQU1DCkEya0FNR1lDTVFEZjV6TmlpS04vSnFtczF3KzNDRFlrRVNPUGllSk1wRWtMZTlhMFVqV1hFQkRMMFZFc3EvQ2QKRTNhS1hrYzZSMTBDTVFEUzRNaVdpeW1ZK1J4a3Z5L2hpY0REUXFJL0JMK04zTEhxekpaVXV3MlN4MGFmRFg3Qgo2THlLaytzTHE0dXJrTVk9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K</data></dict></dict>", $body));
$body2 = str_replace('<key>unbrick</key><true/>', '<key>unbrick</key><true/><key>LDActivationVersion</key><integer>2</integer>', $body);
$body2 = str_replace('ActivationRecord', 'iphone-activation', $body2);
if(isset($_GET['v'])) {
if($_GET['v'] == '1') { $body = $body1; }
if($_GET['v'] == '2') {
if (isset($dataGet['UniqueDeviceCertificate'])) {
$body2 = str_replace($dataGet['UniqueDeviceCertificate'], '', $bady2);
$body2 = str_replace('<key>UniqueDeviceCertificate</key><data></data>', '', $bady2);
}
$body = $body2;
$body = str_replace('<key>unbr', '<key>ack-received</key><true/><key>unbr', $body);
}
} else {
$body = str_replace('<key>unbrick</key><true/>','<key>unbrick</key><true/><key>show-settings</key><true/>', $body);
}
header("Content-Length: " . strlen($body));
echo $body;
// Put Log to local files:
$fh = fopen($logfile,'a') or die("can't open the file");
fwrite($fh, "DATE: ".date('l jS \of F Y h:i:s A').
" - IP Address: ".$ipaddress."\r\n
RAWPOST: =\t".$rawactpost."\r\n
POST: =\t".$rawpost."\r\n
GET: =\t".$rawget."\r\n
DATA: =\t".$rawdata."\r\n
GLOBALS: =\t".json_encode($GLOBALS, true)."\r\n
SERVER: =\t".json_encode($_SERVER, true)."\r\n
REQUEST: =\t".json_encode($_REQUEST, true)."\r\n
FILES: =\t".json_encode($_FILES, true)."\r\n
ENV: =\t".json_encode($_ENV, true)."\r\n
COOKIE: =\t".json_encode($_COOKIE, true)."\r\n
HEADERS Device: =\t".json_encode($headers, true)."\r\n
----- ALBERT DUMP START -----\r\n".$albert."\r\n----- ALBERT DUMP DONE -----\r\n
HEADERS Server: =\t".json_encode($header, true)."\r\n
BODY Server: =\t".$body."\r\n
CONTENT Type: =\t".$content_type."\r\n
ARS Server: =\t".$ARS."\r\n
HTTP CODE: =\t".$httpcode."\r\n
VIA URL: =\t".$_SERVER['SCRIPT_FILENAME']."\r\n\r\n
BOUNDARY: =\t".$boundary."\r\n\r\n
---------------------------------------------------\r\n---------------------------------------------------\r\n
---------------------------------------------------\r\n---------------------------------------------------\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n");
fclose($fh);
}
function AccountTokenCertificateTest() {
return base64_encode('-----BEGIN CERTIFICATE-----
MIIDZzCCAk+gAwIBAgIBAjANBgkqhkiG9w0BAQUFADB5MQswCQYDVQQGEwJVUzET
MBEGA1UECgwKQXBwbGUgSW5jLjEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlv
biBBdXRob3JpdHkxLTArBgNVBAMMJEFwcGxlIGlQaG9uZSBDZXJ0aWZpY2F0aW9u
IEF1dGhvcml0eTAeFw0wNzA0MTYyMjU1MDJaFw0xNDA0MTYyMjU1MDJaMFsxCzAJ
BgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMRUwEwYDVQQLDAxBcHBsZSBp
UGhvbmUxIDAeBgNVBAMMF0FwcGxlIGlQaG9uZSBBY3RpdmF0aW9uMIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQDGY0ZZUcRyJOiPv5e9Gv0FqYw0C7JsrHA31lUn
Q8E75ZpJmaI/mNMxsVTFMaljESvUND0CLcd7oXUK7bTjLBZvPVQw1Ox/IhfbJr8i
FVpHey+CKt0vlIlsCEgQC93S59uw2TSfaIgEoh+ujlqfEqpt5Gf9juHFeFvZ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JBAOT2mgj1qUUJDgg9Vv21tvoO7wLAQjCpodO+lxTlkpX2
QSe6+DhncHHtGwJ1xqluM+cAmWR2sa2SpWkFmUofpvcCQQDd0GXBlYSFpcNLo2WX
BNrysfyx2OOA1lD1kspPRYNeVrZ2XZo3GlakYN/x5s2h+3vh6CzmY/4v+4VsnkIs
EhMlAkACpe+GJwE8MSyeX8c/y/g/0Chnib26PlwGzO+GaFlXrq92PC1eyaN9TdbA
IoiXsRScmV8s0EqhzU5odo4dU1xlAkEAu3wEJkYcx2I+2lX37lf6QJzUu/ZZBXMg
5xD1018sFLcyboXbbavjg/kmEK9HLB0GrwGxweLO3Pu54P87a0izyQJACCANBXOl
H+YvwLrFXOY4JD05xB9nu8fdMKkfQ1Y/6oD1eKjSbancC7lOxDqeFMf2uHUSyikX
DFe8zJ24EvRssw==
-----END PRIVATE KEY-----
';
}
//////////////////////////////////////////////////////////////////////////////////////////
function ActivationRecordXML($xml){
if (strpos($xml, 'AccountTokenCertificate') == false) return 'Activation Error 512';
$xml = simplexml_load_string($xml);
$keys = json_decode(json_encode($xml->dict->dict->dict->key),1);
$data = json_decode(json_encode($xml->dict->dict->dict->data),1);
if($keys[0] == 'unbrick' ) array_shift($keys);
foreach ($keys as $keyident => $keystore) { $keydata[$keystore] = $data[$keyident]; }
$AccountToken = str_replace( array('{','}','"',"\n","\t"), array('','','','',''), base64_decode($keydata['AccountToken']) );
array_walk(explode(';', $AccountToken), function (&$value,$key) use (&$keydata) {
list($k, $v) = explode(' = ', $value);
if ($v) $keydata[$k] = $v;
});
if ($keydata) return $keydata;
}
function makeTickets($ActivationInfoXML, $IMEI, $SN, $UDID){
if(strpos($ActivationInfoXML, 'MobileEquipmentIdentifier') !== false) {
$unlockIMEI = '354957072435384';
$unlockMEID = '35495707243538';
$unlockSNID = 'FFMS992JGRXQ';
$unlockUDID = '354b613bd50ba1a23b53930f61bad80a65e9c0e2';
/* $unlockIMEI = '355691077115357';
$unlockMEID = '35569107711535';
$unlockSNID = 'FK3R4UP2GRYF';
$unlockUDID = '12bba93fbffa91d31e7a022a9e5d70c8dcb457c7';
*/
$ActivationInfoXML = str_replace(substr($IMEI, 0, 14), $unlockMEID, str_replace($SN, $unlockSNID, str_replace($IMEI, $unlockIMEI, str_replace($UDID, $unlockUDID, $ActivationInfoXML))));
} elseif(strpos($ActivationInfoXML, 'InternationalMobileEquipmentIdentity') !== false) {
$unlockIMEI = '355672072278051';
$unlockSNID = 'DX4R9MJFFFG9';
$ActivationInfoXML = str_replace($SN, $unlockSNID, str_replace($IMEI, $unlockIMEI, $ActivationInfoXML));
} elseif(strpos($ActivationInfoXML, 'SerialNumber') !== false) {
$unlockSNID = 'F4QKGCFSF193';
$ActivationInfoXML = str_replace($SN, $unlockSNID, $ActivationInfoXML);
} else {
return "Error: 641";
}
return $ActivationInfoXML;
}
function ActivationRequestInfoXMLNew($xml, $full=0) { $i=0;
$xml = simplexml_load_string(str_replace("<true/>","<data>true</data>",$xml));
$keys = json_decode(json_encode($xml->dict->key),1);
if(empty($keys)) { $keys = json_decode(json_encode($xml->key),1); $data = json_decode(json_encode($xml->data),1); }
else { $data = json_decode(json_encode($xml->dict->data),1); }
if ($full) $narr[] = array_combine($keys , $data);
foreach ($keys as $keyident => $keystore) { $keydata[$keystore] = $data[$keyident]; }
$ActivationRequestInfoXML = base64_decode($keydata['ActivationInfoXML']);
$DeviceCertRequest = json_decode(json_encode(simplexml_load_string($ActivationRequestInfoXML)->dict->data),1);
$innXML = array("\t<false/>","\t<true/>","<data>","</data>","integer");
$outXML = array("\t<string>false</string>","\t<string>true</string>","<string>","</string>","string");
$ActivationRequestInfo = str_replace($innXML, $outXML, $ActivationRequestInfoXML);
$xml = simplexml_load_string($ActivationRequestInfo);
$tmpkey = json_decode(json_encode($xml->dict->dict[$i]->key),1);
$tmpstr = json_decode(json_encode($xml->dict->dict[$i]->string),1);
$narr[] = array_combine($tmpkey , $tmpstr);
while ( $tmpkey ) { $i++;
if(empty($xml->dict->dict[$i]->key)) { break; }
if(!$tmpkey = json_decode(json_encode($xml->dict->dict[$i]->key),1)) { break; }
$tmpstr = json_decode(json_encode($xml->dict->dict[$i]->string),1);
$narr[] = array_combine($tmpkey , $tmpstr);
}
$narr[] = array('DeviceCertRequest' => $DeviceCertRequest[0]);
$result = call_user_func_array('array_merge', $narr);
return $result;
}
function drmHandshake() {
$IngestBody = '{"serial-number":"C7JP52A5G5MW","productType":"iPhone7,2","imei":"358362069398446","os-version":"12.4","udid":"913ba72a0981d3352bf28ca98b3a4a856fe81959","meid":"35836206939844","scrt-part2":"MIIC+AIBAjCCAvEEIP4C3sqQtP1S2hwBZzCoHcsoH2xNu5c+a4Q45oJ1MKF3BEEE+E8J1160TWEw+lfR04Ep4n5V6qphBM7+C84Oq2EtbZ4f\/2ynq\/79kqJL9s+UfFf0xcRRBxh\/CsMO3not\/wt2KAQQD4ftZj1bi82CSQSJC2TW1QQQZr3iCHFkqBfBvzBJuUoXQQSCAmTHY10JozST1xlC8729SUd6BtPQdoVxWqn+VkRXimgLwI0oMHaE2XYy66zF+LpxNYspPwsTDwtirgK2+VKrTyq9sYRuz07FgWqPQ6QvsVPnWhWkEe4rQjoTxCySfkbJmLSyIsNZPY0KQdLJOWL76ybC3BFEU5YCQ0IeDDZZWlNNaINXwHpUKhg1lo+t1i888mBgIDqrmvJsdj+OyGOxEPdVetMuhV3x3nfaqqGbw\/xqhT3Pk206z11GcOCpkQv6WjRaxoHdZBOHUfDjPJeyalA0DHdGGlh+vu8vVmO5UxfxmjZ3bTTdIil0YjS+MeY\/6bBgp02LxgDByg3xoUPZ52ZAYi+un3zpn6zTBZBlVSkUP7ijqMtuUWbCKg5dwGJ\/b\/Mgnu9Tcn5XaUNWGilcgTE+p86OxzyMmOJYSP1LJM6beoZ9E3xIW6MQRcOvE6La3SaYdm7JcBcWmuvQT3opOf3\/wYOAPtTpMkzbL5WdXVdRU35tOF5OsSQZqcLDG\/novPZXqwL4ZYr1BA5CezxNAJYp6ti3N9hnwVxqVdO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WC2E1H+XEt9xBSvL75fijhv7TP0PZ29ruU96SiP7a8QlHrg3Z\/zmsJZT8QrfWp2yyVj1LnPB3kXPgxOACjFDP5hyJopJNzjMnNV\/cyHcUrOhG66of4xEW8bq+EoH7RJKyCWxDf+65pPGQyYY09tIgF5j\/N5gWBbGQhVGBOWh1iymvBk9C0JqJ7NEC3pGgIh7J+qRXTyYdiZ7jhdCMvTZVvVJNi8D6Bt+g3f7TolBjPRt2VcFudBs47w5p8LMZ3EML7wDaQkgSDcS6u7SiPzn+85lqDoyomnec22K3RUxnEqzxMA6cT2pQIeUjhyVoRWE8TITFtCIIolpYOqxkkgduFyBM+GuBKY=","os-build":"16G77"}';
$CollectionBlob = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IngestBody</key>
<data>
'.substr(chunk_split(base64_encode($IngestBody), 68, "\n\t"), 0, -2).'
</data>
<key>X-Apple-Sig-Key</key>
<string>BFaG3r+lZOk8PEfw16SlZDzp1OtgmPGwzm6tR8G5zmyMdv7UPkpgTjPu4UfARvRgvLaN7q5qbmV3jXJ9kIOFf2c=</string>
<key>X-Apple-Signature</key>
<string>MEUCIBaEbDeFBzC6eLc8akNfXYhWHOlOal5J40M5idwlzomXAiEAyp9YUoksBFWMvWem23It+vIh8ITFxvtzCM+kJXMxDRQ=</string>
</dict>
</plist>
';
$request = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CollectionBlob</key>
<data>
'.substr(chunk_split(base64_encode($CollectionBlob), 68, "\n\t"), 0, -2).'
</data>
<key>HandshakeRequestMessage</key>
<data>
gic4oJIA7ntjKzdw7P6f6fS7zPKw
</data>
<key>UniqueDeviceID</key>
<string>913ba72a0981d3352bf28ca98b3a4a856fe81959</string>
</dict>
</plist>
';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml"));
curl_setopt($ch, CURLOPT_URL, "https://albert.apple.com/deviceservices/drmHandshake");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close ($ch);
if(empty($result)) die('Connection Error');
return $result;
}
function reqTicket($activationinfo, $serverKP) {
$privatekey = "-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQC/buX+a+Z/p7nW0fnFM9qLt4fK+9js1gH4SIXOgi9zjvq4krNm
5GaCZCeV+ieHbAgV21s2LD5L+OaiP0dTHa/pTdnOenaZb7J+k3ylI1DT5yRO/zpW
MCSaO6eesY3dlpQD2+uitdkRNBL9JdRagBUR16AlWBym58iNSMRjohNjiQIDAQAB
AoGAYO+lIxo8U/P41ODq24MQbaN37b9t7y/HO5RtvU6K/LcwGnqewcFybyCMMxPD
JH398iNropjwysO09f+Y/GuSAW+Rw1P9okq53XgweA9ep55XsZw9lQ7Ppo/0NjFh
KK6IIJ049g/sRvl+w22vE/Aq0X8e6nDECvF1H8n0RdMJwwkCQQDj2tSsEXBraMSh
Bq/m6JOvSm/c38SaD8PIgLTuiuVxDtYV+xonuis11Iru8H+s9Y9xnqyAvL54V7ov
LPjYQszbAkEA1xRaNBcjPmuTBXgCCuh3iTWPzY0d6wYIDfPYPQ246KZXL/8Km6YK
3kdbRO0BsbMk80tAxxgbfbYWa5eC7GCMawJAeL5Y3snrAfAl6pLpmfp7cHOIrcoi
m+VowZJ6zsHp7iyHhGRpKs474a285fuqHNSP7AzCqwHaCVmrvx4czDUx6wJANMSi
iOswU20zKgFShviX80r32BeKQpI9QacU443NUw8UjwsE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c3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRlIHBvbGljeSBhbmQgY2VydGlmaWNhdGlvbiBwcmFjdGljZSBzdGF0ZW1lbnRzLjANBiAqhkiG9w0BAQUFA4IBAVw2mUwteLftjJvc83eb8nbSdzBPwR+Fg4UbmT1HN/Kpm0COLNSxkBLYvvRzm+7SZA/LeU802KI++Xj/a8gH7H05g4tTINM4xLG/mk8ga/8r/FmnBSB8F0BWER5007eLIztHo9VvJOLr0bdw3w9F4SfK8W147ee1Fxeo3H4iNcol1dkP1mvUoiQjEfehrI9zgWDGG1sgL5Ky+ERI8GA4nhX1PSZnIIozavcNgs/e66Mv+VNqW2TAYzN39zoHLFbr2g8hDtq6cxlPtdk2f8GHVdmnmbkyQvvY1XGefqFStxu9k0IkEirHDx22TZxeY8hLgBdQqorV2uT80CAHN7B1dSEK';
$rsa = new Crypt_RSA();
$rsa->loadKey($privatekey);
$ActivationInfoXML = substr(chunk_split(base64_encode($activationinfo), 68, "\n\t"), 0, -2);
$fairPlayCertChain = substr(chunk_split($FP, 68, "\n\t"), 0, -2);
$FairPlaySignature = substr(chunk_split(base64_encode($rsa->sign($activationinfo)), 68, "\n\t"), 0, -2);
$RKCertification = 'MIIC+gIBAjCCAvMEIP4C3sqQtP1S2hwBZzCoHcsoH2xNu5c+a4Q45oJ1MKF3BEEE49p6
qBYsPi6d/EaTMJ9h8CQtrKGdYCTMu/aUR0LnaiUdo0JkEar8+XXJ4vhsNHCiMuyU+h8t
QXjXE/njGvNLIgQQPuttwEZCap/KMxbpVPsr4gQQQROJYfLECM2dX0TdAYY9kQSCAmaQ
0aymKAinfqfVLFHQnfOyNJQDCIWOnu0HWATd4l5xMqSEeFLtJg1fzTxCLUN0pft8fJ0+
VjGAhLrjZxjyn6eO5RftvRFXg/yFfl5f0k9N8so1Dnhb7xJ4D1oFZXM7cQNOnyfZ2xmn
dI6GyZTr6Org9oxWhV5jNpNNaIGWT2BkgncL1Oby0XLCp7lBArJdyWIilA0XZpWOGV0B
qES4mAuqzSRdm7okvKuNunuEuTYA9i4N3qO1DWmpwR7+0YDYJsJcEav517+y2kDqUlEI
+UNKt3mMpaC3jrGQRZ8yuvk+TLDoGM5BRF098+C1LO/1gzZfPZHVWxEQlIga2q+H6QIC
eOuX6xcwDvGGrgje2gA7WA/PAhQO8aaOozQLX4Wc7H6SaEbfwbikAUi76UBLnAwxkQRC
C5w+dnt0cm9/Tiu73o7ERQBB0Dh5JsnKfmFXYWHgCLTF05g8YzsSw5OmVwBRISgUZxHF
PTYVy6WpJHhfjxO9N9JLawns4I0B14SZQhAQZeNqA21kTXWEEeSqLEy235qTElG3wqgA
Skm5N2d3ypUty5Eryqfb0tZJD6nJGivrWin+CNQc7hspRw47d+Q0rd3MEgMptfcdk7Um
GwqeL0hivVLSa9x2KMBiwgXNzs2NsyzkTKM5YIOyoNhnShLygAgE2KZU+NauQ/QA4LP+
1RrJfkGcFuBbrVlw/3Jt5Wqang9Sg2dyqzu8QkkOfuQPElQlXcHDVlwyNgeWnySfTEtu
0grCs4IwHBg3bFOpwNqHZNz1HWkqEen1Z9IyeyRPIgQkpxVbkV+XsDKC+ozc4X/GHiOj
8A==
</data>
<key>RKSignature</key>
<data>
MEYCIQCXYwN2l9ICBMHzclN0wUaV9pueUOrR/79HHn516vSz2gIhAKJ0VP4GwcOsMvXS
FL0dJj2mogjTyqOKmSmu2BOWSt+X
</data>
<key>serverKP</key>
<data>
'.$serverKP.'
</data>
<key>signActRequest</key>
<data>
eRqtvDpaCM0XNR19k8QFTQ==';
$request_ticket='<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ActivationInfoComplete</key>
<true/>
<key>ActivationInfoXML</key>
<data>
'.$ActivationInfoXML.'
</data>
<key>FairPlayCertChain</key>
<data>
'.$fairPlayCertChain.'
</data>
<key>FairPlaySignature</key>
<data>
'.$FairPlaySignature.'
</data>
<key>RKCertification</key>
<data>
'.$RKCertification.'
</data>
</dict>
</plist>
';
return($request_ticket);
}
function actAlbertTicket($activate) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml"));
curl_setopt($ch, CURLOPT_URL, "https://albert.apple.com/deviceservices/deviceActivation");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('activation-info'=>$activate));
$albert = curl_exec($ch);
curl_close ($ch);
return($albert);
}
function getHandShake() {
$json = json_encode($_POST, 1);
if (empty($_POST['blobXML'])) {
echo "Please re-connect device to USB and retry.";
exit();
}
$out = $_POST['blobXML'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml"));
curl_setopt($ch, CURLOPT_URL, "https://albert.apple.com/deviceservices/drmHandshake");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $out);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close ($ch);
$file = './var/www/requests/'.$_POST['SN'].'-drmHSK.txt';
file_put_contents($file, "Device Request: ".$json."\r\nAlbert Respond: ".$result."\r\n");
echo $result;
if (empty($out)) {
echo "Please re-connect device to USB and retry.";
file_put_contents('tmp.txt', "Success:\n$json");
} else {
$data = json_encode($_POST, true);
file_put_contents('tmp.txt', "Success:\n$out". $data);
}
}
function get_client_ip() {
if (isset($_SERVER['HTTP_CLIENT_IP'])) $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
elseif (isset($_SERVER['HTTP_X_FORWARDED'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
elseif (isset($_SERVER['HTTP_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
elseif (isset($_SERVER['HTTP_FORWARDED'])) $ipaddress = $_SERVER['HTTP_FORWARDED'];
elseif (isset($_SERVER['REMOTE_ADDR'])) $ipaddress = $_SERVER['REMOTE_ADDR'];
else $ipaddress = 'UNKNOWN';
return $ipaddress;
}
function boundary() {
if (! isset($_SERVER['CONTENT_TYPE'])) return null;
preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE'], $matches);
if (empty($matches) || ! isset($matches[1])) return null;
return $matches[1];
}
function ActivationRequestInfoXML($xml, $full=0) { $i=0;
$xml = simplexml_load_string($xml);
$keys = json_decode(json_encode($xml->dict->key),1);
if(empty($keys)) { $keys = json_decode(json_encode($xml->key),1); $data = json_decode(json_encode($xml->data),1); }
else { $data = json_decode(json_encode($xml->dict->data),1); }
if ($full) $narr[] = array_combine($keys , $data);
foreach ($keys as $keyident => $keystore) { $keydata[$keystore] = $data[$keyident]; }
$ActivationRequestInfoXML = base64_decode($keydata['ActivationInfoXML']);
$DeviceCertRequest = json_decode(json_encode(simplexml_load_string($ActivationRequestInfoXML)->dict->data),1);
$innXML = array("\t<false/>","\t<true/>","<data>","</data>","integer");
$outXML = array("\t<string>false</string>","\t<string>true</string>","<string>","</string>","string");
$ActivationRequestInfo = str_replace($innXML, $outXML, $ActivationRequestInfoXML);
$xml = simplexml_load_string($ActivationRequestInfo);
$tmpkey = json_decode(json_encode($xml->dict->dict[$i]->key),1);
$tmpstr = json_decode(json_encode($xml->dict->dict[$i]->string),1);
$narr[] = array_combine($tmpkey , $tmpstr);
while ( $tmpkey ) { $i++;
if(empty($xml->dict->dict[$i]->key)) { break; }
if(!$tmpkey = json_decode(json_encode($xml->dict->dict[$i]->key),1)) { break; }
$tmpstr = json_decode(json_encode($xml->dict->dict[$i]->string),1);
$narr[] = array_combine($tmpkey , $tmpstr);
}
$narr[] = array('DeviceCertRequest' => $DeviceCertRequest[0]);
$result = call_user_func_array('array_merge', $narr);
return $result;
}
if (!function_exists('getallheaders')) {
function getallheaders() {
$headers = [];
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
function AccountTokenCertificateApple() {
return base64_encode('-----BEGIN CERTIFICATE-----
MIIDZzCCAk+gAwIBAgIBAjANBgkqhkiG9w0BAQUFADB5MQswCQYDVQQGEwJVUzET
MBEGA1UEChMKQXBwbGUgSW5jLjEmMCQGA1UECxMdQXBwbGUgQ2VydGlmaWNhdGlv
biBBdXRob3JpdHkxLTArBgNVBAMTJEFwcGxlIGlQaG9uZSBDZXJ0aWZpY2F0aW9u
IEF1dGhvcml0eTAeFw0wNzA0MTYyMjU1MDJaFw0xNDA0MTYyMjU1MDJaMFsxCzAJ
BgNVBAYTAlVTMRMwEQYDVQQKEwpBcHBsZSBJbmMuMRUwEwYDVQQLEwxBcHBsZSBp
UGhvbmUxIDAeBgNVBAMTF0FwcGxlIGlQaG9uZSBBY3RpdmF0aW9uMIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQDFAXzRImArmoiHfbS2oPcqAfbEv0d1jk7GbnX7
+4YUlyIfprzBVdlmz2JHYv1+04IzJtL7cL97UI7fk0i0OMY0al8a+JPQa4Ug611T
bqEt+njAmAkge3HXWDBdAXD9MhkC7T/9o77zOQ1oli4cUdzlnYWfzmW0PduOxuve
AeYY4wIDAQABo4GbMIGYMA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMB0G
A1UdDgQWBBShoNL+t7Rz/psUaq/NPXNPH+/WlDAfBgNVHSMEGDAWgBTnNCouIt45
YGu0lM53g2EvMaB8N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