Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Browser APK Analyzer</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| max-width: 800px; | |
| margin: 0 auto; | |
| padding: 20px; | |
| line-height: 1.6; | |
| } | |
| .container { | |
| border: 1px solid #ddd; | |
| padding: 20px; | |
| border-radius: 8px; | |
| margin-top: 20px; | |
| } | |
| #results { | |
| margin-top: 20px; | |
| white-space: pre-wrap; | |
| background: #f5f5f5; | |
| padding: 15px; | |
| border-radius: 5px; | |
| } | |
| button { | |
| background: #4CAF50; | |
| color: white; | |
| border: none; | |
| padding: 10px 15px; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| } | |
| button:disabled { | |
| background: #cccccc; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Browser APK Analyzer</h1> | |
| <div class="container"> | |
| <input type="file" id="apkFile" accept=".apk"> | |
| <button id="analyzeBtn" disabled>Analyze APK</button> | |
| <div id="results"></div> | |
| </div> | |
| <script> | |
| const apkInput = document.getElementById('apkFile'); | |
| const analyzeBtn = document.getElementById('analyzeBtn'); | |
| const resultsDiv = document.getElementById('results'); | |
| apkInput.addEventListener('change', (e) => { | |
| analyzeBtn.disabled = !e.target.files.length; | |
| }); | |
| analyzeBtn.addEventListener('click', async () => { | |
| const file = apkInput.files[0]; | |
| if (!file) return; | |
| analyzeBtn.disabled = true; | |
| resultsDiv.textContent = "Analyzing..."; | |
| try { | |
| // Read basic file info | |
| const fileInfo = { | |
| name: file.name, | |
| size: file.size, | |
| type: file.type, | |
| lastModified: new Date(file.lastModified).toLocaleString() | |
| }; | |
| // Read as ArrayBuffer for more advanced analysis | |
| const arrayBuffer = await file.arrayBuffer(); | |
| const uint8Array = new Uint8Array(arrayBuffer); | |
| // Simple APK header check (PK zip signature) | |
| const isApk = uint8Array[0] === 0x50 && uint8Array[1] === 0x4B; | |
| // Display results | |
| resultsDiv.innerHTML = ` | |
| <h3>Basic File Info:</h3> | |
| <pre>${JSON.stringify(fileInfo, null, 2)}</pre> | |
| <h3>APK Analysis:</h3> | |
| <p>Valid APK/ZIP: ${isApk ? "✅ Yes" : "❌ No"}</p> | |
| <p>Note: This browser-only version shows limited info. For full analysis, use the Docker version.</p> | |
| `; | |
| } catch (error) { | |
| resultsDiv.textContent = `Error: ${error.message}`; | |
| } finally { | |
| analyzeBtn.disabled = false; | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> | |