securitylogai 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ MIT License
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: securitylogai
3
+ Version: 0.1.0
4
+ Summary: AI-powered security log analysis toolkit
5
+ Author: Isaac Talb
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/IsaacTalb/securitylogai
8
+ Project-URL: Repository, https://github.com/IsaacTalb/securitylogai
9
+ Project-URL: Issues, https://github.com/IsaacTalb/securitylogai/issues
10
+ Keywords: security,logs,ai,cybersecurity,fastapi
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Security
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Dynamic: license-file
23
+
24
+ # securitylogai
25
+
26
+ Reusable Python engine for parsing logs, detecting suspicious activity, generating reports, and producing AI explanations.
27
+
28
+ ## What it does
29
+
30
+ - Parse Apache-style logs
31
+ - Detect brute-force style patterns
32
+ - Generate readable reports
33
+ - Produce AI-ready summaries
34
+
35
+ ## Install from PyPI
36
+
37
+ ```bash
38
+ pip install securitylogai
39
+ ```
40
+
41
+ ## Install from TestPyPI
42
+
43
+ ```bash
44
+ pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple securitylogai
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ ```python
50
+ from securitylogai import parse_apache_log, detect_bruteforce, generate_report, explain_attack
51
+
52
+ log = "127.0.0.1 - - [30/May/2026:12:00:00 +0630] \"POST /login HTTP/1.1\" 401 532"
53
+ event = parse_apache_log(log)
54
+ findings = detect_bruteforce([event] * 25)
55
+ report = generate_report(findings)
56
+ summary = explain_attack(findings[0]) if findings else None
57
+ ```
58
+
59
+ ## Build and publish
60
+
61
+ ```bash
62
+ python -m pip install --upgrade build twine
63
+ python -m build
64
+ python -m twine check dist/*
65
+ python -m twine upload dist/*
66
+ ```
67
+
68
+ ## Publish to TestPyPI first
69
+
70
+ ```bash
71
+ python -m twine upload --repository testpypi dist/*
72
+ ```
73
+
74
+ ## Package structure
75
+
76
+ - `parser.py` - parse log lines
77
+ - `detector.py` - detect suspicious patterns
78
+ - `reporter.py` - create text reports
79
+ - `ai.py` - AI explanation layer
80
+ - `utils.py` - shared helpers
81
+
82
+ ## Roadmap
83
+
84
+ - add Nginx / SSH / Windows parsing
85
+ - add provider adapters for OpenAI, Gemini, Ollama
86
+ - add CLI and JSON output
87
+ - add tests and release workflow
@@ -0,0 +1,64 @@
1
+ # securitylogai
2
+
3
+ Reusable Python engine for parsing logs, detecting suspicious activity, generating reports, and producing AI explanations.
4
+
5
+ ## What it does
6
+
7
+ - Parse Apache-style logs
8
+ - Detect brute-force style patterns
9
+ - Generate readable reports
10
+ - Produce AI-ready summaries
11
+
12
+ ## Install from PyPI
13
+
14
+ ```bash
15
+ pip install securitylogai
16
+ ```
17
+
18
+ ## Install from TestPyPI
19
+
20
+ ```bash
21
+ pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple securitylogai
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```python
27
+ from securitylogai import parse_apache_log, detect_bruteforce, generate_report, explain_attack
28
+
29
+ log = "127.0.0.1 - - [30/May/2026:12:00:00 +0630] \"POST /login HTTP/1.1\" 401 532"
30
+ event = parse_apache_log(log)
31
+ findings = detect_bruteforce([event] * 25)
32
+ report = generate_report(findings)
33
+ summary = explain_attack(findings[0]) if findings else None
34
+ ```
35
+
36
+ ## Build and publish
37
+
38
+ ```bash
39
+ python -m pip install --upgrade build twine
40
+ python -m build
41
+ python -m twine check dist/*
42
+ python -m twine upload dist/*
43
+ ```
44
+
45
+ ## Publish to TestPyPI first
46
+
47
+ ```bash
48
+ python -m twine upload --repository testpypi dist/*
49
+ ```
50
+
51
+ ## Package structure
52
+
53
+ - `parser.py` - parse log lines
54
+ - `detector.py` - detect suspicious patterns
55
+ - `reporter.py` - create text reports
56
+ - `ai.py` - AI explanation layer
57
+ - `utils.py` - shared helpers
58
+
59
+ ## Roadmap
60
+
61
+ - add Nginx / SSH / Windows parsing
62
+ - add provider adapters for OpenAI, Gemini, Ollama
63
+ - add CLI and JSON output
64
+ - add tests and release workflow
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "securitylogai"
7
+ version = "0.1.0"
8
+ description = "AI-powered security log analysis toolkit"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [{name = "Isaac Talb"}]
13
+ keywords = ["security", "logs", "ai", "cybersecurity", "fastapi"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Topic :: Security",
22
+ "Topic :: Software Development :: Libraries :: Python Modules",
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/IsaacTalb/securitylogai"
27
+ Repository = "https://github.com/IsaacTalb/securitylogai"
28
+ Issues = "https://github.com/IsaacTalb/securitylogai/issues"
29
+
30
+ [tool.setuptools]
31
+ packages = ["securitylogai"]
@@ -0,0 +1,13 @@
1
+ from .parser import parse_apache_log
2
+ from .detector import detect_bruteforce
3
+ from .reporter import generate_report
4
+ from .ai import explain_attack
5
+ from .utils import normalize_ip
6
+
7
+ __all__ = [
8
+ "parse_apache_log",
9
+ "detect_bruteforce",
10
+ "generate_report",
11
+ "explain_attack",
12
+ "normalize_ip",
13
+ ]
@@ -0,0 +1,8 @@
1
+ def explain_attack(data):
2
+ return {
3
+ "attack_type": data.get("attack_type", "Brute Force"),
4
+ "risk": data.get("risk", "High"),
5
+ "mitre_attack": data.get("mitre_attack", "T1110"),
6
+ "recommendation": data.get("recommendation", ["Enable MFA", "Block IP", "Monitor Login Attempts"]),
7
+ "summary": f"Potential {data.get('attack_type', 'Brute Force').lower()} activity detected from {data.get('ip', 'unknown IP')}."
8
+ }
@@ -0,0 +1,13 @@
1
+ def detect_bruteforce(events, threshold=20):
2
+ counts = {}
3
+ for event in events:
4
+ ip = event.get("ip")
5
+ if not ip:
6
+ continue
7
+ counts[ip] = counts.get(ip, 0) + 1
8
+
9
+ suspicious = []
10
+ for ip, count in counts.items():
11
+ if count > threshold:
12
+ suspicious.append({"ip": ip, "count": count, "risk": "HIGH", "attack_type": "Brute Force"})
13
+ return suspicious
@@ -0,0 +1,11 @@
1
+ import re
2
+
3
+ IP_RE = re.compile(r"(\d{1,3}(?:\.\d{1,3}){3})")
4
+
5
+
6
+ def parse_apache_log(log_line):
7
+ match = IP_RE.search(log_line)
8
+ if not match:
9
+ return None
10
+
11
+ return {"ip": match.group(1), "raw": log_line.strip()}
@@ -0,0 +1,12 @@
1
+ def generate_report(findings):
2
+ sections = []
3
+ for item in findings:
4
+ sections.append(
5
+ f"""
6
+ IP: {item['ip']}
7
+ Attempts: {item['count']}
8
+ Risk: {item['risk']}
9
+ Attack Type: {item.get('attack_type', 'Unknown')}
10
+ """.strip()
11
+ )
12
+ return "\n\n".join(sections)
@@ -0,0 +1,2 @@
1
+ def normalize_ip(ip):
2
+ return ip.strip() if isinstance(ip, str) else ip
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: securitylogai
3
+ Version: 0.1.0
4
+ Summary: AI-powered security log analysis toolkit
5
+ Author: Isaac Talb
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/IsaacTalb/securitylogai
8
+ Project-URL: Repository, https://github.com/IsaacTalb/securitylogai
9
+ Project-URL: Issues, https://github.com/IsaacTalb/securitylogai/issues
10
+ Keywords: security,logs,ai,cybersecurity,fastapi
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Security
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Dynamic: license-file
23
+
24
+ # securitylogai
25
+
26
+ Reusable Python engine for parsing logs, detecting suspicious activity, generating reports, and producing AI explanations.
27
+
28
+ ## What it does
29
+
30
+ - Parse Apache-style logs
31
+ - Detect brute-force style patterns
32
+ - Generate readable reports
33
+ - Produce AI-ready summaries
34
+
35
+ ## Install from PyPI
36
+
37
+ ```bash
38
+ pip install securitylogai
39
+ ```
40
+
41
+ ## Install from TestPyPI
42
+
43
+ ```bash
44
+ pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple securitylogai
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ ```python
50
+ from securitylogai import parse_apache_log, detect_bruteforce, generate_report, explain_attack
51
+
52
+ log = "127.0.0.1 - - [30/May/2026:12:00:00 +0630] \"POST /login HTTP/1.1\" 401 532"
53
+ event = parse_apache_log(log)
54
+ findings = detect_bruteforce([event] * 25)
55
+ report = generate_report(findings)
56
+ summary = explain_attack(findings[0]) if findings else None
57
+ ```
58
+
59
+ ## Build and publish
60
+
61
+ ```bash
62
+ python -m pip install --upgrade build twine
63
+ python -m build
64
+ python -m twine check dist/*
65
+ python -m twine upload dist/*
66
+ ```
67
+
68
+ ## Publish to TestPyPI first
69
+
70
+ ```bash
71
+ python -m twine upload --repository testpypi dist/*
72
+ ```
73
+
74
+ ## Package structure
75
+
76
+ - `parser.py` - parse log lines
77
+ - `detector.py` - detect suspicious patterns
78
+ - `reporter.py` - create text reports
79
+ - `ai.py` - AI explanation layer
80
+ - `utils.py` - shared helpers
81
+
82
+ ## Roadmap
83
+
84
+ - add Nginx / SSH / Windows parsing
85
+ - add provider adapters for OpenAI, Gemini, Ollama
86
+ - add CLI and JSON output
87
+ - add tests and release workflow
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ securitylogai/__init__.py
5
+ securitylogai/ai.py
6
+ securitylogai/detector.py
7
+ securitylogai/parser.py
8
+ securitylogai/reporter.py
9
+ securitylogai/utils.py
10
+ securitylogai.egg-info/PKG-INFO
11
+ securitylogai.egg-info/SOURCES.txt
12
+ securitylogai.egg-info/dependency_links.txt
13
+ securitylogai.egg-info/top_level.txt
14
+ tests/test_package.py
@@ -0,0 +1 @@
1
+ securitylogai
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,17 @@
1
+ from securitylogai import parse_apache_log, detect_bruteforce, generate_report
2
+
3
+
4
+ def test_parse_apache_log_extracts_ip():
5
+ event = parse_apache_log('127.0.0.1 - - [30/May/2026:12:00:00 +0630] "POST /login HTTP/1.1" 401 532')
6
+ assert event['ip'] == '127.0.0.1'
7
+
8
+
9
+ def test_detect_bruteforce_flags_threshold():
10
+ events = [{'ip': '10.0.0.1'}] * 21
11
+ findings = detect_bruteforce(events, threshold=20)
12
+ assert findings and findings[0]['risk'] == 'HIGH'
13
+
14
+
15
+ def test_generate_report_contains_ip():
16
+ report = generate_report([{'ip': '10.0.0.1', 'count': 21, 'risk': 'HIGH', 'attack_type': 'Brute Force'}])
17
+ assert '10.0.0.1' in report