File size: 2,658 Bytes
33ca991
4dacef6
33ca991
4dacef6
 
 
33ca991
31b2dae
 
 
 
 
 
1ede37d
 
 
 
2f0b412
1ede37d
 
31b2dae
 
 
 
 
 
 
 
 
1ede37d
31b2dae
33ca991
31b2dae
 
1ede37d
31b2dae
 
 
 
 
1ede37d
33ca991
31b2dae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4dacef6
31b2dae
1ede37d
33ca991
 
4dacef6
33ca991
31b2dae
 
33ca991
4dacef6
33ca991
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
import gradio as gr
from androguard.misc import AnalyzeAPK

def check_apk_for_webview(apk_file):
    try:
        a, d, dx = AnalyzeAPK(apk_file.name)

        found_webview = False
        found_client = False
        found_urls = []
        method_hits = []

        # חיפוש בקוד דקס
        for method_analysis in dx.get_methods():
            try:
                method = method_analysis.get_method()
                code = method.get_code()
                if 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 = True
                            if "WebView" in output:
                                found_webview = True
                        if "loadUrl" in output or "http" in output:
                            found_urls.append(output)
            except Exception:
                continue

        # ניתוח AndroidManifest.xml
        manifest_info = ""
        try:
            activities = a.get_activities()
            for act in activities:
                if "webview" in act.lower():
                    manifest_info += f"יתכן Activity עם WebView: {act}\n"
        except:
            pass

        result = ""

        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()