| --- |
| license: apache-2.0 |
| language: |
| - en |
| tags: |
| - cybersecurity |
| - intrusion-detection |
| - phishing-detection |
| - vulnerability-scoring |
| - machine-learning |
| - random-forest |
| - xgboost |
| --- |
| |
| # π‘οΈ Cybersecurity ML Models |
|
|
| A collection of machine learning models for cybersecurity threat detection and vulnerability assessment. |
|
|
| ## Models Included |
|
|
| ### π Intrusion Detection (UNSW-NB15) |
| Detects network intrusions and classifies attack types. |
| - **Algorithm:** Random Forest + XGBoost |
| - **Classes:** Normal, DoS, Exploits, Fuzzers, Generic, Reconnaissance, Backdoor, Analysis, Shellcode, Worms |
| - **Dataset:** UNSW-NB15 |
|
|
| ### π£ Phishing Detection |
| Identifies phishing URLs and malicious web content. |
| - **Algorithm:** Random Forest + XGBoost |
| - **Output:** Phishing / Legitimate |
|
|
| ### π‘οΈ Vulnerability Scoring |
| Predicts vulnerability severity and CVSS scores. |
| - **Algorithm:** Random Forest + XGBoost (classifier + regressor) |
| - **Output:** Severity label + numeric score |
|
|
| --- |
|
|
| ## π Repository Structure |
| ``` |
| βββ predictor.pkl # Main predictor (load this) |
| βββ preprocessors/ |
| β βββ intrusion_label_encoder.pkl |
| β βββ intrusion_scaler.pkl |
| β βββ phishing_scaler.pkl |
| β βββ severity_encoder.pkl |
| β βββ vulnerability_scaler.pkl |
| β βββ intrusion_feature_names.json |
| β βββ phishing_feature_names.json |
| β βββ vulnerability_feature_names.json |
| βββ saved_models/ |
| βββ intrusion_detection/ |
| βββ phishing_detection/ |
| βββ vulnerability_scoring/ |
| ``` |
|
|
| --- |
|
|
| ## π Quickstart |
|
|
| ### Install dependencies |
| ```bash |
| pip install scikit-learn xgboost joblib huggingface_hub |
| ``` |
|
|
| ### Load the models |
| ```python |
| import joblib |
| from huggingface_hub import hf_hub_download |
| |
| # Download and load main predictor |
| path = hf_hub_download(repo_id="Alfeesi/cybersecurity-ml-models", filename="predictor.pkl") |
| predictor = joblib.load(path) |
| ``` |
|
|
| ### Intrusion Detection |
| ```python |
| import numpy as np |
| |
| features = np.array([[0.5, 0, 1, 1024, 512]]) # your network features |
| result = predictor.predict_intrusion(features) |
| print(f"Attack Type: {result['attack_type']}") |
| ``` |
|
|
| ### Phishing Detection |
| ```python |
| features = np.array([[75, 1, 3, 0]]) # url_length, has_ip, num_dots, has_https |
| result = predictor.predict_phishing(features) |
| print(f"Phishing: {result}") |
| ``` |
|
|
| ### Vulnerability Scoring |
| ```python |
| features = np.array([[7.5, 0, 0]]) # cvss_base, attack_vector, complexity |
| result = predictor.predict_vulnerability(features) |
| print(f"Severity: {result['severity']} | Score: {result['score']}") |
| ``` |
|
|
| --- |
|
|
| ## π Model Performance |
|
|
| | Model | Metric | Score | |
| |-------|--------|-------| |
| | Intrusion Detection | Accuracy | See evaluation/ | |
| | Phishing Detection | Accuracy | See evaluation/ | |
| | Vulnerability Scoring | RMSE | See evaluation/ | |
|
|
| --- |
|
|
| ## π Live Demo |
| https://huggingface.co/spaces/Alfeesi/cybersecurity-demo |
|
|
| --- |
|
|
| ## π License |
| Apache 2.0 β free to use, modify, and distribute. |