Spaces:
Runtime error
Runtime error
| # -*- 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}") |