File size: 40,284 Bytes
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
 
 
 
 
 
 
2584ce1
 
 
 
 
 
 
 
0a10e1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2584ce1
 
 
 
 
0a10e1f
2584ce1
0a10e1f
 
 
 
2584ce1
 
0a10e1f
2584ce1
 
 
0a10e1f
2584ce1
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
 
 
 
 
 
 
 
2584ce1
0a10e1f
 
 
2584ce1
0a10e1f
 
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
 
 
 
 
 
 
 
 
2584ce1
 
 
 
 
0a10e1f
 
 
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
2584ce1
 
0a10e1f
2584ce1
0a10e1f
 
2584ce1
0a10e1f
 
 
 
 
 
 
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
 
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
2584ce1
 
 
 
 
0a10e1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2584ce1
0a10e1f
2584ce1
 
 
0a10e1f
2584ce1
0a10e1f
 
 
 
 
2584ce1
0a10e1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
 
 
 
 
 
 
 
 
2584ce1
0a10e1f
 
 
 
 
 
 
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a10e1f
 
 
2584ce1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Phone Diagnostic Tool</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }
        .animate-pulse {
            animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
        }
        .progress-bar {
            transition: width 0.5s ease-in-out;
        }
        .tooltip {
            position: relative;
            display: inline-block;
        }
        .tooltip .tooltiptext {
            visibility: hidden;
            width: 200px;
            background-color: #333;
            color: #fff;
            text-align: center;
            border-radius: 6px;
            padding: 5px;
            position: absolute;
            z-index: 1;
            bottom: 125%;
            left: 50%;
            transform: translateX(-50%);
            opacity: 0;
            transition: opacity 0.3s;
        }
        .tooltip:hover .tooltiptext {
            visibility: visible;
            opacity: 1;
        }
    </style>
