cartography 0.98.0rc4__py3-none-any.whl → 0.99.0rc1__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 +2 -2
- cartography/client/core/tx.py +3 -0
- cartography/intel/aws/ec2/images.py +20 -2
- cartography/intel/aws/resourcegroupstaggingapi.py +3 -0
- cartography/models/aws/inspector/findings.py +17 -0
- {cartography-0.98.0rc4.dist-info → cartography-0.99.0rc1.dist-info}/METADATA +2 -2
- {cartography-0.98.0rc4.dist-info → cartography-0.99.0rc1.dist-info}/RECORD +11 -11
- {cartography-0.98.0rc4.dist-info → cartography-0.99.0rc1.dist-info}/WHEEL +1 -1
- {cartography-0.98.0rc4.dist-info → cartography-0.99.0rc1.dist-info}/LICENSE +0 -0
- {cartography-0.98.0rc4.dist-info → cartography-0.99.0rc1.dist-info}/entry_points.txt +0 -0
- {cartography-0.98.0rc4.dist-info → cartography-0.99.0rc1.dist-info}/top_level.txt +0 -0
cartography/_version.py
CHANGED
|
@@ -12,5 +12,5 @@ __version__: str
|
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
|
13
13
|
version_tuple: VERSION_TUPLE
|
|
14
14
|
|
|
15
|
-
__version__ = version = '0.
|
|
16
|
-
__version_tuple__ = version_tuple = (0,
|
|
15
|
+
__version__ = version = '0.99.0rc1'
|
|
16
|
+
__version_tuple__ = version_tuple = (0, 99, 0)
|
cartography/client/core/tx.py
CHANGED
|
@@ -249,6 +249,9 @@ def load(
|
|
|
249
249
|
:param kwargs: Allows additional keyword args to be supplied to the Neo4j query.
|
|
250
250
|
:return: None
|
|
251
251
|
"""
|
|
252
|
+
if len(dict_list) == 0:
|
|
253
|
+
# If there is no data to load, save some time.
|
|
254
|
+
return
|
|
252
255
|
ensure_indexes(neo4j_session, node_schema)
|
|
253
256
|
ingestion_query = build_ingestion_query(node_schema)
|
|
254
257
|
load_graph_data(neo4j_session, ingestion_query, dict_list, **kwargs)
|
|
@@ -9,6 +9,7 @@ from botocore.exceptions import ClientError
|
|
|
9
9
|
|
|
10
10
|
from cartography.client.core.tx import load
|
|
11
11
|
from cartography.graph.job import GraphJob
|
|
12
|
+
from cartography.intel.aws.ec2 import get_ec2_regions
|
|
12
13
|
from cartography.intel.aws.ec2.util import get_botocore_config
|
|
13
14
|
from cartography.models.aws.ec2.images import EC2ImageSchema
|
|
14
15
|
from cartography.util import aws_handle_regions
|
|
@@ -48,7 +49,7 @@ def get_images(boto3_session: boto3.session.Session, region: str, image_ids: Lis
|
|
|
48
49
|
self_images = client.describe_images(Owners=['self'])['Images']
|
|
49
50
|
images.extend(self_images)
|
|
50
51
|
except ClientError as e:
|
|
51
|
-
logger.warning(f"Failed retrieve images for region - {region}. Error - {e}")
|
|
52
|
+
logger.warning(f"Failed to retrieve private images for region - {region}. Error - {e}")
|
|
52
53
|
try:
|
|
53
54
|
if image_ids:
|
|
54
55
|
image_ids = [image_id for image_id in image_ids if image_id is not None]
|
|
@@ -58,8 +59,25 @@ def get_images(boto3_session: boto3.session.Session, region: str, image_ids: Lis
|
|
|
58
59
|
for image in images_in_use:
|
|
59
60
|
if image["ImageId"] not in _ids:
|
|
60
61
|
images.append(image)
|
|
62
|
+
_ids.append(image["ImageId"])
|
|
63
|
+
# Handle cross region image ids
|
|
64
|
+
if len(_ids) != len(image_ids):
|
|
65
|
+
logger.info("Attempting to retrieve images from other regions")
|
|
66
|
+
pending_ids = [image_id for image_id in image_ids if image_id not in _ids]
|
|
67
|
+
all_regions = get_ec2_regions(boto3_session)
|
|
68
|
+
clients = {
|
|
69
|
+
other_region: boto3_session.client('ec2', region_name=other_region, config=get_botocore_config())
|
|
70
|
+
for other_region in all_regions if other_region != region
|
|
71
|
+
}
|
|
72
|
+
for other_region, client in clients.items():
|
|
73
|
+
for _id in pending_ids:
|
|
74
|
+
try:
|
|
75
|
+
pending_image = client.describe_images(ImageIds=[_id])['Images']
|
|
76
|
+
images.extend(pending_image)
|
|
77
|
+
except ClientError as e:
|
|
78
|
+
logger.warning(f"Image {id} could not be found at region - {other_region}. Error - {e}")
|
|
61
79
|
except ClientError as e:
|
|
62
|
-
logger.warning(f"Failed retrieve images for region - {region}. Error - {e}")
|
|
80
|
+
logger.warning(f"Failed to retrieve public images for region - {region}. Error - {e}")
|
|
63
81
|
return images
|
|
64
82
|
|
|
65
83
|
|
|
@@ -188,6 +188,9 @@ def load_tags(
|
|
|
188
188
|
current_aws_account_id: str,
|
|
189
189
|
aws_update_tag: int,
|
|
190
190
|
) -> None:
|
|
191
|
+
if len(tag_data) == 0:
|
|
192
|
+
# If there is no data to load, save some time.
|
|
193
|
+
return
|
|
191
194
|
for tag_data_batch in batch(tag_data, size=100):
|
|
192
195
|
neo4j_session.write_transaction(
|
|
193
196
|
_load_tags_tx,
|
|
@@ -61,6 +61,22 @@ class InspectorFindingToAWSAccount(CartographyRelSchema):
|
|
|
61
61
|
properties: InspectorFindingToAwsAccountRelProperties = InspectorFindingToAwsAccountRelProperties()
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class InspectorFindingToAwsAccountDelegateRelProperties(CartographyRelProperties):
|
|
66
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass(frozen=True)
|
|
70
|
+
class InspectorFindingToAWSAccountDelegate(CartographyRelSchema):
|
|
71
|
+
target_node_label: str = 'AWSAccount'
|
|
72
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
73
|
+
{'id': PropertyRef('awsaccount')},
|
|
74
|
+
)
|
|
75
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
76
|
+
rel_label: str = "MEMBER"
|
|
77
|
+
properties: InspectorFindingToAwsAccountDelegateRelProperties = InspectorFindingToAwsAccountDelegateRelProperties()
|
|
78
|
+
|
|
79
|
+
|
|
64
80
|
@dataclass(frozen=True)
|
|
65
81
|
class InspectorFindingToEC2InstanceRelProperties(CartographyRelProperties):
|
|
66
82
|
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
@@ -120,5 +136,6 @@ class AWSInspectorFindingSchema(CartographyNodeSchema):
|
|
|
120
136
|
InspectorFindingToEC2Instance(),
|
|
121
137
|
InspectorFindingToECRRepository(),
|
|
122
138
|
InspectorFindingToECRImage(),
|
|
139
|
+
InspectorFindingToAWSAccountDelegate(),
|
|
123
140
|
],
|
|
124
141
|
)
|
|
@@ -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=hM9CRVuInASxNswzZ4txXUj1H_ZnoY8bgRIKCsEw0Oc,416
|
|
4
4
|
cartography/cli.py,sha256=LPjeOkx-cKhRkuhqMicB-0X3SHOjLXxEeGqsp2FtpC0,33285
|
|
5
5
|
cartography/config.py,sha256=ZcadsKmooAkti9Kv0eDl8Ec1PcZDu3lWobtNaCnwY3k,11872
|
|
6
6
|
cartography/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -11,7 +11,7 @@ cartography/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
11
11
|
cartography/client/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
cartography/client/aws/iam.py,sha256=dYsGikc36DEsSeR2XVOVFFUDwuU9yWj_EVkpgVYCFgM,1293
|
|
13
13
|
cartography/client/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
cartography/client/core/tx.py,sha256=
|
|
14
|
+
cartography/client/core/tx.py,sha256=55Cf9DJGHHXQk4HmPOdFwr1eh9Pr1nzmIvs4XoCVr0g,10892
|
|
15
15
|
cartography/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
cartography/data/indexes.cypher,sha256=KMhj8DoKl3d-o6Zx4PY6IZ_8eZNPqZWWVNnOzIi5dRw,26946
|
|
17
17
|
cartography/data/permission_relationships.yaml,sha256=RuKGGc_3ZUQ7ag0MssB8k_zaonCkVM5E8I_svBWTmGc,969
|
|
@@ -161,7 +161,7 @@ cartography/intel/aws/organizations.py,sha256=HaQZ3J5XF15BuykuDypqFORDYpnoHuRRr4
|
|
|
161
161
|
cartography/intel/aws/permission_relationships.py,sha256=IarV9gt5BaplZ5TPo_mfypt9bTKfT9qDtqC3Ob89qGI,14904
|
|
162
162
|
cartography/intel/aws/rds.py,sha256=vnlNYmrO2Cc0PNn31CeG2QwYhwjVosbQFE9Ol1vQyLE,25252
|
|
163
163
|
cartography/intel/aws/redshift.py,sha256=KOqiXIllHmtPTeaNGl-cX4srY5pFE6o12j8MQ5-zWpc,6694
|
|
164
|
-
cartography/intel/aws/resourcegroupstaggingapi.py,sha256=
|
|
164
|
+
cartography/intel/aws/resourcegroupstaggingapi.py,sha256=I2VrL-oplGj2Jyhbo312V6vnER_FXpJRrc6OBJ-_VmI,10375
|
|
165
165
|
cartography/intel/aws/resources.py,sha256=A8Dc3PtCfDyk5a1ZgAoHthhDPS6aWN_kR0PLwnHdC0Q,3370
|
|
166
166
|
cartography/intel/aws/route53.py,sha256=IYqeQud1HuHnf11A7T-Jeif5DWgjpaaU-Jfr2cLUc_o,14099
|
|
167
167
|
cartography/intel/aws/s3.py,sha256=SVxUMtMSkbdjZv5qOSYIbYb8BQa-QTojbHG85-EFWLA,27034
|
|
@@ -172,7 +172,7 @@ cartography/intel/aws/ssm.py,sha256=IDOYa8v2FgziU8nBOZ7wyDG4o_nFYshbB-si9Ut_9Zc,
|
|
|
172
172
|
cartography/intel/aws/ec2/__init__.py,sha256=IDK2Yap7mllK_ab6yVMLXatJ94znIkn-szv5RJP5fbo,346
|
|
173
173
|
cartography/intel/aws/ec2/auto_scaling_groups.py,sha256=ylfks8_oC0-fVMnToFbmRcbKdEN0H17LlN1-ZqW6ULc,8148
|
|
174
174
|
cartography/intel/aws/ec2/elastic_ip_addresses.py,sha256=0k4NwS73VyWbEj5jXvSkaq2RNvmAlBlrN-UKa_Bj0uk,3957
|
|
175
|
-
cartography/intel/aws/ec2/images.py,sha256=
|
|
175
|
+
cartography/intel/aws/ec2/images.py,sha256=vxkuh0zQLqtj6DjIRrcQQwgFLhn5mBNQzZW-gg8UFNg,4919
|
|
176
176
|
cartography/intel/aws/ec2/instances.py,sha256=uI8eVJmeEybS8y_T8CVKAkwxJyVDCH7sbuEJYeWGSWY,12468
|
|
177
177
|
cartography/intel/aws/ec2/internet_gateways.py,sha256=dI-4-85_3DGGZZBcY_DN6XqESx9P26S6jKok314lcnQ,2883
|
|
178
178
|
cartography/intel/aws/ec2/key_pairs.py,sha256=g4imIo_5jk8upq9J4--erg-OZXG2i3cJMe6SnNCYj9s,2635
|
|
@@ -312,7 +312,7 @@ cartography/models/aws/identitycenter/awsidentitycenter.py,sha256=lmpo-qqmMN6BMG
|
|
|
312
312
|
cartography/models/aws/identitycenter/awspermissionset.py,sha256=30BBY-XG3-rJMihKKTdUVobkdqQYWWGsFD83uTVJqkI,3539
|
|
313
313
|
cartography/models/aws/identitycenter/awsssouser.py,sha256=HSXSHDVM36eIlYfRAwZ8KT470v_s1hC0_lrzZxCbYjw,2837
|
|
314
314
|
cartography/models/aws/inspector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
315
|
-
cartography/models/aws/inspector/findings.py,sha256=
|
|
315
|
+
cartography/models/aws/inspector/findings.py,sha256=_7pCqCINNFYQv86Uz1bE_4ASvYBYrID-vDzj2alIbVc,6280
|
|
316
316
|
cartography/models/aws/inspector/packages.py,sha256=dtY5JsVb6Ri78Lqigb2nHNq0Qc926U_m90SmbvZEDGc,3267
|
|
317
317
|
cartography/models/aws/ssm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
318
318
|
cartography/models/aws/ssm/instance_information.py,sha256=YFEEufju_JdC77_lfSBOPq_DrY_faGtkAijQ3_oyTAI,4022
|
|
@@ -354,9 +354,9 @@ cartography/models/snipeit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
354
354
|
cartography/models/snipeit/asset.py,sha256=FyRAaeXuZjMy0eUQcSDFcgEAF5lbLMlvqp1Tv9d3Lv4,3238
|
|
355
355
|
cartography/models/snipeit/tenant.py,sha256=p4rFnpNNuF1W5ilGBbexDaETWTwavfb38RcQGoImkQI,679
|
|
356
356
|
cartography/models/snipeit/user.py,sha256=MsB4MiCVNTH6JpESime7cOkB89autZOXQpL6Z0l7L6o,2113
|
|
357
|
-
cartography-0.
|
|
358
|
-
cartography-0.
|
|
359
|
-
cartography-0.
|
|
360
|
-
cartography-0.
|
|
361
|
-
cartography-0.
|
|
362
|
-
cartography-0.
|
|
357
|
+
cartography-0.99.0rc1.dist-info/LICENSE,sha256=kvLEBRYaQ1RvUni6y7Ti9uHeooqnjPoo6n_-0JO1ETc,11351
|
|
358
|
+
cartography-0.99.0rc1.dist-info/METADATA,sha256=TxsWkL6peNqG6dfFXb0K81KUFsOzJToalPKCgbQwRbI,11473
|
|
359
|
+
cartography-0.99.0rc1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
360
|
+
cartography-0.99.0rc1.dist-info/entry_points.txt,sha256=GVIAWD0o0_K077qMA_k1oZU4v-M0a8GLKGJR8tZ-qH8,112
|
|
361
|
+
cartography-0.99.0rc1.dist-info/top_level.txt,sha256=BHqsNJQiI6Q72DeypC1IINQJE59SLhU4nllbQjgJi9g,12
|
|
362
|
+
cartography-0.99.0rc1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|