Skip to content

Commit

Permalink
Updated Connectors based on T1 API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMcGrath committed Jan 21, 2025
1 parent c637a54 commit 4c53567
Show file tree
Hide file tree
Showing 13 changed files with 556 additions and 547 deletions.
2 changes: 1 addition & 1 deletion base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
FROM python:3.12-alpine AS connector-base

ARG UV_SYSTEM_PYTHON=true
RUN pip install uv && uv pip install "tenint==0.9.0"
RUN pip install uv && uv pip install "tenint==0.9.2"


# Connector Build Stage
Expand Down
8 changes: 4 additions & 4 deletions connectors/crowdstrike2tone/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "crowdstrike2tone"
version = "0.9.1"
version = "0.9.2"
description = "Crowdstrike -> Tenable One"
readme = "README.md"
requires-python = ">=3.12"
Expand Down Expand Up @@ -34,8 +34,6 @@ title = "CrowdStrike to Tenable One"
tags = ["crowdstrike", "tvm"]
timeout = 3600

[tool.tenint.connector.images]
amd64 = "gitea.tenalab.online/tif/connector-crowdstrike2tone"

[tool.uv]
dev-dependencies = [
Expand All @@ -55,7 +53,8 @@ exclude = [
".github",
".git",
".pytest_cache",
"__pycache__"
"__pycache__",
".venv",
]

[tool.ruff.lint]
Expand All @@ -78,6 +77,7 @@ docstring-code-line-length = "dynamic"
pythonpath = ["."]
testpaths = ["tests"]
addopts = "--cov=crowdstrike --cov-report=term-missing"
filterwarnings = ["ignore::DeprecationWarning"]

[tool.bandit]
exclude_dirs = ["tests", ".venv"]
Expand Down
510 changes: 255 additions & 255 deletions connectors/crowdstrike2tone/uv.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions connectors/msdefender2tone/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "msdefender2tone"
version = "0.9.0"
version = "0.9.2"
description = "MS Defender to Tenable One"
authors = [
{name = "Tenable, Inc", email = "[email protected]"},
Expand Down Expand Up @@ -34,9 +34,6 @@ title = "Microsoft Defender to Tenable One"
tags = ["msdefender", "tvm"]
timeout = 3600

[tool.tenint.connector.images]
amd64 = "gitea.tenalab.online/tif/connector-msdefender2tone"

[tool.uv]
dev-dependencies = [
"ptpython>=3.0.29",
Expand Down Expand Up @@ -82,6 +79,7 @@ docstring-code-line-length = "dynamic"
pythonpath = ["."]
testpaths = ["tests"]
addopts = "--cov=msdefender --cov-report=term-missing"
filterwarnings = ["ignore::DeprecationWarning"]

[tool.bandit]
exclude_dirs = ["tests", ".venv"]
Expand Down
12 changes: 6 additions & 6 deletions connectors/msdefender2tone/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion connectors/qualys2tone/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "qualys2tone"
version = "0.9.1"
version = "0.9.2"
description = "Qualys VM to Tenable One"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -82,6 +82,7 @@ docstring-code-line-length = "dynamic"
pythonpath = ["."]
testpaths = ["tests"]
addopts = "--cov=qualys --cov-report=term-missing"
filterwarnings = ["ignore::DeprecationWarning"]

[tool.bandit]
exclude_dirs = ["tests", ".venv"]
10 changes: 6 additions & 4 deletions connectors/qualys2tone/qualys/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def transform_finding(
self,
data: dict[str, Any],
asset_id: int,
max_cves: int = 128,
max_cves: int = 512,
) -> dict[str, Any]:
"""
Converts the raw Qualys finding into a T1-compatable cve-finding.
Expand All @@ -119,13 +119,13 @@ def transform_finding(
.one()
)
if len(kb.cves) == 0:
self.log.info(
self.log.debug(
'Dropping asset=%s, finding=%s as there are no known cves.'
% (data['id'], asset_id)
)
return {}
elif len(kb.cves) > max_cves:
self.log.info(
self.log.debug(
'Truncating the first %s of %s cves for qid=%s due to T1 API restrictions.'
% (max_cves, len(kb.cves), data['qid'])
)
Expand Down Expand Up @@ -178,7 +178,9 @@ def transform_asset(self, data: dict[str, Any]) -> dict[str, Any]:
external_ids = []
for key in ('asset_id', 'qg_hostid'):
if data.get(key):
external_ids.append({'qualifier': key, 'value': str(data.get(key))})
external_ids.append(
{'qualifier': key.replace('_', '-'), 'value': str(data.get(key))}
)
return {
'object_type': 'device-asset',
'asset_class': 'DEVICE',
Expand Down
4 changes: 2 additions & 2 deletions connectors/qualys2tone/tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def test_asset_transformer(transformer):
'operating_system': {'type': 'WINDOWS'},
},
'external_ids': [
{'qualifier': 'asset_id', 'value': '12345'},
{'qualifier': 'qg_hostid', 'value': '3cde24a7-aabb-ccdd-eeff-001122334455'},
{'qualifier': 'asset-id', 'value': '12345'},
{'qualifier': 'qg-hostid', 'value': '3cde24a7-aabb-ccdd-eeff-001122334455'},
],
'discovery': {
'authentication': {
Expand Down
Loading

0 comments on commit 4c53567

Please sign in to comment.