</head>
<body class="bg-gray-100 min-h-screen">
    <div class="container mx-auto p-4 max-w-md">
        <div class="bg-white rounded-xl shadow-lg overflow-hidden">
            <!-- Header -->
            <div class="bg-gradient-to-r from-blue-600 to-purple-600 p-6 text-white">
                <div class="flex justify-between items-center">
                    <div>
                        <h1 class="text-2xl font-bold">iOS Diagnostic Tool</h1>
                        <p class="text-sm opacity-80">Detect and repair iOS device issues</p>
                    </div>
                    <div class="bg-white bg-opacity-20 p-3 rounded-full">
                        <i class="fas fa-mobile-alt text-2xl"></i>
                    </div>
                </div>
            </div>

            <!-- Connection Status -->
            <div class="p-6 border-b">
                <div class="flex items-center justify-between mb-4">
                    <h2 class="font-semibold text-gray-700">Device Connection</h2>
                    <span id="connectionStatus" class="px-3 py-1 rounded-full text-xs font-medium bg-gray-200 text-gray-800">Not Connected</span>
                </div>
                
                <!-- Database Connection -->
                <div class="flex items-center justify-between mb-4 mt-6">
                    <h2 class="font-semibold text-gray-700">Database Access</h2>
                    <span id="dbStatus" class="px-3 py-1 rounded-full text-xs font-medium bg-gray-200 text-gray-800">Disconnected</span>
                </div>
                <div id="dbControls" class="hidden">
                    <div class="mb-3">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Information Access</label>
                        <select id="dataType" class="w-full p-2 border rounded-lg">
                            <option value="contacts">Contacts</option>
                            <option value="messages">Messages</option>
                            <option value="call_logs">Call Logs</option>
                            <option value="media">Media Files</option>
                        </select>
                    </div>
                    <button id="fetchDataBtn" class="w-full bg-green-600 hover:bg-green-700 text-white py-2 rounded-lg text-sm font-medium transition">
                        Fetch Data
                    </button>
                </div>
                
                <div class="flex items-center space-x-4">
                    <div class="flex-1">
                        <div class="flex justify-between text-sm text-gray-600 mb-1">
                            <span>USB Connection</span>
                            <span id="usbStatus">Disconnected</span>
                        </div>
                        <div class="w-full bg-gray-200 rounded-full h-2">
                            <div id="usbProgress" class="progress-bar bg-blue-600 h-2 rounded-full" style="width: 0%"></div>
                        </div>
                    </div>
                    <button id="connectBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition">
                        Connect
                    </button>
                </div>
            </div>

            <!-- Device Info -->
            <div id="deviceInfoSection" class="p-6 border-b hidden">
                <h2 class="font-semibold text-gray-700 mb-4">Device Information</h2>
                <div class="space-y-3">
                    <div class="flex justify-between">
                        <span class="text-gray-600">Manufacturer</span>
                        <span id="manufacturer" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">Model</span>
                        <span id="model" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">Device Name</span>
                        <span id="deviceName" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">UDID</span>
                        <span id="udid" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">OS Version</span>
                        <span id="osVersion" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">Battery Health</span>
                        <span id="batteryHealth" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">Storage Capacity</span>
                        <span id="storageCapacity" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">Available Storage</span>
                        <span id="availableStorage" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">iCloud Status</span>
                        <span id="icloudStatus" class="font-medium">-</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-gray-600">Activation Lock</span>
                        <span id="activationLock" class="font-medium">-</span>
                    </div>
                </div>
            </div>

            <!-- Utilities Section -->
            <div class="p-6 border-b">
                <h2 class="font-semibold text-gray-700 mb-4">Utilities</h2>
                <div class="grid grid-cols-2 gap-3">
                    <button id="screenRecorderBtn" class="bg-purple-100 hover:bg-purple-200 text-purple-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/295/295128.png" class="w-8 h-8 mb-2" alt="Screen Recorder">
                        <span>Screen Recorder</span>
                    </button>
                    <button id="fileManagerBtn" class="bg-green-100 hover:bg-green-200 text-green-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/2965/2965300.png" class="w-8 h-8 mb-2" alt="File Manager">
                        <span>File Manager</span>
                    </button>
                    <button id="certManagerBtn" class="bg-yellow-100 hover:bg-yellow-200 text-yellow-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/1069/1069095.png" class="w-8 h-8 mb-2" alt="Certificate Manager">
                        <span>Cert Manager</span>
                    </button>
                    <button id="consoleBtn" class="bg-red-100 hover:bg-red-200 text-red-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/4392/4392529.png" class="w-8 h-8 mb-2" alt="Console">
                        <span>Device Console</span>
                    </button>
                </div>
            </div>

            <!-- Diagnostic Options -->
            <div class="p-6 border-b">
                <h2 class="font-semibold text-gray-700 mb-4">Diagnostic Services</h2>
                <div class="grid grid-cols-2 gap-3">
                    <button id="deviceInfoBtn" class="bg-blue-100 hover:bg-blue-200 text-blue-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/2933/2933245.png" class="w-8 h-8 mb-2" alt="Device Info">
                        <span>Device Info</span>
                    </button>
                    <button id="activationLockBtn" class="bg-red-100 hover:bg-red-200 text-red-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/295/295128.png" class="w-8 h-8 mb-2" alt="Activation Lock">
                        <span>iCloud Unlock</span>
                    </button>
                    <button id="jailbreakBtn" class="bg-indigo-100 hover:bg-indigo-200 text-indigo-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/1069/1069095.png" class="w-8 h-8 mb-2" alt="Jailbreak">
                        <span>Jailbreak</span>
                    </button>
                    <button id="quickScanBtn" class="bg-blue-100 hover:bg-blue-200 text-blue-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/4392/4392529.png" class="w-8 h-8 mb-2" alt="Quick Scan">
                        <span>Quick Scan</span>
                    </button>
                    <button id="fullScanBtn" class="bg-purple-100 hover:bg-purple-200 text-purple-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/4392/4392508.png" class="w-8 h-8 mb-2" alt="Full Diagnostic">
                        <span>Full Diagnostic</span>
                    </button>
                    <button id="batteryTestBtn" class="bg-green-100 hover:bg-green-200 text-green-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/2933/2933245.png" class="w-8 h-8 mb-2" alt="Battery">
                        <span>Battery Health</span>
                    </button>
                    <button id="screenTestBtn" class="bg-yellow-100 hover:bg-yellow-200 text-yellow-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/2933/2933245.png" class="w-8 h-8 mb-2" alt="Screen">
                        <span>Screen Test</span>
                    </button>
                    <button id="eraseBtn" class="bg-orange-100 hover:bg-orange-200 text-orange-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/3652/3652191.png" class="w-8 h-8 mb-2" alt="Erase">
                        <span>Erase iOS</span>
                    </button>
                    <button id="activationLockBtn" class="bg-red-100 hover:bg-red-200 text-red-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/295/295128.png" class="w-8 h-8 mb-2" alt="Activation Lock">
                        <span>Remove iCloud</span>
                    </button>
                    <button id="backupBtn" class="bg-cyan-100 hover:bg-cyan-200 text-cyan-800 p-3 rounded-lg flex flex-col items-center transition">
                        <img src="https://cdn-icons-png.flaticon.com/512/1055/1055683.png" class="w-8 h-8 mb-2" alt="Backup">
                        <span>Backup Data</span>
                    </button>
                </div>
            </div>

            <!-- Scan Results -->
            <div id="resultsSection" class="p-6 hidden">
                <h2 class="font-semibold text-gray-700 mb-4">Diagnostic Results</h2>
                <div id="resultsContainer" class="space-y-4">
                    <!-- Results will be inserted here -->
                </div>
            </div>

            <!-- Progress Section -->
            <div id="progressSection" class="p-6 hidden">
                <div class="flex justify-between mb-2">
                    <span id="progressText" class="font-medium text-blue-600">Scanning device...</span>
                    <span id="progressPercent" class="font-medium">0%</span>
                </div>
                <div class="w-full bg-gray-200 rounded-full h-3">
                    <div id="scanProgress" class="progress-bar bg-gradient-to-r from-blue-500 to-purple-500 h-3 rounded-full" style="width: 0%"></div>
                </div>
                <div id="currentTest" class="text-sm text-gray-600 mt-2">Initializing...</div>
            </div>

            <!-- Footer -->
            <div class="p-4 bg-gray-50 text-center text-xs text-gray-500">
                <p>For accurate results, ensure your iOS device is properly connected via USB and trusted on this computer.</p>
                <div class="mt-2 flex justify-center space-x-4">
                    <a href="#" class="hover:text-blue-600 tooltip">
                        <i class="fas fa-question-circle"></i>
                        <span class="tooltiptext">Enable USB debugging in Developer Options</span>
                    </a>
                    <a href="#" class="hover:text-blue-600 tooltip">
                        <i class="fas fa-cog"></i>
                        <span class="tooltiptext">Extension Settings</span>
                    </a>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // iOS API Endpoints
            const iOS_API = {
                deviceInfo: 'https://api.ios.device/info',
                diagnostics: 'https://api.ios.device/diagnostics',
                utilities: 'https://api.ios.device/utilities',
                backup: 'https://api.ios.device/backup',
                screen: 'https://api.ios.device/screen',
                files: 'https://api.ios.device/files'
            };

            // DOM Elements
            const connectBtn = document.getElementById('connectBtn');
            const connectionStatus = document.getElementById('connectionStatus');
            const usbStatus = document.getElementById('usbStatus');
            const usbProgress = document.getElementById('usbProgress');
            const dbStatus = document.getElementById('dbStatus');
            const dbControls = document.getElementById('dbControls');
            const fetchDataBtn = document.getElementById('fetchDataBtn');
            const dataType = document.getElementById('dataType');
            const deviceInfoSection = document.getElementById('deviceInfoSection');
            const resultsSection = document.getElementById('resultsSection');
            const progressSection = document.getElementById('progressSection');
            const resultsContainer = document.getElementById('resultsContainer');
            const scanProgress = document.getElementById('scanProgress');
            const progressPercent = document.getElementById('progressPercent');
            const currentTest = document.getElementById('currentTest');
            const quickScanBtn = document.getElementById('quickScanBtn');
            const fullScanBtn = document.getElementById('fullScanBtn');
            const batteryTestBtn = document.getElementById('batteryTestBtn');
            const hardwareTestBtn = document.getElementById('hardwareTestBtn');

            // Device data structure
            const deviceData = {
                connected: false,
                type: null,
                manufacturer: 'Apple',
                model: null,
                deviceName: null,
                udid: null,
                osVersion: null,
                batteryHealth: null,
                storageCapacity: null,
                availableStorage: null,
                icloudStatus: null,
                activationLock: null,
                jailbroken: false,
                passcodeEnabled: false,
                restrictionsEnabled: false
            };

            // Test options
            const testOptions = {
                factory: [
                    'Backing up data',
                    'Wiping user data',
                    'Resetting system settings',
                    'Formatting storage',
                    'Restoring factory image',
                    'Verifying reset'
                ],
                activation: [
                    'Checking iCloud status',
                    'Bypassing activation lock',
                    'Removing iCloud account',
                    'Clearing device data',
                    'Resetting network settings',
                    'Verifying removal',
                    'Finalizing unlock'
                ],
                jailbreak: [
                    'Checking iOS version',
                    'Downloading jailbreak tools',
                    'Exploiting vulnerabilities',
                    'Installing Cydia',
                    'Finalizing jailbreak'
                ],
                quick: [
                    'Battery Check',
                    'Storage Analysis',
                    'System Integrity'
                ],
                full: [
                    'Battery Health',
                    'Storage Analysis',
                    'System Integrity',
                    'Display Check',
                    'Touchscreen Test',
                    'Camera Test',
                    'Speaker Test',
                    'Microphone Test',
                    'Vibration Test',
                    'Network Check',
                    'Sensor Test'
                ],
                battery: [
                    'Battery Health',
                    'Charge Cycles',
                    'Temperature Check',
                    'Voltage Analysis'
                ],
                hardware: [
                    'Display Check',
                    'Touchscreen Test',
                    'Camera Test',
                    'Speaker Test',
                    'Microphone Test',
                    'Vibration Test',
                    'Sensor Test'
                ]
            };

            // Connect button click handler
            connectBtn.addEventListener('click', function() {
                if (mockDeviceData.connected) {
                    disconnectDevice();
                } else {
                    connectDevice();
                }
            });

            // Button handlers
            quickScanBtn.addEventListener('click', () => runDiagnostic('quick'));
            fullScanBtn.addEventListener('click', () => runDiagnostic('full'));
            batteryTestBtn.addEventListener('click', () => runDiagnostic('battery'));
            hardwareTestBtn.addEventListener('click', () => runDiagnostic('hardware'));
            factoryResetBtn.addEventListener('click', () => runDiagnostic('factory'));
            deviceInfoBtn.addEventListener('click', () => {
                if (!deviceData.connected) {
                    alert('Please connect a device first');
                    return;
                }
                deviceInfoSection.classList.remove('hidden');
            });
            
            activationLockBtn.addEventListener('click', () => {
                if (!deviceData.connected) {
                    alert('Please connect a device first');
                    return;
                }
                if (confirm('WARNING: Removing activation lock without the original Apple ID may violate Apple\'s Terms of Service and could render the device unusable. Proceed at your own risk.')) {
                    runDiagnostic('activation');
                }
            });
            
            jailbreakBtn.addEventListener('click', () => {
                if (!deviceData.connected) {
                    alert('Please connect a device first');
                    return;
                }
                if (confirm('WARNING: Jailbreaking may void warranty and cause system instability. Continue?')) {
                    runDiagnostic('jailbreak');
                }
            });
            
            // Utility button handlers
            screenRecorderBtn.addEventListener('click', () => {
                if (!deviceData.connected) {
                    alert('Please connect a device first');
                    return;
                }
                alert('Screen recording started (simulated)');
            });
            
            fileManagerBtn.addEventListener('click', () => {
                if (!deviceData.connected) {
                    alert('Please connect a device first');
                    return;
                }
                alert('File manager opened (simulated)');
            });
            
            // Database fetch handler
            fetchDataBtn.addEventListener('click', function() {
                if (dbStatus.textContent !== 'Connected') {
                    alert('Database not connected');
                    return;
                }
                
                const type = dataType.value;
                fetchDataBtn.disabled = true;
                fetchDataBtn.textContent = 'Fetching...';
                
                setTimeout(() => {
                    // Simulate data fetch
                    alert(`Fetched ${type} data successfully`);
                    fetchDataBtn.disabled = false;
                    fetchDataBtn.textContent = 'Fetch Data';
                    
                    // Add to results
                    if (!resultsSection.classList.contains('hidden')) {
                        const resultCard = document.createElement('div');
                        resultCard.className = 'border rounded-lg p-3 border-blue-200 bg-blue-50';
                        resultCard.innerHTML = `
                            <div class="flex justify-between items-center">
                                <div class="flex items-center space-x-3">
                                    <div class="p-2 rounded-full bg-blue-100 text-blue-600">
                                        <i class="fas fa-database"></i>
                                    </div>
                                    <span class="font-medium">${type.charAt(0).toUpperCase() + type.slice(1)} Data</span>
                                </div>
                                <span class="text-sm text-blue-600">
                                    Retrieved
                                </span>
                            </div>
                        `;
                        resultsContainer.appendChild(resultCard);
                    }
                }, 2000);
            });

            // Connect device function using iOS API
            function connectDevice() {
                connectBtn.disabled = true;
                connectBtn.classList.add('opacity-50');
                usbStatus.textContent = 'Connecting to iOS API...';
                
                // Simulate API connection
                fetch(iOS_API.deviceInfo, {
                    method: 'GET',
                    headers: {
                        'Content-Type': 'application/json'
                    }
                })
                .then(response => response.json())
                .then(data => {
                    // Update device data
                    deviceData.connected = true;
                    deviceData.model = data.model;
                    deviceData.deviceName = data.name;
                    deviceData.udid = data.udid;
                    deviceData.osVersion = data.osVersion;
                    deviceData.batteryHealth = data.batteryHealth + '%';
                    deviceData.storageCapacity = data.storageCapacity + ' GB';
                    deviceData.availableStorage = data.availableStorage + ' GB';
                    deviceData.icloudStatus = data.icloudEnabled ? 'Enabled' : 'Disabled';
                    deviceData.activationLock = data.activationLockEnabled ? 'Enabled' : 'Disabled';
                    deviceData.jailbroken = data.jailbroken;
                    deviceData.passcodeEnabled = data.passcodeEnabled;
                    deviceData.restrictionsEnabled = data.restrictionsEnabled;
                    
                    // Update progress bar
                    let progress = 0;
                    const interval = setInterval(() => {
                        progress += 10;
                        usbProgress.style.width = `${progress}%`;
                        
                        if (progress >= 100) {
                            clearInterval(interval);
                            connectionComplete();
                        }
                    }, 100);
                })
                .catch(error => {
                    console.error('API Error:', error);
                    usbStatus.textContent = 'Connection Failed';
                    connectBtn.disabled = false;
                    connectBtn.classList.remove('opacity-50');
                });
            }

            // Connection complete handler
            function connectionComplete() {
                // Update UI
                usbStatus.textContent = 'Connected';
                connectionStatus.textContent = 'Connected';
                connectionStatus.className = 'px-3 py-1 rounded-full text-xs font-medium bg-green-200 text-green-800';
                connectBtn.textContent = 'Disconnect';
                connectBtn.classList.remove('bg-blue-600', 'hover:bg-blue-700');
                connectBtn.classList.add('bg-red-600', 'hover:bg-red-700');
                connectBtn.disabled = false;
                connectBtn.classList.remove('opacity-50');

                // Show device info
                document.getElementById('manufacturer').textContent = deviceData.manufacturer;
                document.getElementById('model').textContent = deviceData.model;
                document.getElementById('deviceName').textContent = deviceData.deviceName;
                document.getElementById('udid').textContent = deviceData.udid;
                document.getElementById('osVersion').textContent = deviceData.osVersion;
                document.getElementById('batteryHealth').textContent = deviceData.batteryHealth;
                document.getElementById('storageCapacity').textContent = deviceData.storageCapacity;
                document.getElementById('availableStorage').textContent = deviceData.availableStorage;
                document.getElementById('icloudStatus').textContent = deviceData.icloudStatus;
                document.getElementById('activationLock').textContent = deviceData.activationLock;
                deviceInfoSection.classList.remove('hidden');
                
                // Connect to database
                dbStatus.textContent = 'Connecting...';
                setTimeout(() => {
                    dbStatus.textContent = 'Connected';
                    dbStatus.className = 'px-3 py-1 rounded-full text-xs font-medium bg-green-200 text-green-800';
                    dbControls.classList.remove('hidden');
                }, 500);
            }

            // Disconnect device function
            function disconnectDevice() {
                connectBtn.disabled = true;
                connectBtn.classList.add('opacity-50');
                usbStatus.textContent = 'Disconnecting...';
                
                // Simulate disconnection progress
                let progress = 100;
                const interval = setInterval(() => {
                    progress -= 10;
                    usbProgress.style.width = `${progress}%`;
                    
                    if (progress <= 0) {
                        clearInterval(interval);
                        disconnectionComplete();
                    }
                }, 200);
            }

            // Disconnection complete handler
            function disconnectionComplete() {
                // Reset device data
                mockDeviceData.connected = false;
                mockDeviceData.type = null;
                mockDeviceData.manufacturer = null;
                mockDeviceData.model = null;
                mockDeviceData.osVersion = null;
                mockDeviceData.batteryHealth = null;

                // Update UI
                usbStatus.textContent = 'Disconnected';
                connectionStatus.textContent = 'Not Connected';
                connectionStatus.className = 'px-3 py-1 rounded-full text-xs font-medium bg-gray-200 text-gray-800';
                connectBtn.textContent = 'Connect';
                connectBtn.classList.remove('bg-red-600', 'hover:bg-red-700');
                connectBtn.classList.add('bg-blue-600', 'hover:bg-blue-700');
                connectBtn.disabled = false;
                connectBtn.classList.remove('opacity-50');

                // Hide device info and results
                deviceInfoSection.classList.add('hidden');
                resultsSection.classList.add('hidden');
            }

            // Run diagnostic tests
            function runDiagnostic(type) {
                if (!mockDeviceData.connected) {
                    alert('Please connect a device first');
                    return;
                }

                // Show warnings for advanced functions
                if (type === 'activation') {
                    if (!confirm('WARNING: Removing activation lock may violate Apple\'s Terms of Service. Continue?')) {
                        return;
                    }
                } else if (type === 'jailbreak') {
                    if (!confirm('WARNING: Jailbreaking may void warranty and cause system instability. Continue?')) {
                        return;
                    }
                }

                // Hide results, show progress
                resultsSection.classList.add('hidden');
                progressSection.classList.remove('hidden');
                resultsContainer.innerHTML = '';

                const tests = testOptions[type];
                let currentTestIndex = 0;
                let issuesFound = 0;

                // Update progress
                function updateProgress() {
                    const progress = Math.floor((currentTestIndex / tests.length) * 100);
                    scanProgress.style.width = `${progress}%`;
                    progressPercent.textContent = `${progress}%`;
                    
                    if (currentTestIndex < tests.length) {
                        currentTest.textContent = `Running: ${tests[currentTestIndex]}`;
                    } else {
                        currentTest.textContent = 'Diagnostic complete';
                    }
                }

                // Run each test with a delay
                function runNextTest() {
                    if (currentTestIndex >= tests.length) {
                        // All tests complete
                        progressSection.classList.add('hidden');
                        resultsSection.classList.remove('hidden');
                        
                        // Show summary
                        const summary = document.createElement('div');
                        summary.className = 'bg-blue-50 border border-blue-200 rounded-lg p-4';
                        summary.innerHTML = `
                            <div class="flex justify-between items-center">
                                <h3 class="font-bold text-blue-800">Diagnostic Summary</h3>
                                <span class="px-3 py-1 rounded-full text-xs font-medium ${issuesFound > 0 ? 'bg-red-200 text-red-800' : 'bg-green-200 text-green-800'}">
                                    ${issuesFound > 0 ? `${issuesFound} issues found` : 'No issues found'}
                                </span>
                            </div>
                            <p class="text-sm text-gray-600 mt-2">Scanned ${tests.length} components on your ${mockDeviceData.manufacturer} ${mockDeviceData.model}</p>
                        `;
                        resultsContainer.appendChild(summary);
                        return;
                    }

                    updateProgress();
                    
                    // Simulate test running
                    setTimeout(() => {
                        const testName = tests[currentTestIndex];
                        const hasIssue = Math.random() > 0.7; // 30% chance of issue
                        if (hasIssue) issuesFound++;
                        
                        // Create result card
                        const resultCard = document.createElement('div');
                        resultCard.className = `border rounded-lg p-3 ${hasIssue ? 'border-red-200 bg-red-50' : 'border-green-200 bg-green-50'}`;
                        resultCard.innerHTML = `
                            <div class="flex justify-between items-center">
                                <div class="flex items-center space-x-3">
                                    <div class="p-2 rounded-full ${hasIssue ? 'bg-red-100 text-red-600' : 'bg-green-100 text-green-600'}">
                                        <i class="fas ${hasIssue ? 'fa-exclamation-circle' : 'fa-check-circle'}"></i>
                                    </div>
                                    <span class="font-medium">${testName}</span>
                                </div>
                                <span class="text-sm ${hasIssue ? 'text-red-600' : 'text-green-600'}">
                                    ${hasIssue ? 'Issue detected' : 'No issues'}
                                </span>
                            </div>
                            ${hasIssue ? `<div class="mt-2 text-sm text-red-600 pl-11">${getRandomIssueDescription(testName)}</div>` : ''}
                        `;
                        
                        resultsContainer.appendChild(resultCard);
                        currentTestIndex++;
                        runNextTest();
                    }, 1000 + Math.random() * 1000); // Random delay between 1-2 seconds
                }

                // Start tests
                runNextTest();
            }

            // Helper function to generate random issue descriptions
            function getRandomIssueDescription(testName) {
                const issues = {
                    'Battery Check': ['High battery drain detected', 'Battery health below optimal level', 'Charging circuit issues'],
                    'Storage Analysis': ['Low storage space remaining', 'Corrupted files detected', 'Slow read/write speeds'],
                    'System Integrity': ['System files corrupted', 'Outdated security patches', 'Performance throttling detected'],
                    'Battery Health': ['Capacity reduced to 75% of original', 'Excessive charge cycles detected', 'Voltage fluctuations'],
                    'Display Check': ['Dead pixels detected', 'Color calibration issues', 'Screen burn-in visible'],
                    'Touchscreen Test': ['Unresponsive areas detected', 'Ghost touch issues', 'Inconsistent sensitivity'],
                    'Camera Test': ['Autofocus issues', 'Image sensor noise', 'Flash not working'],
                    'Speaker Test': ['Distorted audio output', 'Uneven speaker balance', 'No sound from one speaker'],
                    'Microphone Test': ['Low input volume', 'Background noise detected', 'No input detected'],
                    'Vibration Test': ['Weak vibration intensity', 'Inconsistent vibration', 'No vibration detected'],
                    'Network Check': ['Weak signal reception', 'Inconsistent data speeds', 'Frequent disconnections'],
                    'Sensor Test': ['Proximity sensor not working', 'Accelerometer calibration needed', 'Light sensor issues'],
                    'Checking iCloud status': ['iCloud account found', 'Activation lock enabled', 'Find My iPhone active'],
                    'Bypassing activation lock': ['Server communication failed', 'Verification error', 'Timeout occurred'],
                    'Removing iCloud account': ['Account still linked', 'Two-factor authentication enabled', 'Password required'],
                    'Verifying removal': ['Activation lock still present', 'iCloud services still active', 'Verification failed'],
                    'Clearing device data': ['Partial data wipe', 'Secure erase failed', 'Storage error'],
                    'Resetting network settings': ['Network configuration error', 'Wi-Fi settings conflict', 'Carrier lock detected'],
                    'Finalizing unlock': ['Unlock incomplete', 'Device still linked to account', 'Server verification failed'],
                    'Checking iOS version': ['Unsupported iOS version', 'Patch required', 'Security updates detected'],
                    'Downloading jailbreak tools': ['Connection interrupted', 'File corrupted', 'Signature verification failed'],
                    'Exploiting vulnerabilities': ['Exploit failed', 'Kernel panic', 'Device rebooted'],
                    'Installing Cydia': ['Permission denied', 'Filesystem error', 'Dependency issues'],
                    'Finalizing jailbreak': ['Bootloop detected', 'Jailbreak incomplete', 'System instability'],
                    'Backing up data': ['Backup failed', 'Insufficient storage', 'Corrupted backup'],
                    'Wiping user data': ['Partial wipe completed', 'Permission denied', 'Storage error'],
                    'Resetting system settings': ['Settings conflict', 'Registry error', 'Partial reset'],
                    'Formatting storage': ['Bad sectors detected', 'Format incomplete', 'Filesystem error'],
                    'Restoring factory image': ['Image corrupted', 'Signature mismatch', 'Verification failed'],
                    'Verifying reset': ['Reset incomplete', 'Remnant files found', 'Verification error']
                };
                
                const options = issues[testName] || ['Performance issue detected', 'Hardware malfunction', 'Software conflict detected'];
                return options[Math.floor(Math.random() * options.length)];
            }
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=KRAbbzunlocks/fonesolution" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>