File size: 1,246 Bytes
1155645
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# -*- coding: utf-8 -*-
"""Untitled13.ipynb

Automatically generated by Colab.

Original file is located at
    https://colab.research.google.com/drive/1tcnwTbDdiq9rWeK0nwg71xaV6KqxcrYQ
"""

import streamlit as st
import os
import tempfile
import zipfile
import pandas as pd
import joblib
from extract_features import extract_features_from_dump

st.title("🧠 Memory Forensics Malware Detector")

uploaded_zip = st.file_uploader("Upload a ZIP of Volatility plugin outputs", type=["zip"])

if uploaded_zip:
    with tempfile.TemporaryDirectory() as tmpdirname:
        zip_path = os.path.join(tmpdirname, "upload.zip")
        with open(zip_path, "wb") as f:
            f.write(uploaded_zip.getbuffer())

        with zipfile.ZipFile(zip_path, 'r') as zip_ref:
            zip_ref.extractall(tmpdirname)

        st.write("Files extracted. Running feature extraction...")

        # Extract features
        features = extract_features_from_dump(tmpdirname)
        df = pd.DataFrame([features]).fillna(0)

        # Load model
        model = joblib.load("memory_forensics_model.pkl")

        prediction = model.predict(df)[0]
        label = "🛑 Malware" if prediction == 1 else "✅ Benign"

        st.markdown(f"### Prediction: {label}")