attackmap-analyzer-omeka-s 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.

Potentially problematic release.


This version of attackmap-analyzer-omeka-s might be problematic. Click here for more details.

@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matthew Davis and AttackMap Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: attackmap-analyzer-omeka-s
3
+ Version: 0.1.0
4
+ Summary: Application-aware Omeka S analyzer plugin for AttackMap
5
+ Author: AttackMap Contributors
6
+ Author-email: Matthew Davis <matthewd@matthewd.xyz>
7
+ Maintainer-email: Matthew Davis <matthewd@matthewd.xyz>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/mlaify/attack-map-analyzer-omeka-s
10
+ Project-URL: Repository, https://github.com/mlaify/attack-map-analyzer-omeka-s
11
+ Project-URL: Issues, https://github.com/mlaify/attack-map-analyzer-omeka-s/issues
12
+ Project-URL: Changelog, https://github.com/mlaify/attack-map-analyzer-omeka-s/blob/main/CHANGELOG.md
13
+ Project-URL: AttackMap core, https://github.com/mlaify/AttackMap
14
+ Keywords: security,static-analysis,appsec,defensive-security,attackmap,attackmap-plugin
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Information Technology
18
+ Classifier: Intended Audience :: System Administrators
19
+ Classifier: License :: OSI Approved :: MIT License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3 :: Only
26
+ Classifier: Topic :: Security
27
+ Classifier: Topic :: Software Development :: Quality Assurance
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.11
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: pydantic>=2.7.0
33
+ Provides-Extra: core
34
+ Requires-Dist: attackmap>=0.1.0; extra == "core"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
37
+ Requires-Dist: build>=1.2.0; extra == "dev"
38
+ Requires-Dist: attackmap>=0.1.0; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # AttackMap Omeka S Analyzer
42
+
43
+ `attackmap-analyzer-omeka-s` is an application-aware analyzer module for AttackMap.
44
+
45
+ It focuses on Omeka S and emits structured scan signals for:
46
+ - likely admin, site, and API surfaces
47
+ - route and controller hints from Laminas-style module config
48
+ - Omeka service usage (for example `Omeka\\Connection`)
49
+ - module extension points such as navigation and service manager factories
50
+
51
+ This module is intentionally heuristic and incremental.
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ pip install git+https://github.com/mlaify/attackmap-analyzer-omeka-s.git
57
+ ```
58
+
59
+ ## Usage with AttackMap
60
+
61
+ ```bash
62
+ attackmap analyze /path/to/repo --module omeka-s
63
+ ```
@@ -0,0 +1,23 @@
1
+ # AttackMap Omeka S Analyzer
2
+
3
+ `attackmap-analyzer-omeka-s` is an application-aware analyzer module for AttackMap.
4
+
5
+ It focuses on Omeka S and emits structured scan signals for:
6
+ - likely admin, site, and API surfaces
7
+ - route and controller hints from Laminas-style module config
8
+ - Omeka service usage (for example `Omeka\\Connection`)
9
+ - module extension points such as navigation and service manager factories
10
+
11
+ This module is intentionally heuristic and incremental.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ pip install git+https://github.com/mlaify/attackmap-analyzer-omeka-s.git
17
+ ```
18
+
19
+ ## Usage with AttackMap
20
+
21
+ ```bash
22
+ attackmap analyze /path/to/repo --module omeka-s
23
+ ```
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "attackmap-analyzer-omeka-s"
7
+ version = "0.1.0"
8
+ description = "Application-aware Omeka S analyzer plugin for AttackMap"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Matthew Davis", email = "matthewd@matthewd.xyz"},
14
+ {name = "AttackMap Contributors"},
15
+ ]
16
+ maintainers = [
17
+ {name = "Matthew Davis", email = "matthewd@matthewd.xyz"},
18
+ ]
19
+ keywords = [
20
+ "security",
21
+ "static-analysis",
22
+ "appsec",
23
+ "defensive-security",
24
+ "attackmap",
25
+ "attackmap-plugin",
26
+ ]
27
+ classifiers = [
28
+ "Development Status :: 4 - Beta",
29
+ "Intended Audience :: Developers",
30
+ "Intended Audience :: Information Technology",
31
+ "Intended Audience :: System Administrators",
32
+ "License :: OSI Approved :: MIT License",
33
+ "Operating System :: OS Independent",
34
+ "Programming Language :: Python :: 3",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Programming Language :: Python :: 3.12",
37
+ "Programming Language :: Python :: 3.13",
38
+ "Programming Language :: Python :: 3 :: Only",
39
+ "Topic :: Security",
40
+ "Topic :: Software Development :: Quality Assurance",
41
+ "Typing :: Typed",
42
+ ]
43
+ dependencies = [
44
+ "pydantic>=2.7.0",
45
+ ]
46
+
47
+ [project.optional-dependencies]
48
+ core = [
49
+ "attackmap>=0.1.0",
50
+ ]
51
+ dev = [
52
+ "pytest>=8.0.0",
53
+ "build>=1.2.0",
54
+ "attackmap>=0.1.0",
55
+ ]
56
+
57
+ [project.urls]
58
+ Homepage = "https://github.com/mlaify/attack-map-analyzer-omeka-s"
59
+ Repository = "https://github.com/mlaify/attack-map-analyzer-omeka-s"
60
+ Issues = "https://github.com/mlaify/attack-map-analyzer-omeka-s/issues"
61
+ Changelog = "https://github.com/mlaify/attack-map-analyzer-omeka-s/blob/main/CHANGELOG.md"
62
+ "AttackMap core" = "https://github.com/mlaify/AttackMap"
63
+
64
+ [project.entry-points."attackmap.analyzers"]
65
+ omeka_s = "attackmap_analyzer_omeka_s:OmekaSAnalyzer"
66
+
67
+ [tool.setuptools]
68
+ package-dir = {"" = "src"}
69
+
70
+ [tool.setuptools.packages.find]
71
+ where = ["src"]
72
+
73
+ [tool.pytest.ini_options]
74
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .analyzer import OmekaSAnalyzer
2
+
3
+ __all__ = ["OmekaSAnalyzer"]
@@ -0,0 +1,249 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import re
5
+ from pathlib import Path
6
+
7
+ from .contracts import AnalyzerMetadata, AuthHint, DatabaseHint, ExternalCall, Route, ScanResult, SecretHint
8
+
9
+ ROUTE_PATH_PATTERN = re.compile(r"['\"]route['\"]\s*=>\s*['\"]([^'\"]+)['\"]", re.IGNORECASE)
10
+ ROUTE_NAME_PATTERN = re.compile(r"['\"]([A-Za-z0-9_\\-]+)['\"]\s*=>\s*\[\s*['\"]type['\"]\s*=>", re.IGNORECASE)
11
+ CONTROLLER_PATTERN = re.compile(r"([A-Za-z_\\][A-Za-z0-9_\\]*Controller[A-Za-z0-9_\\]*)::class", re.IGNORECASE)
12
+ SERVICE_PATTERN = re.compile(
13
+ r"([A-Za-z_\\][A-Za-z0-9_\\]*(?:Service|Manager|Repository|Adapter|Connection)[A-Za-z0-9_\\]*)::class",
14
+ re.IGNORECASE,
15
+ )
16
+ OMEKA_SERVICE_PATTERN = re.compile(r"Omeka\\([A-Za-z_\\\\][A-Za-z0-9_\\\\]*)", re.IGNORECASE)
17
+ OUTBOUND_PATTERNS = [
18
+ re.compile(r"curl_init\s*\(\s*['\"](https?://[^'\"]+)['\"]", re.IGNORECASE),
19
+ re.compile(r"file_get_contents\s*\(\s*['\"](https?://[^'\"]+)['\"]", re.IGNORECASE),
20
+ re.compile(r"->(?:get|post|put|patch|delete|request)\s*\(\s*['\"](https?://[^'\"]+)['\"]", re.IGNORECASE),
21
+ ]
22
+ SECRET_PATTERNS = [
23
+ re.compile(r"getenv\s*\(\s*['\"]([A-Z0-9_]*(SECRET|TOKEN|KEY|PASSWORD|API|DB)[A-Z0-9_]*)['\"]", re.IGNORECASE),
24
+ re.compile(r"\$_ENV\s*\[\s*['\"]([A-Z0-9_]*(SECRET|TOKEN|KEY|PASSWORD|API|DB)[A-Z0-9_]*)['\"]\s*\]", re.IGNORECASE),
25
+ ]
26
+
27
+
28
+ class OmekaSAnalyzer:
29
+ metadata = AnalyzerMetadata(
30
+ name="omeka-s",
31
+ display_name="Omeka S Analyzer",
32
+ version="0.1.0",
33
+ description="Application-aware Omeka S analyzer for Laminas module config, services, and extension surfaces.",
34
+ scope="Omeka S and Omeka-style Laminas MVC projects with module config-driven routes and services.",
35
+ targets=["omeka-s", "php-laminas", "php-web"],
36
+ languages=["php"],
37
+ priority=20,
38
+ experimental=True,
39
+ enabled_by_default=False,
40
+ )
41
+
42
+ @property
43
+ def name(self) -> str:
44
+ return self.metadata.name
45
+
46
+ def detect(self, repo_path: str | Path) -> bool:
47
+ root = Path(repo_path).resolve()
48
+ if not root.exists() or not root.is_dir():
49
+ return False
50
+
51
+ if self._has_omeka_composer_signals(root / "composer.json"):
52
+ return True
53
+
54
+ if (root / "config" / "application.config.php").exists() and any(root.rglob("module.config.php")):
55
+ if (root / "module").is_dir():
56
+ return True
57
+
58
+ for file_path in root.rglob("*.php"):
59
+ if any(part in {"vendor", ".git", "node_modules"} for part in file_path.parts):
60
+ continue
61
+ content = self._read_text(file_path)
62
+ if content and ("namespace Omeka" in content or "Omeka\\Connection" in content):
63
+ return True
64
+ return False
65
+
66
+ def analyze(self, repo_path: str | Path) -> ScanResult:
67
+ root = Path(repo_path).resolve()
68
+ result = ScanResult(root=str(root))
69
+ if not root.exists() or not root.is_dir():
70
+ return result
71
+
72
+ composer_path = root / "composer.json"
73
+ if composer_path.exists():
74
+ self._extract_composer_signals(composer_path, result)
75
+
76
+ for file_path in root.rglob("*.php"):
77
+ if not file_path.is_file():
78
+ continue
79
+ if any(part in {"vendor", ".git", "node_modules"} for part in file_path.parts):
80
+ continue
81
+
82
+ result.files_scanned += 1
83
+ if "php" not in result.languages:
84
+ result.languages.append("php")
85
+
86
+ content = self._read_text(file_path)
87
+ if content is None:
88
+ continue
89
+
90
+ relative = str(file_path.relative_to(root))
91
+ self._extract_routes_and_surfaces(content, relative, result)
92
+ self._extract_controllers_and_services(content, relative, result)
93
+ self._extract_extension_points(content, relative, result)
94
+ self._extract_external_calls(content, relative, result)
95
+ self._extract_datastores(content, relative, result)
96
+ self._extract_secret_hints(content, relative, result)
97
+
98
+ result.languages.sort()
99
+ return result
100
+
101
+ def _has_omeka_composer_signals(self, composer_path: Path) -> bool:
102
+ if not composer_path.exists():
103
+ return False
104
+ try:
105
+ data = json.loads(composer_path.read_text(encoding="utf-8"))
106
+ except (UnicodeDecodeError, json.JSONDecodeError):
107
+ return False
108
+
109
+ requirements = {
110
+ **(data.get("require", {}) if isinstance(data.get("require", {}), dict) else {}),
111
+ **(data.get("require-dev", {}) if isinstance(data.get("require-dev", {}), dict) else {}),
112
+ }
113
+ for package in requirements:
114
+ lowered = package.lower()
115
+ if lowered.startswith("omeka/") or lowered == "omeka-s":
116
+ return True
117
+ return False
118
+
119
+ def _extract_composer_signals(self, composer_path: Path, result: ScanResult) -> None:
120
+ try:
121
+ data = json.loads(composer_path.read_text(encoding="utf-8"))
122
+ except (UnicodeDecodeError, json.JSONDecodeError):
123
+ return
124
+
125
+ requirements = {
126
+ **(data.get("require", {}) if isinstance(data.get("require", {}), dict) else {}),
127
+ **(data.get("require-dev", {}) if isinstance(data.get("require-dev", {}), dict) else {}),
128
+ }
129
+ for package in requirements:
130
+ lowered = package.lower()
131
+ if lowered.startswith("omeka/") or lowered == "omeka-s":
132
+ self._append_unique_auth(result, "omeka_dependency", "composer.json")
133
+ if lowered.startswith("laminas/") or lowered.startswith("zendframework/"):
134
+ self._append_unique_auth(result, "laminas_dependency", "composer.json")
135
+ if "doctrine" in lowered:
136
+ self._append_unique_database(result, "sql", "composer.json")
137
+
138
+ def _extract_routes_and_surfaces(self, content: str, relative: str, result: ScanResult) -> None:
139
+ for match in ROUTE_PATH_PATTERN.finditer(content):
140
+ path = match.group(1)
141
+ self._append_unique_route(result, path, "ANY", relative)
142
+ self._append_surface_hint_for_path(result, path, relative)
143
+
144
+ for match in ROUTE_NAME_PATTERN.finditer(content):
145
+ route_name = match.group(1).lower()
146
+ if "admin" in route_name:
147
+ self._append_unique_auth(result, "omeka_surface:admin", relative)
148
+ elif "api" in route_name:
149
+ self._append_unique_auth(result, "omeka_surface:api", relative)
150
+ elif "site" in route_name:
151
+ self._append_unique_auth(result, "omeka_surface:site", relative)
152
+
153
+ def _extract_controllers_and_services(self, content: str, relative: str, result: ScanResult) -> None:
154
+ found_controller = False
155
+ for match in CONTROLLER_PATTERN.finditer(content):
156
+ found_controller = True
157
+ self._append_unique_auth(result, f"controller:{match.group(1)}", relative)
158
+ if found_controller:
159
+ self._append_unique_auth(result, "laminas_controller_mapping", relative)
160
+
161
+ for match in SERVICE_PATTERN.finditer(content):
162
+ service_name = match.group(1)
163
+ self._append_unique_auth(result, f"service:{service_name}", relative)
164
+ if "Connection" in service_name:
165
+ self._append_unique_database(result, "sql", relative)
166
+
167
+ for match in OMEKA_SERVICE_PATTERN.finditer(content):
168
+ service_name = match.group(1)
169
+ self._append_unique_auth(result, f"omeka_service:{service_name}", relative)
170
+ if service_name.lower().endswith("connection"):
171
+ self._append_unique_database(result, "sql", relative)
172
+
173
+ def _extract_extension_points(self, content: str, relative: str, result: ScanResult) -> None:
174
+ lowered = content.lower()
175
+ if "'service_manager'" in lowered or '"service_manager"' in lowered:
176
+ self._append_unique_auth(result, "omeka_extension:service_manager", relative)
177
+ if "'factories'" in lowered or '"factories"' in lowered:
178
+ self._append_unique_auth(result, "omeka_extension:factory", relative)
179
+ if "'navigation'" in lowered or '"navigation"' in lowered:
180
+ self._append_unique_auth(result, "omeka_extension:navigation", relative)
181
+ normalized = relative.replace("\\", "/")
182
+ if "/module/" in f"/{normalized}/":
183
+ self._append_unique_auth(result, "omeka_extension:module", relative)
184
+
185
+ def _extract_external_calls(self, content: str, relative: str, result: ScanResult) -> None:
186
+ for pattern in OUTBOUND_PATTERNS:
187
+ for match in pattern.finditer(content):
188
+ self._append_unique_external(result, match.group(1), relative)
189
+
190
+ def _extract_datastores(self, content: str, relative: str, result: ScanResult) -> None:
191
+ lowered = content.lower()
192
+ if "omeka\\connection" in lowered or "new pdo(" in lowered or "doctrine" in lowered:
193
+ self._append_unique_database(result, "sql", relative)
194
+
195
+ def _extract_secret_hints(self, content: str, relative: str, result: ScanResult) -> None:
196
+ for pattern in SECRET_PATTERNS:
197
+ for match in pattern.finditer(content):
198
+ self._append_unique_secret(result, match.group(1), relative)
199
+
200
+ def _append_surface_hint_for_path(self, result: ScanResult, path: str, relative: str) -> None:
201
+ lowered = path.lower()
202
+ if lowered.startswith("/admin") or "/admin/" in lowered:
203
+ self._append_unique_auth(result, "omeka_surface:admin", relative)
204
+ elif lowered.startswith("/api") or "/api/" in lowered:
205
+ self._append_unique_auth(result, "omeka_surface:api", relative)
206
+ elif lowered.startswith("/s/") or lowered.startswith("/site"):
207
+ self._append_unique_auth(result, "omeka_surface:site", relative)
208
+
209
+ @staticmethod
210
+ def _read_text(path: Path) -> str | None:
211
+ try:
212
+ return path.read_text(encoding="utf-8")
213
+ except UnicodeDecodeError:
214
+ return None
215
+
216
+ @staticmethod
217
+ def _append_unique_route(result: ScanResult, path: str, method: str, file: str) -> None:
218
+ key = (path, method, file)
219
+ if any((item.path, item.method, item.file) == key for item in result.routes):
220
+ return
221
+ result.routes.append(Route(path=path, method=method, file=file))
222
+
223
+ @staticmethod
224
+ def _append_unique_external(result: ScanResult, target: str, file: str) -> None:
225
+ key = (target, file)
226
+ if any((item.target, item.file) == key for item in result.external_calls):
227
+ return
228
+ result.external_calls.append(ExternalCall(target=target, file=file))
229
+
230
+ @staticmethod
231
+ def _append_unique_database(result: ScanResult, kind: str, file: str) -> None:
232
+ key = (kind, file)
233
+ if any((item.kind, item.file) == key for item in result.databases):
234
+ return
235
+ result.databases.append(DatabaseHint(kind=kind, file=file))
236
+
237
+ @staticmethod
238
+ def _append_unique_auth(result: ScanResult, hint: str, file: str) -> None:
239
+ key = (hint, file)
240
+ if any((item.hint, item.file) == key for item in result.auth_hints):
241
+ return
242
+ result.auth_hints.append(AuthHint(hint=hint, file=file))
243
+
244
+ @staticmethod
245
+ def _append_unique_secret(result: ScanResult, name: str, file: str) -> None:
246
+ key = (name, file)
247
+ if any((item.name, item.file) == key for item in result.secret_hints):
248
+ return
249
+ result.secret_hints.append(SecretHint(name=name, file=file))
@@ -0,0 +1,18 @@
1
+ from __future__ import annotations
2
+
3
+ from attackmap.sdk.contracts import AnalyzerMetadata, AnalyzerProtocol
4
+ from attackmap.sdk.models import AuthHint, DatabaseHint, ExternalCall, Route, ScanResult, SecretHint
5
+
6
+ # Compatibility alias used by existing analyzer implementations.
7
+ AttackMapAnalyzerProtocol = AnalyzerProtocol
8
+
9
+ __all__ = [
10
+ "AnalyzerMetadata",
11
+ "AttackMapAnalyzerProtocol",
12
+ "Route",
13
+ "ExternalCall",
14
+ "DatabaseHint",
15
+ "AuthHint",
16
+ "SecretHint",
17
+ "ScanResult",
18
+ ]
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: attackmap-analyzer-omeka-s
3
+ Version: 0.1.0
4
+ Summary: Application-aware Omeka S analyzer plugin for AttackMap
5
+ Author: AttackMap Contributors
6
+ Author-email: Matthew Davis <matthewd@matthewd.xyz>
7
+ Maintainer-email: Matthew Davis <matthewd@matthewd.xyz>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/mlaify/attack-map-analyzer-omeka-s
10
+ Project-URL: Repository, https://github.com/mlaify/attack-map-analyzer-omeka-s
11
+ Project-URL: Issues, https://github.com/mlaify/attack-map-analyzer-omeka-s/issues
12
+ Project-URL: Changelog, https://github.com/mlaify/attack-map-analyzer-omeka-s/blob/main/CHANGELOG.md
13
+ Project-URL: AttackMap core, https://github.com/mlaify/AttackMap
14
+ Keywords: security,static-analysis,appsec,defensive-security,attackmap,attackmap-plugin
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Information Technology
18
+ Classifier: Intended Audience :: System Administrators
19
+ Classifier: License :: OSI Approved :: MIT License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3 :: Only
26
+ Classifier: Topic :: Security
27
+ Classifier: Topic :: Software Development :: Quality Assurance
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.11
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: pydantic>=2.7.0
33
+ Provides-Extra: core
34
+ Requires-Dist: attackmap>=0.1.0; extra == "core"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
37
+ Requires-Dist: build>=1.2.0; extra == "dev"
38
+ Requires-Dist: attackmap>=0.1.0; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # AttackMap Omeka S Analyzer
42
+
43
+ `attackmap-analyzer-omeka-s` is an application-aware analyzer module for AttackMap.
44
+
45
+ It focuses on Omeka S and emits structured scan signals for:
46
+ - likely admin, site, and API surfaces
47
+ - route and controller hints from Laminas-style module config
48
+ - Omeka service usage (for example `Omeka\\Connection`)
49
+ - module extension points such as navigation and service manager factories
50
+
51
+ This module is intentionally heuristic and incremental.
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ pip install git+https://github.com/mlaify/attackmap-analyzer-omeka-s.git
57
+ ```
58
+
59
+ ## Usage with AttackMap
60
+
61
+ ```bash
62
+ attackmap analyze /path/to/repo --module omeka-s
63
+ ```
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/attackmap_analyzer_omeka_s/__init__.py
5
+ src/attackmap_analyzer_omeka_s/analyzer.py
6
+ src/attackmap_analyzer_omeka_s/contracts.py
7
+ src/attackmap_analyzer_omeka_s.egg-info/PKG-INFO
8
+ src/attackmap_analyzer_omeka_s.egg-info/SOURCES.txt
9
+ src/attackmap_analyzer_omeka_s.egg-info/dependency_links.txt
10
+ src/attackmap_analyzer_omeka_s.egg-info/entry_points.txt
11
+ src/attackmap_analyzer_omeka_s.egg-info/requires.txt
12
+ src/attackmap_analyzer_omeka_s.egg-info/top_level.txt
13
+ tests/test_omeka_s_analyzer.py
@@ -0,0 +1,2 @@
1
+ [attackmap.analyzers]
2
+ omeka_s = attackmap_analyzer_omeka_s:OmekaSAnalyzer
@@ -0,0 +1,9 @@
1
+ pydantic>=2.7.0
2
+
3
+ [core]
4
+ attackmap>=0.1.0
5
+
6
+ [dev]
7
+ pytest>=8.0.0
8
+ build>=1.2.0
9
+ attackmap>=0.1.0
@@ -0,0 +1,72 @@
1
+ from pathlib import Path
2
+
3
+ from attackmap.sdk.contracts import AnalyzerMetadata as SharedAnalyzerMetadata
4
+ from attackmap.sdk.models import ScanResult as SharedScanResult
5
+ from attackmap_analyzer_omeka_s.contracts import AnalyzerMetadata, ScanResult
6
+ from attackmap_analyzer_omeka_s import OmekaSAnalyzer
7
+
8
+ FIXTURES = Path(__file__).parent / "fixtures"
9
+
10
+
11
+ def test_contracts_use_shared_sdk_types() -> None:
12
+ assert AnalyzerMetadata is SharedAnalyzerMetadata
13
+ assert ScanResult is SharedScanResult
14
+
15
+
16
+ def test_metadata_contains_required_fields() -> None:
17
+ analyzer = OmekaSAnalyzer()
18
+ metadata = analyzer.metadata
19
+
20
+ assert metadata.name == "omeka-s"
21
+ assert metadata.display_name == "Omeka S Analyzer"
22
+ assert metadata.version == "0.1.0"
23
+ assert metadata.description
24
+ assert metadata.scope
25
+ assert metadata.targets
26
+ assert metadata.languages == ["php"]
27
+ assert metadata.experimental is True
28
+
29
+
30
+ def test_detect_identifies_omeka_s_project() -> None:
31
+ analyzer = OmekaSAnalyzer()
32
+ assert analyzer.detect(FIXTURES / "omeka_s_app") is True
33
+
34
+
35
+ def test_analyze_extracts_omeka_surfaces_and_services() -> None:
36
+ analyzer = OmekaSAnalyzer()
37
+ result = analyzer.analyze(FIXTURES / "omeka_s_app")
38
+
39
+ route_paths = {route.path for route in result.routes}
40
+ auth_hints = {hint.hint for hint in result.auth_hints}
41
+ external_targets = {call.target for call in result.external_calls}
42
+ database_kinds = {hint.kind for hint in result.databases}
43
+
44
+ assert "/admin" in route_paths
45
+ assert "/api" in route_paths
46
+ assert "/s/:site-slug" in route_paths
47
+
48
+ assert "omeka_surface:admin" in auth_hints
49
+ assert "omeka_surface:api" in auth_hints
50
+ assert "omeka_surface:site" in auth_hints
51
+ assert "omeka_extension:service_manager" in auth_hints
52
+ assert "omeka_extension:navigation" in auth_hints
53
+ assert any(hint.startswith("controller:Application\\Controller\\") for hint in auth_hints)
54
+ assert any(hint.startswith("service:Omeka\\Connection") for hint in auth_hints)
55
+ assert any(hint.startswith("omeka_service:Connection") for hint in auth_hints)
56
+
57
+ assert "sql" in database_kinds
58
+ assert "https://collector.example.net/ingest" in external_targets
59
+
60
+
61
+ def test_analyze_returns_core_compatible_scan_shape() -> None:
62
+ analyzer = OmekaSAnalyzer()
63
+ result = analyzer.analyze(FIXTURES / "omeka_s_app")
64
+
65
+ assert isinstance(result.root, str)
66
+ assert isinstance(result.files_scanned, int)
67
+ assert isinstance(result.languages, list)
68
+ assert hasattr(result, "routes")
69
+ assert hasattr(result, "external_calls")
70
+ assert hasattr(result, "databases")
71
+ assert hasattr(result, "auth_hints")
72
+ assert hasattr(result, "secret_hints")