Tabular Classification
Scikit-learn
English
logistic_regression
cybersecurity
security
logs
anomaly-detection
intrusion-detection
siem
mitre-attack
explainable-ai
logistic-regression
skops
Eval Results (legacy)
Instructions to use DaveyD347/log-anomaly-context-lr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use DaveyD347/log-anomaly-context-lr with Scikit-learn:
# ⚠️ Model filename not specified in config.json
- Notebooks
- Google Colab
- Kaggle
File size: 1,619 Bytes
a56b6dd | 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 | """Signature baseline: one-line regex rules of the kind a SIEM ships out of the box.
Each rule looks at a single line with no context, which is how most keyword alerts work. Used only as a baseline.
"""
import re
RULES = [
("scanner_user_agent", r"sqlmap|nikto|gobuster|zgrab|nuclei|masscan|dirbuster|wfuzz"),
("sql_injection", r"(%27|')\s*(or|and|union|order)|union(%20|\s)select|information_schema|sleep\(\d|waitfor(%20|\s)delay"),
("web_shell_command", r"\.(php|jsp|aspx?)\?(cmd|exec|command)="),
("sensitive_path_probe", r"\"GET /(\.env|\.git/|\.aws/|wp-login\.php|phpmyadmin|server-status|actuator)"),
("ssh_failed_or_invalid", r"sshd\[\d+\]: (Failed password|Invalid user)"),
("ssh_password_login", r"sshd\[\d+\]: Accepted password"),
("reverse_shell", r"/dev/tcp/|\bnc\b.*\s-e\s"),
("download_from_raw_ip", r"(wget|curl)\"?.*https?://\d{1,3}(\.\d{1,3}){3}"),
("credential_file_read", r"/etc/shadow|/etc/passwd"),
("cron_persistence", r"crontab -"),
("cloud_admin_policy", r"AdministratorAccess"),
("cloud_log_tampering", r"\"eventName\":\"(StopLogging|DeleteTrail|PutEventSelectors)\""),
("cloud_new_user_or_key", r"\"eventName\":\"(CreateUser|CreateAccessKey|CreateLoginProfile)\""),
("cloud_offensive_ua", r"kali|parrot|pacu"),
("dns_long_label", r"query: [a-z0-9]{40,}\."),
("dns_txt_null_query", r" IN (TXT|NULL) "),
]
_COMPILED = [(n, re.compile(p, re.I)) for n, p in RULES]
def rule_hits(line: str):
return [n for n, rx in _COMPILED if rx.search(line)]
def rule_score(line: str) -> float:
return 1.0 if rule_hits(line) else 0.0
|