Spaces:
Sleeping
Sleeping
Update app.py
Browse files4 unmodified lines5678910111 unmodified line13141516171819202122232425262728293031323334353637383940414 unmodified linestry:a, d, dx = AnalyzeAPK(apk_file.name)# סריקת קוד דקס בצורה בטוחהfor method_analysis in dx.get_methods():try:method = method_analysis.get_method()1 unmodified lineif code:bc = code.get_bc()for ins in bc.get_instructions():if "WebView" in ins.get_output() or "WebView" in ins.get_name():return "⚠️ האפליקציה כוללת שימוש ב־WebView (בקוד)"except Exception:continue # מתודות חיצוניות, בלי קוד וכו'# בדיקת הרשאותtry:perms = a.get_permissions()if "android.permission.INTERNET" in perms:return "⚠️ האפליקציה דורשת גישת אינטרנט – ייתכן שיש WebView"except Exception:passreturn "✅ לא נמצא שימוש ב־WebView"except Exception as e:return f"שגיאה כללית בניתוח הקובץ: {str(e)}"iface = gr.Interface(fn=check_apk_for_webview,inputs=gr.File(label="בחר קובץ APK", file_types=[".apk"]),outputs="text",title="בודק שימוש ב־WebView באפליקציית APK",description="בודק אם האפליקציה כוללת שימוש פנימי ברכיב WebView, שעשוי לאפשר גלישה לא מסוננת.",)iface.launch()4 unmodified lines56789101112131415161 unmodified line181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071724 unmodified linestry:a, d, dx = AnalyzeAPK(apk_file.name)found_webview = Falsefound_client = Falsefound_urls = []method_hits = []# חיפוש בקוד דקסfor method_analysis in dx.get_methods():try:method = method_analysis.get_method()1 unmodified lineif code:bc = code.get_bc()for ins in bc.get_instructions():output = ins.get_output()if any(x in output for x in ["WebView", "WebViewClient", "WebChromeClient"]):method_hits.append(f"{ins.get_name()} - {output}")if "WebViewClient" in output or "WebChromeClient" in output:found_client = Trueif "WebView" in output:found_webview = Trueif "loadUrl" in output or "http" in output:found_urls.append(output)except Exception:continue# ניתוח AndroidManifest.xmlmanifest_info = ""try:activities = a.get_activities()for act in activities:if "webview" in act.lower():manifest_info += f"יתכן Activity עם WebView: {act}\n"except:passresult = ""if found_webview:result += "⚠️ נמצא שימוש ב־WebView בקוד:\n" + "\n".join(method_hits[:5]) + "\n\n"else:result += "✅ לא נמצא שימוש ודאי ב־WebView בקוד.\n"if found_client:result += "📌 נמצא שימוש ב־WebViewClient או WebChromeClient\n"if found_urls:result += f"🌐 קריאות ל־URL בקוד: {len(found_urls)} (למשל: {found_urls[0][:80]})\n"if manifest_info:result += f"📄 מתוך ה־Manifest:\n{manifest_info}"return result.strip()except Exception as e:return f"שגיאה בניתוח הקובץ: {str(e)}"iface = gr.Interface(fn=check_apk_for_webview,inputs=gr.File(label="בחר קובץ APK", file_types=[".apk"]),outputs="text",title="סריקה מתקדמת ל־WebView באפליקציית APK",description="בודק אם יש שימוש ודאי ב־WebView, WebViewClient, או טעינת URL מתוך הקוד וה־Manifest.",)iface.launch()
app.py+44-13