File size: 833 Bytes
cbbe164
 
8fad69f
 
cbbe164
 
26c1f56
 
 
cbbe164
 
 
 
 
 
 
 
 
 
 
 
 
26c1f56
 
 
cbbe164
 
 
 
26c1f56
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
import gradio as gr
import tempfile
from inference.analyze import analyze
from yara.generate import generate_yara

def analyze_file(file):
    if file is None:
        return None, None
        
    path = file.name
    prompt = f"Suspicious file uploaded: {path}"

    result = analyze(prompt)
    yara = generate_yara(result)

    return result, yara

with gr.Blocks() as demo:
    gr.Markdown("# 🛡️ MCMA – Malware Static Analyzer")

    file = gr.File(label="Drag & drop malware sample (static analysis only)")
    json_out = gr.JSON(label="Analysis Result")
    
    # CHANGED: language="yara" -> language="c"
    yara_out = gr.Code(label="Generated YARA Rule", language="c")

    btn = gr.Button("Analyze")
    btn.click(analyze_file, inputs=file, outputs=[json_out, yara_out])

demo.launch()