cartography 0.100.0rc2__py3-none-any.whl → 0.100.0rc4__py3-none-any.whl
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 cartography might be problematic. Click here for more details.
- cartography/_version.py +1 -1
- cartography/intel/aws/ec2/launch_templates.py +19 -32
- cartography/intel/aws/ecr.py +13 -5
- cartography/intel/cve/feed.py +13 -13
- {cartography-0.100.0rc2.dist-info → cartography-0.100.0rc4.dist-info}/METADATA +3 -3
- {cartography-0.100.0rc2.dist-info → cartography-0.100.0rc4.dist-info}/RECORD +10 -10
- {cartography-0.100.0rc2.dist-info → cartography-0.100.0rc4.dist-info}/WHEEL +1 -1
- {cartography-0.100.0rc2.dist-info → cartography-0.100.0rc4.dist-info}/LICENSE +0 -0
- {cartography-0.100.0rc2.dist-info → cartography-0.100.0rc4.dist-info}/entry_points.txt +0 -0
- {cartography-0.100.0rc2.dist-info → cartography-0.100.0rc4.dist-info}/top_level.txt +0 -0
cartography/_version.py
CHANGED
|
@@ -3,7 +3,6 @@ from typing import Any
|
|
|
3
3
|
|
|
4
4
|
import boto3
|
|
5
5
|
import neo4j
|
|
6
|
-
from botocore.exceptions import ClientError
|
|
7
6
|
|
|
8
7
|
from .util import get_botocore_config
|
|
9
8
|
from cartography.client.core.tx import load
|
|
@@ -21,27 +20,29 @@ logger = logging.getLogger(__name__)
|
|
|
21
20
|
def get_launch_templates(
|
|
22
21
|
boto3_session: boto3.session.Session,
|
|
23
22
|
region: str,
|
|
24
|
-
) ->
|
|
23
|
+
) -> list[dict[str, Any]]:
|
|
25
24
|
client = boto3_session.client('ec2', region_name=region, config=get_botocore_config())
|
|
26
25
|
paginator = client.get_paginator('describe_launch_templates')
|
|
27
26
|
templates: list[dict[str, Any]] = []
|
|
28
|
-
template_versions: list[dict[str, Any]] = []
|
|
29
27
|
for page in paginator.paginate():
|
|
30
28
|
paginated_templates = page['LaunchTemplates']
|
|
31
|
-
for template in paginated_templates:
|
|
32
|
-
template_id = template['LaunchTemplateId']
|
|
33
|
-
try:
|
|
34
|
-
versions = get_launch_template_versions_by_template(boto3_session, template_id, region)
|
|
35
|
-
except ClientError as e:
|
|
36
|
-
logger.warning(
|
|
37
|
-
f"Failed to get launch template versions for {template_id}: {e}",
|
|
38
|
-
exc_info=True,
|
|
39
|
-
)
|
|
40
|
-
versions = []
|
|
41
|
-
# Using a key not defined in latest boto3 documentation
|
|
42
|
-
template_versions.extend(versions)
|
|
43
29
|
templates.extend(paginated_templates)
|
|
44
|
-
return templates
|
|
30
|
+
return templates
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@timeit
|
|
34
|
+
@aws_handle_regions
|
|
35
|
+
def get_launch_template_versions(
|
|
36
|
+
boto3_session: boto3.session.Session,
|
|
37
|
+
region: str,
|
|
38
|
+
) -> list[dict[str, Any]]:
|
|
39
|
+
client = boto3_session.client('ec2', region_name=region, config=get_botocore_config())
|
|
40
|
+
paginator = client.get_paginator('describe_launch_template_versions')
|
|
41
|
+
template_versions: list[dict[str, Any]] = []
|
|
42
|
+
for page in paginator.paginate():
|
|
43
|
+
paginated_versions = page['LaunchTemplateVersions']
|
|
44
|
+
template_versions.extend(paginated_versions)
|
|
45
|
+
return template_versions
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
def transform_launch_templates(templates: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
@@ -71,21 +72,6 @@ def load_launch_templates(
|
|
|
71
72
|
)
|
|
72
73
|
|
|
73
74
|
|
|
74
|
-
@timeit
|
|
75
|
-
@aws_handle_regions
|
|
76
|
-
def get_launch_template_versions_by_template(
|
|
77
|
-
boto3_session: boto3.session.Session,
|
|
78
|
-
template: str,
|
|
79
|
-
region: str,
|
|
80
|
-
) -> list[dict[str, Any]]:
|
|
81
|
-
client = boto3_session.client('ec2', region_name=region, config=get_botocore_config())
|
|
82
|
-
v_paginator = client.get_paginator('describe_launch_template_versions')
|
|
83
|
-
template_versions = []
|
|
84
|
-
for versions in v_paginator.paginate(LaunchTemplateId=template):
|
|
85
|
-
template_versions.extend(versions['LaunchTemplateVersions'])
|
|
86
|
-
return template_versions
|
|
87
|
-
|
|
88
|
-
|
|
89
75
|
def transform_launch_template_versions(versions: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
90
76
|
result: list[dict[str, Any]] = []
|
|
91
77
|
for version in versions:
|
|
@@ -153,7 +139,8 @@ def sync_ec2_launch_templates(
|
|
|
153
139
|
) -> None:
|
|
154
140
|
for region in regions:
|
|
155
141
|
logger.info(f"Syncing launch templates for region '{region}' in account '{current_aws_account_id}'.")
|
|
156
|
-
templates
|
|
142
|
+
templates = get_launch_templates(boto3_session, region)
|
|
143
|
+
versions = get_launch_template_versions(boto3_session, region)
|
|
157
144
|
templates = transform_launch_templates(templates)
|
|
158
145
|
load_launch_templates(neo4j_session, templates, region, current_aws_account_id, update_tag)
|
|
159
146
|
versions = transform_launch_template_versions(versions)
|
cartography/intel/aws/ecr.py
CHANGED
|
@@ -33,13 +33,21 @@ def get_ecr_repositories(boto3_session: boto3.session.Session, region: str) -> L
|
|
|
33
33
|
def get_ecr_repository_images(boto3_session: boto3.session.Session, region: str, repository_name: str) -> List[Dict]:
|
|
34
34
|
logger.debug("Getting ECR images in repository '%s' for region '%s'.", repository_name, region)
|
|
35
35
|
client = boto3_session.client('ecr', region_name=region)
|
|
36
|
-
|
|
36
|
+
list_paginator = client.get_paginator('list_images')
|
|
37
37
|
ecr_repository_images: List[Dict] = []
|
|
38
|
-
for page in
|
|
38
|
+
for page in list_paginator.paginate(repositoryName=repository_name):
|
|
39
39
|
image_ids = page['imageIds']
|
|
40
|
-
if image_ids:
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if not image_ids:
|
|
41
|
+
continue
|
|
42
|
+
describe_paginator = client.get_paginator('describe_images')
|
|
43
|
+
describe_response = describe_paginator.paginate(repositoryName=repository_name, imageIds=image_ids)
|
|
44
|
+
for response in describe_response:
|
|
45
|
+
image_details = response['imageDetails']
|
|
46
|
+
image_details = [
|
|
47
|
+
{**detail, 'imageTag': detail['imageTags'][0]} if detail.get('imageTags') else detail
|
|
48
|
+
for detail in image_details
|
|
49
|
+
]
|
|
50
|
+
ecr_repository_images.extend(image_details)
|
|
43
51
|
return ecr_repository_images
|
|
44
52
|
|
|
45
53
|
|
cartography/intel/cve/feed.py
CHANGED
|
@@ -212,19 +212,19 @@ def transform_cves(cve_json: Dict[Any, Any]) -> List[Dict[Any, Any]]:
|
|
|
212
212
|
if cvss31:
|
|
213
213
|
cvss31.update(cvss31["cvssData"])
|
|
214
214
|
cvss31.pop("cvssData")
|
|
215
|
-
cve["vectorString"] = cvss31
|
|
216
|
-
cve["attackVector"] = cvss31
|
|
217
|
-
cve["attackComplexity"] = cvss31
|
|
218
|
-
cve["privilegesRequired"] = cvss31
|
|
219
|
-
cve["userInteraction"] = cvss31
|
|
220
|
-
cve["scope"] = cvss31
|
|
221
|
-
cve["confidentialityImpact"] = cvss31
|
|
222
|
-
cve["integrityImpact"] = cvss31
|
|
223
|
-
cve["availabilityImpact"] = cvss31
|
|
224
|
-
cve["baseScore"] = cvss31
|
|
225
|
-
cve["baseSeverity"] = cvss31
|
|
226
|
-
cve["exploitabilityScore"] = cvss31
|
|
227
|
-
cve["impactScore"] = cvss31
|
|
215
|
+
cve["vectorString"] = cvss31.get("vectorString")
|
|
216
|
+
cve["attackVector"] = cvss31.get("attackVector")
|
|
217
|
+
cve["attackComplexity"] = cvss31.get("attackComplexity")
|
|
218
|
+
cve["privilegesRequired"] = cvss31.get("privilegesRequired")
|
|
219
|
+
cve["userInteraction"] = cvss31.get("userInteraction")
|
|
220
|
+
cve["scope"] = cvss31.get("scope")
|
|
221
|
+
cve["confidentialityImpact"] = cvss31.get("confidentialityImpact")
|
|
222
|
+
cve["integrityImpact"] = cvss31.get("integrityImpact")
|
|
223
|
+
cve["availabilityImpact"] = cvss31.get("availabilityImpact")
|
|
224
|
+
cve["baseScore"] = cvss31.get("baseScore")
|
|
225
|
+
cve["baseSeverity"] = cvss31.get("baseSeverity")
|
|
226
|
+
cve["exploitabilityScore"] = cvss31.get("exploitabilityScore")
|
|
227
|
+
cve["impactScore"] = cvss31.get("impactScore")
|
|
228
228
|
except Exception:
|
|
229
229
|
logger.error("Failed to transform CVE data {data}")
|
|
230
230
|
raise
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: cartography
|
|
3
|
-
Version: 0.100.
|
|
3
|
+
Version: 0.100.0rc4
|
|
4
4
|
Summary: Explore assets and their relationships across your technical infrastructure.
|
|
5
5
|
Maintainer: Cartography Contributors
|
|
6
6
|
License: apache2
|
|
@@ -59,10 +59,10 @@ Requires-Dist: moto; extra == "dev"
|
|
|
59
59
|
Requires-Dist: pre-commit; extra == "dev"
|
|
60
60
|
Requires-Dist: pytest>=6.2.4; extra == "dev"
|
|
61
61
|
Requires-Dist: pytest-mock; extra == "dev"
|
|
62
|
-
Requires-Dist: pytest-cov==
|
|
62
|
+
Requires-Dist: pytest-cov==6.0.0; extra == "dev"
|
|
63
63
|
Requires-Dist: pytest-rerunfailures; extra == "dev"
|
|
64
64
|
Requires-Dist: types-PyYAML; extra == "dev"
|
|
65
|
-
Requires-Dist: types-requests<2.32.0.
|
|
65
|
+
Requires-Dist: types-requests<2.32.0.20250302; extra == "dev"
|
|
66
66
|
|
|
67
67
|

|
|
68
68
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
cartography/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
cartography/__main__.py,sha256=JftXT_nUPkqcEh8uxCCT4n-OyHYqbldEgrDS-4ygy0U,101
|
|
3
|
-
cartography/_version.py,sha256=
|
|
3
|
+
cartography/_version.py,sha256=XNabPAacgLtT7W1DDFP4RS2MjLNRDWXmvHKjCNXBM9A,518
|
|
4
4
|
cartography/cli.py,sha256=-77DOKUQn3N-TDIi55V4RHLb3k36ZGZ64o1XgiT0qmE,33370
|
|
5
5
|
cartography/config.py,sha256=ZcadsKmooAkti9Kv0eDl8Ec1PcZDu3lWobtNaCnwY3k,11872
|
|
6
6
|
cartography/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -144,7 +144,7 @@ cartography/intel/aws/__init__.py,sha256=siRhVNypfGxMPNIXHSjfYbLX9qlB6RYyN6aWX64
|
|
|
144
144
|
cartography/intel/aws/apigateway.py,sha256=w4QdxlwnVegKKsZFfoI36i-FGlIUjzxzaayZyz9oQvM,11654
|
|
145
145
|
cartography/intel/aws/config.py,sha256=wrZbz7bc8vImLmRvTLkPcWnjjPzk3tOG4bB_BFS2lq8,7329
|
|
146
146
|
cartography/intel/aws/dynamodb.py,sha256=LZ6LGNThLi0zC3eLMq2JN3mwiSwZeaH58YQQHvsXMGE,5013
|
|
147
|
-
cartography/intel/aws/ecr.py,sha256=
|
|
147
|
+
cartography/intel/aws/ecr.py,sha256=neykNgcr6wjB7lEZC_7cGDu75-NsAhQKvL9sN18vOHI,7513
|
|
148
148
|
cartography/intel/aws/ecs.py,sha256=gulrIZ--iEFLpkkPH58MJIkctsxWeWdO2ofM9amDNZA,23654
|
|
149
149
|
cartography/intel/aws/eks.py,sha256=OerAX7qT2uGPbqliPvuy8JZUIgle_KMlnkkHxk8O5fk,3546
|
|
150
150
|
cartography/intel/aws/elasticache.py,sha256=fCI47aDFmIDyE26GiReKYb6XIZUwrzcvsXBQ4ruFhuI,4427
|
|
@@ -174,7 +174,7 @@ cartography/intel/aws/ec2/images.py,sha256=SLoxcy_PQgNomVMDMdutm0zXJCOLosiHJlN63
|
|
|
174
174
|
cartography/intel/aws/ec2/instances.py,sha256=uI8eVJmeEybS8y_T8CVKAkwxJyVDCH7sbuEJYeWGSWY,12468
|
|
175
175
|
cartography/intel/aws/ec2/internet_gateways.py,sha256=dI-4-85_3DGGZZBcY_DN6XqESx9P26S6jKok314lcnQ,2883
|
|
176
176
|
cartography/intel/aws/ec2/key_pairs.py,sha256=g4imIo_5jk8upq9J4--erg-OZXG2i3cJMe6SnNCYj9s,2635
|
|
177
|
-
cartography/intel/aws/ec2/launch_templates.py,sha256=
|
|
177
|
+
cartography/intel/aws/ec2/launch_templates.py,sha256=9s7opSzdpErDzxknAsPOXb63Cr0BJM4S-wcxFuInFXs,5346
|
|
178
178
|
cartography/intel/aws/ec2/load_balancer_v2s.py,sha256=95FfQQn740gexINIHDJizOM4OKzRtQT_y2XQMipQ5Dg,8661
|
|
179
179
|
cartography/intel/aws/ec2/load_balancers.py,sha256=1GwErzGqi3BKCARqfGJcD_r_D84rFKVy5kNMas9jAok,6756
|
|
180
180
|
cartography/intel/aws/ec2/network_acls.py,sha256=_UiOx79OxcqH0ecRjcVMglAzz5XJ4aVYLlv6dl_ism4,6809
|
|
@@ -207,7 +207,7 @@ cartography/intel/crowdstrike/endpoints.py,sha256=tdqokMDW3p4fK3dHKKb2T1DTogvOJB
|
|
|
207
207
|
cartography/intel/crowdstrike/spotlight.py,sha256=yNhj44-RYF6ubck-hHMKhKiNU0fCfhQf4Oagopc31EM,4754
|
|
208
208
|
cartography/intel/crowdstrike/util.py,sha256=gfJ6Ptr6YdbBS9Qj9a_-Jc-IJroADDRcXqjh5TW0qXE,277
|
|
209
209
|
cartography/intel/cve/__init__.py,sha256=u9mv5O_qkSLmdhLhLm1qbwmhoeLQ3A3fQTjNyLQpEyI,3656
|
|
210
|
-
cartography/intel/cve/feed.py,sha256=
|
|
210
|
+
cartography/intel/cve/feed.py,sha256=a_PnT5vbfrMSXOf4WV8PUIqA8TkSKlwWWot62s6_sAY,9884
|
|
211
211
|
cartography/intel/digitalocean/__init__.py,sha256=SMYB7LGIQOj_EgGSGVjWZk7SJNbP43hQuOfgOu6xYm4,1526
|
|
212
212
|
cartography/intel/digitalocean/compute.py,sha256=9XctwMjq9h5dExFgExvawoqyiEwSoocNgaMm3Fgl5GM,4911
|
|
213
213
|
cartography/intel/digitalocean/management.py,sha256=YWRnBLLL_bAP1vefIAQgm_-QzefGH0sZKmyU_EokHfA,3764
|
|
@@ -358,9 +358,9 @@ cartography/models/snipeit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
358
358
|
cartography/models/snipeit/asset.py,sha256=FyRAaeXuZjMy0eUQcSDFcgEAF5lbLMlvqp1Tv9d3Lv4,3238
|
|
359
359
|
cartography/models/snipeit/tenant.py,sha256=p4rFnpNNuF1W5ilGBbexDaETWTwavfb38RcQGoImkQI,679
|
|
360
360
|
cartography/models/snipeit/user.py,sha256=MsB4MiCVNTH6JpESime7cOkB89autZOXQpL6Z0l7L6o,2113
|
|
361
|
-
cartography-0.100.
|
|
362
|
-
cartography-0.100.
|
|
363
|
-
cartography-0.100.
|
|
364
|
-
cartography-0.100.
|
|
365
|
-
cartography-0.100.
|
|
366
|
-
cartography-0.100.
|
|
361
|
+
cartography-0.100.0rc4.dist-info/LICENSE,sha256=kvLEBRYaQ1RvUni6y7Ti9uHeooqnjPoo6n_-0JO1ETc,11351
|
|
362
|
+
cartography-0.100.0rc4.dist-info/METADATA,sha256=Ybi85b9tT6kYixO3WY-Y5TDc1El7FmVRTG_7oWyH95g,11859
|
|
363
|
+
cartography-0.100.0rc4.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
364
|
+
cartography-0.100.0rc4.dist-info/entry_points.txt,sha256=GVIAWD0o0_K077qMA_k1oZU4v-M0a8GLKGJR8tZ-qH8,112
|
|
365
|
+
cartography-0.100.0rc4.dist-info/top_level.txt,sha256=BHqsNJQiI6Q72DeypC1IINQJE59SLhU4nllbQjgJi9g,12
|
|
366
|
+
cartography-0.100.0rc4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|