Spaces:
Paused
Paused
Update templates/index.html
Browse files2 unmodified lines34567897 unmodified lines1718192021222324252627282930313233343536373839405 unmodified lines464748495051525354555657585960616263646566676869707172737475767778798 unmodified lines8889909192939495969798991001011021031041053 unmodified lines1091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592 unmodified lines<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>APK Deep Inspector</title><style>* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }body { background-color: #0f172a; color: #f8fafc; padding: 12px; max-width: 100vw; overflow-x: hidden; }7 unmodified lines.stage-box { margin-top: 12px; display: none; background: #0f172a; padding: 12px; border-radius: 8px; border: 1px solid #334155; }.progress-bar-bg { width: 100%; height: 12px; background: #334155; border-radius: 6px; overflow: hidden; margin-bottom: 8px; }.progress-bar-fill { height: 100%; width: 0%; background: #38bdf8; transition: width 0.15s; }.analysis-fill { background: #10b981; }.status-text { font-size: 0.85rem; color: #38bdf8; font-weight: bold; text-align: center; }.badge { padding: 3px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: bold; }.HIGH { background: #ef4444; color: white; }.MEDIUM { background: #f59e0b; color: black; }.LOW { background: #10b981; color: white; }.filter-group { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; padding-bottom: 4px; }.filter-btn { background: #0f172a; border: 1px solid #334155; color: #f8fafc; padding: 6px 10px; border-radius: 6px; font-size: 0.75rem; cursor: pointer; white-space: nowrap; }.filter-btn.active { background: #2563eb; border-color: #2563eb; }.file-section { background: #020617; border: 1px solid #334155; border-radius: 8px; padding: 10px; margin-top: 10px; }.file-title { color: #facc15; font-size: 0.8rem; font-weight: bold; word-break: break-all; margin-bottom: 6px; }.match-box { max-height: 200px; overflow-y: auto; font-family: monospace; font-size: 0.75rem; }.match-item { padding: 6px; border-bottom: 1px solid #1e293b; color: #cbd5e1; word-break: break-all; }#log-window { background: #020617; border-radius: 8px; height: 160px; overflow-y: auto; padding: 8px; font-family: monospace; font-size: 0.75rem; }.log-line { margin-bottom: 2px; }.log-INFO { color: #38bdf8; }.log-SUCCESS { color: #4ade80; }5 unmodified lines<body><div class="card"><h2>فحص ملف ZIP APK المفكك بالكامل</h2><label for="zipFile" class="file-label" id="fileLabel">إضغط لاختيار ملف ZIP المفكك (160MB+)</label><input type="file" id="zipFile" accept=".zip"><button class="btn" id="uploadBtn" onclick="startUploadAndAnalysis()">بدء رفع الملف والفحص</button><div class="stage-box" id="uploadBox"><div class="progress-bar-bg"><div class="progress-bar-fill" id="uploadFill"></div></div><div class="status-text" id="uploadStatusText">جاري بدء الرفع...</div></div><div class="stage-box" id="analysisBox"><div class="progress-bar-bg"><div class="progress-bar-fill analysis-fill" id="analysisFill"></div></div><div class="status-text" id="analysisStatusText">جاري فك الضغط والتفتيش...</div></div></div><div class="card" id="resultsCard" style="display: none;"><h2>ملخص نتائج التفتيش</h2><div id="statsSummary" style="font-size:0.85rem; margin-bottom:10px;"></div><div class="filter-group"><button class="filter-btn active" onclick="filterResults('ALL', this)">الكل</button><button class="filter-btn" onclick="filterResults('HIGH', this)">HIGH فقط</button><button class="filter-btn" onclick="filterResults('DISCORD', this)">Discord فقط</button><button class="filter-btn" onclick="filterResults('MEDIUM', this)">MEDIUM</button></div><div id="resultsContainer"></div><div class="download-group">8 unmodified lines</div><script>const fileInput = document.getElementById('zipFile');const fileLabel = document.getElementById('fileLabel');let globalData = null;fileInput.onchange = () => {if (fileInput.files.length > 0) fileLabel.innerText = fileInput.files[0].name;};const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';const ws = new WebSocket(`${protocol}//${window.location.host}/ws/logs`);// تحسين أداء كتابة السجلات في المتصفح لمنع التجمّدws.onmessage = (e) => {const log = JSON.parse(e.data);const win = document.getElementById('log-window');3 unmodified linesline.innerText = `[${log.timestamp}] ${log.message}`;win.appendChild(line);// الاحتفاظ بآخر 100 سطر فقط في الذاكرة لحماية الرام بالهاتفif (win.children.length > 100) {win.removeChild(win.firstChild);}win.scrollTop = win.scrollHeight;if (log.progress > 0) {document.getElementById('analysisFill').style.width = log.progress + '%';document.getElementById('analysisStatusText').innerText = `جاري التحليل والتفتيش: ${log.progress}%`;}};function startUploadAndAnalysis() {const file = fileInput.files[0];if (!file) return alert("الرجاء اختيار ملف ZIP أولاً");const uploadBtn = document.getElementById('uploadBtn');const uploadBox = document.getElementById('uploadBox');const uploadFill = document.getElementById('uploadFill');const uploadStatusText = document.getElementById('uploadStatusText');const analysisBox = document.getElementById('analysisBox');const logsCard = document.getElementById('logsCard');uploadBtn.disabled = true;uploadBtn.innerText = "⏳ جاري الرفع إلى الخادم...";uploadBox.style.display = "block";analysisBox.style.display = "none";logsCard.style.display = "none";document.getElementById('resultsCard').style.display = "none";const formData = new FormData();formData.append("file", file);const xhr = new XMLHttpRequest();const startTime = Date.now();// 1. حساب نسبة الرفع الحقيقية من 0% إلى 100%xhr.upload.onprogress = (e) => {if (e.lengthComputable) {const percent = Math.round((e.loaded / e.total) * 100);const elapsedTime = (Date.now() - startTime) / 1000;const speedMB = ((e.loaded / (1024 * 1024)) / (elapsedTime || 1));const speedMbps = (speedMB * 8).toFixed(1); // الحساب الدقيق بـ MbpsuploadFill.style.width = percent + '%';uploadStatusText.innerText = `جاري الرفع: ${percent}% | السرعة: ${speedMB.toFixed(2)} MB/s (${speedMbps} Mbps)`;}};// 2. الانتهاء من الرفع بالكاملxhr.onload = () => {if (xhr.status === 200) {uploadStatusText.innerText = "✅ اكتمل رفع الملف 100%! جاري بدء الفحص في الخادم...";uploadFill.style.width = '100%';setTimeout(() => {uploadBox.style.display = "none";analysisBox.style.display = "block";logsCard.style.display = "block";}, 500);const data = JSON.parse(xhr.responseText);if (data.status === "success") {uploadBtn.disabled = false;uploadBtn.innerText = "بدء رفع الملف والفحص";globalData = data.data;showResults(globalData, 'ALL');} else {alert(data.message);uploadBtn.disabled = false;uploadBtn.innerText = "بدء رفع الملف والفحص";}} else {alert("حدث خطأ في استجابة الخادم");uploadBtn.disabled = false;uploadBtn.innerText = "بدء رفع الملف والفحص";}};xhr.onerror = () => {uploadBtn.disabled = false;uploadBtn.innerText = "بدء رفع الملف والفحص";alert("حدث خطأ في الاتصال أثناء الرفع");};xhr.open("POST", "/analyze-zip");xhr.send(formData);}function showResults(data, filter) {document.getElementById('resultsCard').style.display = 'block';const summary = data.summary;document.getElementById('statsSummary').innerHTML = `إجمالي الملفات المفحوصة: <b>${summary.total_files_scanned}</b> | إجمالي التطابقات: <b>${summary.total_matches}</b><br>أولوية عالية: <span class="badge HIGH">${summary.high_priority_count}</span>متوسطة: <span class="badge MEDIUM">${summary.medium_priority_count}</span>`;renderDetails(data.details, filter);}function renderDetails(details, filter) {const container = document.getElementById('resultsContainer');container.innerHTML = '';details.forEach(item => {let matchesHtml = '';item.results.forEach(m => {let keep = false;if (filter === 'ALL') keep = true;else if (filter === 'HIGH' && m.severity === 'HIGH') keep = true;else if (filter === 'MEDIUM' && m.severity === 'MEDIUM') keep = true;else if (filter === 'DISCORD' && m.type === 'DISCORD') keep = true;if (keep) {matchesHtml += `<div class="match-item"><span class="badge ${m.severity}">${m.severity}</span><b>[${m.type}]</b>: ${escapeHtml(m.value)}<br><span style="color:#94a3b8; font-size:0.7rem;">المقتطف: ${escapeHtml(m.snippet)}</span></div>`;}});if (matchesHtml) {container.innerHTML += `<div class="file-section"><div class="file-title">📁 ${item.file_path}</div><div class="match-box">${matchesHtml}</div></div>`;}});if (!container.innerHTML) {container.innerHTML = '<div style="color:#94a3b8; text-align:center; padding:10px;">لا توجد نتائج مطابقة لهذه التصفية.</div>';}}function filterResults(filter, btn) {document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));btn.classList.add('active');if (globalData) renderDetails(globalData.details, filter);}function escapeHtml(text) {2 unmodified lines34567897 unmodified lines171819202122232425262728293031323334355 unmodified lines4142434445464748495051525354555657585960618 unmodified lines707172737475767778798081828384858687883 unmodified lines92939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002 unmodified lines<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>Native SO & Metadata Inspector</title><style>* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }body { background-color: #0f172a; color: #f8fafc; padding: 12px; max-width: 100vw; overflow-x: hidden; }7 unmodified lines.stage-box { margin-top: 12px; display: none; background: #0f172a; padding: 12px; border-radius: 8px; border: 1px solid #334155; }.progress-bar-bg { width: 100%; height: 12px; background: #334155; border-radius: 6px; overflow: hidden; margin-bottom: 8px; }.progress-bar-fill { height: 100%; width: 0%; background: #38bdf8; transition: width 0.15s; }.status-text { font-size: 0.85rem; color: #38bdf8; font-weight: bold; text-align: center; }.badge { padding: 3px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: bold; }.CRITICAL { background: #dc2626; color: white; }.HIGH { background: #ea580c; color: white; }.MEDIUM { background: #d97706; color: white; }.file-section { background: #020617; border: 1px solid #334155; border-radius: 8px; padding: 10px; margin-top: 10px; }.file-title { color: #facc15; font-size: 0.8rem; font-weight: bold; word-break: break-all; margin-bottom: 6px; }.match-box { max-height: 220px; overflow-y: auto; font-family: monospace; font-size: 0.75rem; }.match-item { padding: 6px; border-bottom: 1px solid #1e293b; color: #cbd5e1; word-break: break-all; }#log-window { background: #020617; border-radius: 8px; height: 150px; overflow-y: auto; padding: 8px; font-family: monospace; font-size: 0.75rem; }.log-line { margin-bottom: 2px; }.log-INFO { color: #38bdf8; }.log-SUCCESS { color: #4ade80; }5 unmodified lines<body><div class="card"><h2>محلل الهندسة العكسية لـ .SO & Metadata</h2><label for="reFiles" class="file-label" id="fileLabel">اختر ملفات (.so, global-metadata.dat, zip, apk)</label><input type="file" id="reFiles" multiple><button class="btn" id="uploadBtn" onclick="startUploadAndAnalysis()">بدء الرفع والتفتيش الهاندسي</button><div class="stage-box" id="uploadBox"><div class="progress-bar-bg"><div class="progress-bar-fill" id="uploadFill"></div></div><div class="status-text" id="uploadStatusText">جاري بدء الرفع...</div></div></div><div class="card" id="resultsCard" style="display: none;"><h2>نتائج الفحص وسيرفرات التفعيل</h2><div id="statsSummary" style="font-size:0.85rem; margin-bottom:10px;"></div><div id="resultsContainer"></div><div class="download-group">8 unmodified lines</div><script>const fileInput = document.getElementById('reFiles');const fileLabel = document.getElementById('fileLabel');let globalData = null;fileInput.onchange = () => {const count = fileInput.files.length;if (count === 1) fileLabel.innerText = fileInput.files[0].name;else if (count > 1) fileLabel.innerText = `تم اختيار ${count} ملفات`;};const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';const ws = new WebSocket(`${protocol}//${window.location.host}/ws/logs`);ws.onmessage = (e) => {const log = JSON.parse(e.data);const win = document.getElementById('log-window');3 unmodified linesline.innerText = `[${log.timestamp}] ${log.message}`;win.appendChild(line);if (win.children.length > 100) win.removeChild(win.firstChild);win.scrollTop = win.scrollHeight;};function startUploadAndAnalysis() {const files = fileInput.files;if (!files || files.length === 0) return alert("الرجاء اختيار ملف واحد على الأقل");const uploadBtn = document.getElementById('uploadBtn');const uploadBox = document.getElementById('uploadBox');const uploadFill = document.getElementById('uploadFill');const uploadStatusText = document.getElementById('uploadStatusText');uploadBtn.disabled = true;uploadBtn.innerText = "⏳ جاري الرفع بالكامل...";uploadBox.style.display = "block";document.getElementById('logsCard').style.display = "block";document.getElementById('resultsCard').style.display = "none";const formData = new FormData();for (let i = 0; i < files.length; i++) {formData.append("files", files[i]);}const xhr = new XMLHttpRequest();const startTime = Date.now();// النسبة الحقيقية للرفع من 0% إلى 100% بدون إحباط الحجمxhr.upload.onprogress = (e) => {if (e.lengthComputable) {const percent = Math.round((e.loaded / e.total) * 100);const elapsedTime = (Date.now() - startTime) / 1000;const speedMB = ((e.loaded / (1024 * 1024)) / (elapsedTime || 1));const speedMbps = (speedMB * 8).toFixed(1);uploadFill.style.width = percent + '%';uploadStatusText.innerText = `جاري الرفع الحقيقي: ${percent}% | ${(e.loaded/(1024*1024)).toFixed(1)} / ${(e.total/(1024*1024)).toFixed(1)} MB (${speedMbps} Mbps)`;}};xhr.onload = () => {if (xhr.status === 200) {uploadStatusText.innerText = "✅ اكتمل الرفع 100%! جاري التفتيش وفك التشفير...";uploadFill.style.width = '100%';const data = JSON.parse(xhr.responseText);if (data.status === "success") {uploadBtn.disabled = false;uploadBtn.innerText = "بدء الرفع والتفتيش الهاندسي";globalData = data.data;showResults(globalData);} else {alert(data.message);uploadBtn.disabled = false;uploadBtn.innerText = "بدء الرفع والتفتيش الهاندسي";}} else {alert("حدث خطأ في استجابة الخادم");uploadBtn.disabled = false;uploadBtn.innerText = "بدء الرفع والتفتيش الهاندسي";}};xhr.onerror = () => {uploadBtn.disabled = false;uploadBtn.innerText = "بدء الرفع والتفتيش الهاندسي";alert("حدث خطأ في الاتصال الشبكي");};xhr.open("POST", "/analyze");xhr.send(formData);}function showResults(data) {document.getElementById('resultsCard').style.display = 'block';const summary = data.summary;document.getElementById('statsSummary').innerHTML = `إجمالي الملفات المفحوصة: <b>${summary.total_files}</b> | التطابقات: <b>${summary.total_matches}</b><br>سيرفر حاسم (CRITICAL): <span class="badge CRITICAL">${summary.critical_count}</span>أولوية عالية: <span class="badge HIGH">${summary.high_count}</span>`;const container = document.getElementById('resultsContainer');container.innerHTML = '';data.details.forEach(item => {let matchesHtml = '';item.results.forEach(m => {matchesHtml += `<div class="match-item"><span class="badge ${m.severity}">${m.severity}</span><b>[${m.type}]</b>: ${escapeHtml(m.value)}<br><span style="color:#94a3b8; font-size:0.7rem;">${escapeHtml(m.snippet)}</span></div>`;});container.innerHTML += `<div class="file-section"><div class="file-title">📁 ${item.file}</div><div class="match-box">${matchesHtml}</div></div>`;});}function escapeHtml(text) {
templates/index.html+50-109