Spaces:
Sleeping
Sleeping
Upload 7 files
Browse files- .gitattributes +1 -0
- Document.docx +0 -0
- LabelEncoder.joblib +3 -0
- Untitled-1.ipynb +0 -0
- app.py +50 -0
- dbscan_model.joblib +3 -0
- malware_detection_data.csv +3 -0
- requirements.txt +5 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
malware_detection_data.csv filter=lfs diff=lfs merge=lfs -text
|
Document.docx
ADDED
|
Binary file (16.9 kB). View file
|
|
|
LabelEncoder.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52f9e1b85be8056dd7a6ad73f243aa5acde190065661aee00bc8d399c995d708
|
| 3 |
+
size 1177
|
Untitled-1.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from joblib import load
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
# App Title
|
| 6 |
+
st.title("Malware Detection")
|
| 7 |
+
|
| 8 |
+
# Load Model and Encoder
|
| 9 |
+
model = load('dbscan_model.joblib')
|
| 10 |
+
encoder = load("LabelEncoder.joblib")
|
| 11 |
+
|
| 12 |
+
# Input Fields
|
| 13 |
+
anomaly_score = st.number_input("Anomaly Score", min_value=0, max_value=100, step=1, help="Score indicating the level of anomaly (0-100).")
|
| 14 |
+
anomaly_score = anomaly_score / 100 # Normalize
|
| 15 |
+
suspicious_ip_count = st.number_input("Suspicious IP Count", min_value=0, max_value=9, help="Number of suspicious IPs detected.")
|
| 16 |
+
malicious_payload_indicator = st.selectbox("Malicious Payload Indicator", options=["Yes", "No"])
|
| 17 |
+
malicious_payload_indicator = 1 if malicious_payload_indicator == "Yes" else 0
|
| 18 |
+
reputation_score = st.number_input("Reputation Score", min_value=0, max_value=100, help="Reputation score of the source (0-100).")
|
| 19 |
+
behavioral_score = st.number_input("Behavioral Score", min_value=0, max_value=100, help="Behavioral score based on activity patterns (0-100).")
|
| 20 |
+
|
| 21 |
+
attack_type = st.selectbox("Attack Type", options=encoder["attack_type"].classes_, help="Type of attack detected.")
|
| 22 |
+
attack_type = encoder["attack_type"].transform([attack_type])[0]
|
| 23 |
+
|
| 24 |
+
signature_match = st.selectbox("Signature Match", options=["Yes", "No"], help="Does the payload match any known signatures?")
|
| 25 |
+
signature_match = 1 if signature_match == "Yes" else 0
|
| 26 |
+
|
| 27 |
+
sandbox_result = st.selectbox("Sandbox Result", options=encoder["sandbox_result"].classes_, help="Result from sandbox testing.")
|
| 28 |
+
sandbox_result = encoder["sandbox_result"].transform([sandbox_result])[0]
|
| 29 |
+
|
| 30 |
+
heuristic_score = st.number_input("Heuristic Score", min_value=0, max_value=100, help="Score based on heuristic analysis (0-100).")
|
| 31 |
+
traffic_pattern = st.selectbox("Traffic Pattern", options=encoder["traffic_pattern"].classes_, help="Detected traffic pattern.")
|
| 32 |
+
traffic_pattern = encoder["traffic_pattern"].transform([traffic_pattern])[0]
|
| 33 |
+
|
| 34 |
+
# Combine Features
|
| 35 |
+
values = [
|
| 36 |
+
anomaly_score, suspicious_ip_count, malicious_payload_indicator,
|
| 37 |
+
reputation_score, behavioral_score, attack_type, signature_match,
|
| 38 |
+
sandbox_result, heuristic_score, traffic_pattern
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
# Prediction
|
| 42 |
+
if st.button("Detect Malware"):
|
| 43 |
+
try:
|
| 44 |
+
label = model.fit_predict([values])[0]
|
| 45 |
+
if label == -1:
|
| 46 |
+
st.success("Malware Detected")
|
| 47 |
+
else:
|
| 48 |
+
st.success("No Malware Detected")
|
| 49 |
+
except Exception as e:
|
| 50 |
+
st.error(f"Error: {e}")
|
dbscan_model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b62f17af9b51351fe0d711750cfb67b85bb497b81aad7bc89145d033b6880b0
|
| 3 |
+
size 2124077
|
malware_detection_data.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5549cc13d44bf8f6cc42f1282a9cabb0cebd24c45aefab85e81e120692fe724a
|
| 3 |
+
size 20430279
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
joblib==1.3.2
|
| 2 |
+
numpy==1.26.4
|
| 3 |
+
pandas==2.2
|
| 4 |
+
scikit-learn==1.4.1.post1
|
| 5 |
+
streamlit==1.32.2
|