howler-sentinel-plugin 0.2.0.dev98__tar.gz → 0.2.0.dev100__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.
Files changed (16) hide show
  1. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/PKG-INFO +1 -1
  2. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/pyproject.toml +1 -1
  3. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/actions/azure_emit_hash.py +19 -3
  4. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/actions/send_to_sentinel.py +4 -3
  5. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/actions/update_defender_xdr_alert.py +4 -3
  6. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/mapping/sentinel_incident.py +1 -1
  7. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/LICENSE +0 -0
  8. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/README.md +0 -0
  9. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/__init__.py +0 -0
  10. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/mapping/xdr_alert.py +0 -0
  11. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/mapping/xdr_alert_evidence.py +0 -0
  12. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/odm/hit.py +0 -0
  13. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/odm/models/sentinel.py +0 -0
  14. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/routes/__init__.py +0 -0
  15. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/routes/ingest.py +0 -0
  16. {howler_sentinel_plugin-0.2.0.dev98 → howler_sentinel_plugin-0.2.0.dev100}/sentinel/utils/tenant_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: howler-sentinel-plugin
3
- Version: 0.2.0.dev98
3
+ Version: 0.2.0.dev100
4
4
  Summary: A howler plugin for integration with Microsoft's Sentinel API
5
5
  License: MIT
6
6
  Author: CCCS
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "howler-sentinel-plugin"
3
- version = "0.2.0.dev98"
3
+ version = "0.2.0.dev100"
4
4
  description = "A howler plugin for integration with Microsoft's Sentinel API"
5
5
  authors = [{ name = "CCCS", email = "analysis-development@cyber.gc.ca" }]
6
6
  license = { text = "MIT" }
@@ -1,4 +1,5 @@
1
1
  import os
2
+ from typing import Optional
2
3
 
3
4
  import requests
4
5
  from howler.common.loader import datastore
@@ -9,11 +10,26 @@ from pydash import get
9
10
  OPERATION_ID = "azure_emit_hash"
10
11
 
11
12
 
12
- def execute(query: str, field: str = "file.hash.sha256", **kwargs):
13
+ def execute(
14
+ query: str,
15
+ url: Optional[str] = os.environ.get("SHA256_LOGIC_APP_URL", None),
16
+ field: str = "file.hash.sha256",
17
+ **kwargs,
18
+ ):
13
19
  "Emit hashes to sentinel"
14
20
  result = datastore().hit.search(query, rows=1)
15
21
  hits = result["items"]
16
22
 
23
+ if not url:
24
+ return [
25
+ {
26
+ "query": query,
27
+ "outcome": "error",
28
+ "title": "Action is not properly configured",
29
+ "message": "url argument cannot be empty.",
30
+ }
31
+ ]
32
+
17
33
  if len(hits) < 1:
18
34
  return [
19
35
  {
@@ -41,7 +57,7 @@ def execute(query: str, field: str = "file.hash.sha256", **kwargs):
41
57
  hash_value = get(hit, field)
42
58
  if hash_value:
43
59
  requests.post(
44
- os.environ["SHA256_LOGIC_APP_URL"], # noqa: F821
60
+ url, # noqa: F821
45
61
  json={
46
62
  "indicator": hash_value,
47
63
  "type": "FileSha256",
@@ -76,7 +92,7 @@ def specification():
76
92
  "roles": ["automation_basic"],
77
93
  "steps": [
78
94
  {
79
- "args": {"field": []},
95
+ "args": {"url": [], "field": []},
80
96
  "options": {"field": [field for field in Hit.flat_fields().keys() if field.endswith("sha256")]},
81
97
  }
82
98
  ],
@@ -34,10 +34,11 @@ def execute(query: str, **kwargs):
34
34
  return report
35
35
 
36
36
  for hit in hits:
37
- tenant_id = hit.azure.tenant_id
38
- if not tenant_id and hit.organization.id:
37
+ if hit.azure and hit.azure.tenant_id:
38
+ tenant_id = hit.azure.tenant_id
39
+ elif hit.organization.id:
39
40
  tenant_id = hit.organization.id
40
- elif not tenant_id:
41
+ else:
41
42
  report.append(
42
43
  {
43
44
  "query": f"howler.id:{hit.howler.id}",
@@ -73,10 +73,11 @@ def execute(query: str, **kwargs):
73
73
  return report
74
74
 
75
75
  for hit in hits:
76
- tenant_id = hit.azure.tenant_id
77
- if not tenant_id and hit.organization.id:
76
+ if hit.azure and hit.azure.tenant_id:
77
+ tenant_id = hit.azure.tenant_id
78
+ elif hit.organization.id:
78
79
  tenant_id = hit.organization.id
79
- elif not tenant_id:
80
+ else:
80
81
  report.append(
81
82
  {
82
83
  "query": f"howler.id:{hit.howler.id}",
@@ -76,7 +76,7 @@ class SentinelIncident:
76
76
  "score": self.map_severity_to_score(severity),
77
77
  "outline.summary": description,
78
78
  "rationale": resolving_comment,
79
- "analytic": "MSGraph",
79
+ "analytic": "Sentinel",
80
80
  "is_bundle": True,
81
81
  "bundle_size": 0,
82
82
  "hits": [],