cartography 0.107.0rc3__py3-none-any.whl → 0.108.0rc2__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.

Files changed (39) hide show
  1. cartography/_version.py +2 -2
  2. cartography/cli.py +10 -0
  3. cartography/config.py +5 -0
  4. cartography/data/indexes.cypher +0 -8
  5. cartography/data/jobs/cleanup/github_repos_cleanup.json +2 -0
  6. cartography/intel/aws/__init__.py +1 -0
  7. cartography/intel/aws/cloudtrail.py +17 -4
  8. cartography/intel/aws/cloudtrail_management_events.py +560 -16
  9. cartography/intel/aws/cloudwatch.py +73 -4
  10. cartography/intel/aws/ec2/security_groups.py +140 -122
  11. cartography/intel/aws/ec2/snapshots.py +47 -84
  12. cartography/intel/aws/ec2/subnets.py +37 -63
  13. cartography/intel/aws/elasticache.py +102 -79
  14. cartography/intel/aws/guardduty.py +275 -0
  15. cartography/intel/aws/resources.py +2 -0
  16. cartography/intel/github/repos.py +370 -28
  17. cartography/models/aws/cloudtrail/management_events.py +95 -6
  18. cartography/models/aws/cloudtrail/trail.py +21 -0
  19. cartography/models/aws/cloudwatch/metric_alarm.py +53 -0
  20. cartography/models/aws/ec2/security_group_rules.py +109 -0
  21. cartography/models/aws/ec2/security_groups.py +90 -0
  22. cartography/models/aws/ec2/snapshots.py +58 -0
  23. cartography/models/aws/ec2/subnets.py +65 -0
  24. cartography/models/aws/ec2/volumes.py +20 -0
  25. cartography/models/aws/elasticache/__init__.py +0 -0
  26. cartography/models/aws/elasticache/cluster.py +65 -0
  27. cartography/models/aws/elasticache/topic.py +67 -0
  28. cartography/models/aws/guardduty/__init__.py +1 -0
  29. cartography/models/aws/guardduty/findings.py +102 -0
  30. cartography/models/github/dependencies.py +74 -0
  31. cartography/models/github/manifests.py +49 -0
  32. {cartography-0.107.0rc3.dist-info → cartography-0.108.0rc2.dist-info}/METADATA +3 -3
  33. {cartography-0.107.0rc3.dist-info → cartography-0.108.0rc2.dist-info}/RECORD +37 -26
  34. cartography/data/jobs/cleanup/aws_import_ec2_security_groupinfo_cleanup.json +0 -24
  35. cartography/data/jobs/cleanup/aws_import_snapshots_cleanup.json +0 -30
  36. {cartography-0.107.0rc3.dist-info → cartography-0.108.0rc2.dist-info}/WHEEL +0 -0
  37. {cartography-0.107.0rc3.dist-info → cartography-0.108.0rc2.dist-info}/entry_points.txt +0 -0
  38. {cartography-0.107.0rc3.dist-info → cartography-0.108.0rc2.dist-info}/licenses/LICENSE +0 -0
  39. {cartography-0.107.0rc3.dist-info → cartography-0.108.0rc2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,109 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.nodes import ExtraNodeLabels
7
+ from cartography.models.core.relationships import CartographyRelProperties
8
+ from cartography.models.core.relationships import CartographyRelSchema
9
+ from cartography.models.core.relationships import LinkDirection
10
+ from cartography.models.core.relationships import make_target_node_matcher
11
+ from cartography.models.core.relationships import OtherRelationships
12
+ from cartography.models.core.relationships import TargetNodeMatcher
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class IpRuleNodeProperties(CartographyNodeProperties):
17
+ id: PropertyRef = PropertyRef("RuleId")
18
+ ruleid: PropertyRef = PropertyRef("RuleId", extra_index=True)
19
+ groupid: PropertyRef = PropertyRef("GroupId", extra_index=True)
20
+ protocol: PropertyRef = PropertyRef("Protocol")
21
+ fromport: PropertyRef = PropertyRef("FromPort")
22
+ toport: PropertyRef = PropertyRef("ToPort")
23
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
24
+
25
+
26
+ @dataclass(frozen=True)
27
+ class IpRuleToAWSAccountRelProperties(CartographyRelProperties):
28
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
29
+
30
+
31
+ @dataclass(frozen=True)
32
+ class IpRuleToAWSAccountRel(CartographyRelSchema):
33
+ target_node_label: str = "AWSAccount"
34
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
35
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
36
+ )
37
+ direction: LinkDirection = LinkDirection.INWARD
38
+ rel_label: str = "RESOURCE"
39
+ properties: IpRuleToAWSAccountRelProperties = IpRuleToAWSAccountRelProperties()
40
+
41
+
42
+ @dataclass(frozen=True)
43
+ class IpRuleToSecurityGroupRelProperties(CartographyRelProperties):
44
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
45
+
46
+
47
+ @dataclass(frozen=True)
48
+ class IpRuleToSecurityGroupRel(CartographyRelSchema):
49
+ target_node_label: str = "EC2SecurityGroup"
50
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
51
+ {"groupid": PropertyRef("GroupId")}
52
+ )
53
+ direction: LinkDirection = LinkDirection.OUTWARD
54
+ rel_label: str = "MEMBER_OF_EC2_SECURITY_GROUP"
55
+ properties: IpRuleToSecurityGroupRelProperties = (
56
+ IpRuleToSecurityGroupRelProperties()
57
+ )
58
+
59
+
60
+ @dataclass(frozen=True)
61
+ class IpRangeNodeProperties(CartographyNodeProperties):
62
+ id: PropertyRef = PropertyRef("RangeId")
63
+ range: PropertyRef = PropertyRef("RangeId")
64
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
65
+
66
+
67
+ @dataclass(frozen=True)
68
+ class IpRangeToIpRuleRelProperties(CartographyRelProperties):
69
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
70
+
71
+
72
+ @dataclass(frozen=True)
73
+ class IpRangeToIpRuleRel(CartographyRelSchema):
74
+ target_node_label: str = "IpRule"
75
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
76
+ {"ruleid": PropertyRef("RuleId")}
77
+ )
78
+ direction: LinkDirection = LinkDirection.OUTWARD
79
+ rel_label: str = "MEMBER_OF_IP_RULE"
80
+ properties: IpRangeToIpRuleRelProperties = IpRangeToIpRuleRelProperties()
81
+
82
+
83
+ @dataclass(frozen=True)
84
+ class IpRuleSchema(CartographyNodeSchema):
85
+ label: str = "IpRule"
86
+ properties: IpRuleNodeProperties = IpRuleNodeProperties()
87
+ sub_resource_relationship: IpRuleToAWSAccountRel = IpRuleToAWSAccountRel()
88
+ other_relationships: OtherRelationships = OtherRelationships(
89
+ [IpRuleToSecurityGroupRel()]
90
+ )
91
+
92
+
93
+ @dataclass(frozen=True)
94
+ class IpPermissionInboundSchema(CartographyNodeSchema):
95
+ label: str = "IpRule"
96
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["IpPermissionInbound"])
97
+ properties: IpRuleNodeProperties = IpRuleNodeProperties()
98
+ sub_resource_relationship: IpRuleToAWSAccountRel = IpRuleToAWSAccountRel()
99
+ other_relationships: OtherRelationships = OtherRelationships(
100
+ [IpRuleToSecurityGroupRel()]
101
+ )
102
+
103
+
104
+ @dataclass(frozen=True)
105
+ class IpRangeSchema(CartographyNodeSchema):
106
+ label: str = "IpRange"
107
+ properties: IpRangeNodeProperties = IpRangeNodeProperties()
108
+ sub_resource_relationship: IpRuleToAWSAccountRel = IpRuleToAWSAccountRel()
109
+ other_relationships: OtherRelationships = OtherRelationships([IpRangeToIpRuleRel()])
@@ -0,0 +1,90 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.relationships import CartographyRelProperties
7
+ from cartography.models.core.relationships import CartographyRelSchema
8
+ from cartography.models.core.relationships import LinkDirection
9
+ from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import OtherRelationships
11
+ from cartography.models.core.relationships import TargetNodeMatcher
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class EC2SecurityGroupNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("GroupId")
17
+ groupid: PropertyRef = PropertyRef("GroupId", extra_index=True)
18
+ name: PropertyRef = PropertyRef("GroupName")
19
+ description: PropertyRef = PropertyRef("Description")
20
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
21
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class EC2SecurityGroupToAWSAccountRelProperties(CartographyRelProperties):
26
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class EC2SecurityGroupToAWSAccountRel(CartographyRelSchema):
31
+ target_node_label: str = "AWSAccount"
32
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
33
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
34
+ )
35
+ direction: LinkDirection = LinkDirection.INWARD
36
+ rel_label: str = "RESOURCE"
37
+ properties: EC2SecurityGroupToAWSAccountRelProperties = (
38
+ EC2SecurityGroupToAWSAccountRelProperties()
39
+ )
40
+
41
+
42
+ @dataclass(frozen=True)
43
+ class EC2SecurityGroupToVpcRelProperties(CartographyRelProperties):
44
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
45
+
46
+
47
+ @dataclass(frozen=True)
48
+ class EC2SecurityGroupToVpcRel(CartographyRelSchema):
49
+ target_node_label: str = "AWSVpc"
50
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
51
+ {"vpcid": PropertyRef("VpcId")}
52
+ )
53
+ direction: LinkDirection = LinkDirection.OUTWARD
54
+ rel_label: str = "MEMBER_OF_EC2_SECURITY_GROUP"
55
+ properties: EC2SecurityGroupToVpcRelProperties = (
56
+ EC2SecurityGroupToVpcRelProperties()
57
+ )
58
+
59
+
60
+ @dataclass(frozen=True)
61
+ class EC2SecurityGroupToSourceGroupRelProperties(CartographyRelProperties):
62
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
63
+
64
+
65
+ @dataclass(frozen=True)
66
+ class EC2SecurityGroupToSourceGroupRel(CartographyRelSchema):
67
+ target_node_label: str = "EC2SecurityGroup"
68
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
69
+ {"groupid": PropertyRef("SOURCE_GROUP_IDS", one_to_many=True)}
70
+ )
71
+ direction: LinkDirection = LinkDirection.OUTWARD
72
+ rel_label: str = "ALLOWS_TRAFFIC_FROM"
73
+ properties: EC2SecurityGroupToSourceGroupRelProperties = (
74
+ EC2SecurityGroupToSourceGroupRelProperties()
75
+ )
76
+
77
+
78
+ @dataclass(frozen=True)
79
+ class EC2SecurityGroupSchema(CartographyNodeSchema):
80
+ label: str = "EC2SecurityGroup"
81
+ properties: EC2SecurityGroupNodeProperties = EC2SecurityGroupNodeProperties()
82
+ sub_resource_relationship: EC2SecurityGroupToAWSAccountRel = (
83
+ EC2SecurityGroupToAWSAccountRel()
84
+ )
85
+ other_relationships: OtherRelationships = OtherRelationships(
86
+ [
87
+ EC2SecurityGroupToVpcRel(),
88
+ EC2SecurityGroupToSourceGroupRel(),
89
+ ]
90
+ )
@@ -0,0 +1,58 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.relationships import CartographyRelProperties
7
+ from cartography.models.core.relationships import CartographyRelSchema
8
+ from cartography.models.core.relationships import LinkDirection
9
+ from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import OtherRelationships
11
+ from cartography.models.core.relationships import TargetNodeMatcher
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class EBSSnapshotNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("SnapshotId")
17
+ snapshotid: PropertyRef = PropertyRef("SnapshotId", extra_index=True)
18
+ description: PropertyRef = PropertyRef("Description")
19
+ encrypted: PropertyRef = PropertyRef("Encrypted")
20
+ progress: PropertyRef = PropertyRef("Progress")
21
+ starttime: PropertyRef = PropertyRef("StartTime")
22
+ state: PropertyRef = PropertyRef("State")
23
+ statemessage: PropertyRef = PropertyRef("StateMessage")
24
+ volumeid: PropertyRef = PropertyRef("VolumeId")
25
+ volumesize: PropertyRef = PropertyRef("VolumeSize")
26
+ outpostarn: PropertyRef = PropertyRef("OutpostArn")
27
+ dataencryptionkeyid: PropertyRef = PropertyRef("DataEncryptionKeyId")
28
+ kmskeyid: PropertyRef = PropertyRef("KmsKeyId")
29
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
30
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
31
+
32
+
33
+ @dataclass(frozen=True)
34
+ class EBSSnapshotToAWSAccountRelProperties(CartographyRelProperties):
35
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
36
+
37
+
38
+ @dataclass(frozen=True)
39
+ class EBSSnapshotToAWSAccountRel(CartographyRelSchema):
40
+ target_node_label: str = "AWSAccount"
41
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
42
+ {
43
+ "id": PropertyRef("AWS_ID", set_in_kwargs=True),
44
+ }
45
+ )
46
+ direction: LinkDirection = LinkDirection.INWARD
47
+ rel_label: str = "RESOURCE"
48
+ properties: EBSSnapshotToAWSAccountRelProperties = (
49
+ EBSSnapshotToAWSAccountRelProperties()
50
+ )
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class EBSSnapshotSchema(CartographyNodeSchema):
55
+ label: str = "EBSSnapshot"
56
+ properties: EBSSnapshotNodeProperties = EBSSnapshotNodeProperties()
57
+ sub_resource_relationship: EBSSnapshotToAWSAccountRel = EBSSnapshotToAWSAccountRel()
58
+ other_relationships: OtherRelationships = OtherRelationships([])
@@ -0,0 +1,65 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.aws.ec2.auto_scaling_groups import EC2SubnetToAWSAccountRel
4
+ from cartography.models.core.common import PropertyRef
5
+ from cartography.models.core.nodes import CartographyNodeProperties
6
+ from cartography.models.core.nodes import CartographyNodeSchema
7
+ from cartography.models.core.relationships import CartographyRelProperties
8
+ from cartography.models.core.relationships import CartographyRelSchema
9
+ from cartography.models.core.relationships import LinkDirection
10
+ from cartography.models.core.relationships import make_target_node_matcher
11
+ from cartography.models.core.relationships import OtherRelationships
12
+ from cartography.models.core.relationships import TargetNodeMatcher
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class EC2SubnetNodeProperties(CartographyNodeProperties):
17
+ id: PropertyRef = PropertyRef("SubnetId")
18
+ subnetid: PropertyRef = PropertyRef("SubnetId", extra_index=True)
19
+ subnet_id: PropertyRef = PropertyRef("SubnetId", extra_index=True)
20
+ subnet_arn: PropertyRef = PropertyRef("SubnetArn")
21
+ name: PropertyRef = PropertyRef("CidrBlock")
22
+ cidr_block: PropertyRef = PropertyRef("CidrBlock")
23
+ available_ip_address_count: PropertyRef = PropertyRef("AvailableIpAddressCount")
24
+ default_for_az: PropertyRef = PropertyRef("DefaultForAz")
25
+ map_customer_owned_ip_on_launch: PropertyRef = PropertyRef(
26
+ "MapCustomerOwnedIpOnLaunch"
27
+ )
28
+ state: PropertyRef = PropertyRef("State")
29
+ assignipv6addressoncreation: PropertyRef = PropertyRef(
30
+ "AssignIpv6AddressOnCreation"
31
+ )
32
+ map_public_ip_on_launch: PropertyRef = PropertyRef("MapPublicIpOnLaunch")
33
+ availability_zone: PropertyRef = PropertyRef("AvailabilityZone")
34
+ availability_zone_id: PropertyRef = PropertyRef("AvailabilityZoneId")
35
+ vpc_id: PropertyRef = PropertyRef("VpcId")
36
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
37
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class EC2SubnetToVpcRelProperties(CartographyRelProperties):
42
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
43
+
44
+
45
+ @dataclass(frozen=True)
46
+ class EC2SubnetToVpcRel(CartographyRelSchema):
47
+ target_node_label: str = "AWSVpc"
48
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
49
+ {"id": PropertyRef("VpcId")}
50
+ )
51
+ direction: LinkDirection = LinkDirection.OUTWARD
52
+ rel_label: str = "MEMBER_OF_AWS_VPC"
53
+ properties: EC2SubnetToVpcRelProperties = EC2SubnetToVpcRelProperties()
54
+
55
+
56
+ @dataclass(frozen=True)
57
+ class EC2SubnetSchema(CartographyNodeSchema):
58
+ label: str = "EC2Subnet"
59
+ properties: EC2SubnetNodeProperties = EC2SubnetNodeProperties()
60
+ sub_resource_relationship: EC2SubnetToAWSAccountRel = EC2SubnetToAWSAccountRel()
61
+ other_relationships: OtherRelationships = OtherRelationships(
62
+ [
63
+ EC2SubnetToVpcRel(),
64
+ ]
65
+ )
@@ -68,6 +68,24 @@ class EBSVolumeToEC2InstanceRel(CartographyRelSchema):
68
68
  )
69
69
 
70
70
 
71
+ @dataclass(frozen=True)
72
+ class EBSVolumeToEBSSnapshotRelProperties(CartographyRelProperties):
73
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
74
+
75
+
76
+ @dataclass(frozen=True)
77
+ class EBSVolumeToEBSSnapshotRel(CartographyRelSchema):
78
+ target_node_label: str = "EBSSnapshot"
79
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
80
+ {"id": PropertyRef("SnapshotId")},
81
+ )
82
+ direction: LinkDirection = LinkDirection.INWARD
83
+ rel_label: str = "CREATED_FROM"
84
+ properties: EBSVolumeToEBSSnapshotRelProperties = (
85
+ EBSVolumeToEBSSnapshotRelProperties()
86
+ )
87
+
88
+
71
89
  @dataclass(frozen=True)
72
90
  class EBSVolumeSchema(CartographyNodeSchema):
73
91
  """
@@ -80,6 +98,7 @@ class EBSVolumeSchema(CartographyNodeSchema):
80
98
  other_relationships: OtherRelationships = OtherRelationships(
81
99
  [
82
100
  EBSVolumeToEC2InstanceRel(),
101
+ EBSVolumeToEBSSnapshotRel(),
83
102
  ],
84
103
  )
85
104
 
@@ -110,5 +129,6 @@ class EBSVolumeInstanceSchema(CartographyNodeSchema):
110
129
  other_relationships: OtherRelationships = OtherRelationships(
111
130
  [
112
131
  EBSVolumeToEC2InstanceRel(),
132
+ EBSVolumeToEBSSnapshotRel(),
113
133
  ],
114
134
  )
File without changes
@@ -0,0 +1,65 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.relationships import CartographyRelProperties
7
+ from cartography.models.core.relationships import CartographyRelSchema
8
+ from cartography.models.core.relationships import LinkDirection
9
+ from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import TargetNodeMatcher
11
+
12
+
13
+ @dataclass(frozen=True)
14
+ class ElasticacheClusterNodeProperties(CartographyNodeProperties):
15
+ id: PropertyRef = PropertyRef("ARN")
16
+ arn: PropertyRef = PropertyRef("ARN", extra_index=True)
17
+ cache_cluster_id: PropertyRef = PropertyRef("CacheClusterId")
18
+ cache_node_type: PropertyRef = PropertyRef("CacheNodeType")
19
+ engine: PropertyRef = PropertyRef("Engine")
20
+ engine_version: PropertyRef = PropertyRef("EngineVersion")
21
+ cache_cluster_status: PropertyRef = PropertyRef("CacheClusterStatus")
22
+ num_cache_nodes: PropertyRef = PropertyRef("NumCacheNodes")
23
+ preferred_availability_zone: PropertyRef = PropertyRef("PreferredAvailabilityZone")
24
+ preferred_maintenance_window: PropertyRef = PropertyRef(
25
+ "PreferredMaintenanceWindow"
26
+ )
27
+ cache_cluster_create_time: PropertyRef = PropertyRef("CacheClusterCreateTime")
28
+ cache_subnet_group_name: PropertyRef = PropertyRef("CacheSubnetGroupName")
29
+ auto_minor_version_upgrade: PropertyRef = PropertyRef("AutoMinorVersionUpgrade")
30
+ replication_group_id: PropertyRef = PropertyRef("ReplicationGroupId")
31
+ snapshot_retention_limit: PropertyRef = PropertyRef("SnapshotRetentionLimit")
32
+ snapshot_window: PropertyRef = PropertyRef("SnapshotWindow")
33
+ auth_token_enabled: PropertyRef = PropertyRef("AuthTokenEnabled")
34
+ transit_encryption_enabled: PropertyRef = PropertyRef("TransitEncryptionEnabled")
35
+ at_rest_encryption_enabled: PropertyRef = PropertyRef("AtRestEncryptionEnabled")
36
+ topic_arn: PropertyRef = PropertyRef("TopicArn")
37
+ region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
38
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
39
+
40
+
41
+ @dataclass(frozen=True)
42
+ class ElasticacheClusterToAWSAccountRelProperties(CartographyRelProperties):
43
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class ElasticacheClusterToAWSAccountRel(CartographyRelSchema):
48
+ target_node_label: str = "AWSAccount"
49
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
50
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
51
+ )
52
+ direction: LinkDirection = LinkDirection.INWARD
53
+ rel_label: str = "RESOURCE"
54
+ properties: ElasticacheClusterToAWSAccountRelProperties = (
55
+ ElasticacheClusterToAWSAccountRelProperties()
56
+ )
57
+
58
+
59
+ @dataclass(frozen=True)
60
+ class ElasticacheClusterSchema(CartographyNodeSchema):
61
+ label: str = "ElasticacheCluster"
62
+ properties: ElasticacheClusterNodeProperties = ElasticacheClusterNodeProperties()
63
+ sub_resource_relationship: ElasticacheClusterToAWSAccountRel = (
64
+ ElasticacheClusterToAWSAccountRel()
65
+ )
@@ -0,0 +1,67 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.relationships import CartographyRelProperties
7
+ from cartography.models.core.relationships import CartographyRelSchema
8
+ from cartography.models.core.relationships import LinkDirection
9
+ from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import OtherRelationships
11
+ from cartography.models.core.relationships import TargetNodeMatcher
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class ElasticacheTopicNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("TopicArn")
17
+ arn: PropertyRef = PropertyRef("TopicArn", extra_index=True)
18
+ status: PropertyRef = PropertyRef("TopicStatus")
19
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
20
+
21
+
22
+ @dataclass(frozen=True)
23
+ class ElasticacheTopicToAWSAccountRelProperties(CartographyRelProperties):
24
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
25
+
26
+
27
+ @dataclass(frozen=True)
28
+ class ElasticacheTopicToAWSAccountRel(CartographyRelSchema):
29
+ target_node_label: str = "AWSAccount"
30
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
31
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
32
+ )
33
+ direction: LinkDirection = LinkDirection.INWARD
34
+ rel_label: str = "RESOURCE"
35
+ properties: ElasticacheTopicToAWSAccountRelProperties = (
36
+ ElasticacheTopicToAWSAccountRelProperties()
37
+ )
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class ElasticacheTopicToElasticacheClusterRelProperties(CartographyRelProperties):
42
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
43
+
44
+
45
+ @dataclass(frozen=True)
46
+ class ElasticacheTopicToElasticacheClusterRel(CartographyRelSchema):
47
+ target_node_label: str = "ElasticacheCluster"
48
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
49
+ {"id": PropertyRef("cluster_arns", one_to_many=True)}
50
+ )
51
+ direction: LinkDirection = LinkDirection.OUTWARD
52
+ rel_label: str = "CACHE_CLUSTER"
53
+ properties: ElasticacheTopicToElasticacheClusterRelProperties = (
54
+ ElasticacheTopicToElasticacheClusterRelProperties()
55
+ )
56
+
57
+
58
+ @dataclass(frozen=True)
59
+ class ElasticacheTopicSchema(CartographyNodeSchema):
60
+ label: str = "ElasticacheTopic"
61
+ properties: ElasticacheTopicNodeProperties = ElasticacheTopicNodeProperties()
62
+ sub_resource_relationship: ElasticacheTopicToAWSAccountRel = (
63
+ ElasticacheTopicToAWSAccountRel()
64
+ )
65
+ other_relationships: OtherRelationships = OtherRelationships(
66
+ [ElasticacheTopicToElasticacheClusterRel()]
67
+ )
@@ -0,0 +1 @@
1
+ # GuardDuty models
@@ -0,0 +1,102 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.nodes import ExtraNodeLabels
7
+ from cartography.models.core.relationships import CartographyRelProperties
8
+ from cartography.models.core.relationships import CartographyRelSchema
9
+ from cartography.models.core.relationships import LinkDirection
10
+ from cartography.models.core.relationships import make_target_node_matcher
11
+ from cartography.models.core.relationships import OtherRelationships
12
+ from cartography.models.core.relationships import TargetNodeMatcher
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class GuardDutyFindingNodeProperties(CartographyNodeProperties):
17
+ id: PropertyRef = PropertyRef("id")
18
+ arn: PropertyRef = PropertyRef("arn", extra_index=True)
19
+ title: PropertyRef = PropertyRef("title")
20
+ description: PropertyRef = PropertyRef("description")
21
+ type: PropertyRef = PropertyRef("type")
22
+ severity: PropertyRef = PropertyRef("severity")
23
+ confidence: PropertyRef = PropertyRef("confidence")
24
+ eventfirstseen: PropertyRef = PropertyRef("eventfirstseen")
25
+ eventlastseen: PropertyRef = PropertyRef("eventlastseen")
26
+ accountid: PropertyRef = PropertyRef("accountid")
27
+ region: PropertyRef = PropertyRef("region")
28
+ detectorid: PropertyRef = PropertyRef("detectorid")
29
+ resource_type: PropertyRef = PropertyRef("resource_type")
30
+ resource_id: PropertyRef = PropertyRef("resource_id")
31
+ archived: PropertyRef = PropertyRef("archived")
32
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class GuardDutyFindingToAWSAccountRelRelProperties(CartographyRelProperties):
37
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class GuardDutyFindingToAWSAccountRel(CartographyRelSchema):
42
+ target_node_label: str = "AWSAccount"
43
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
44
+ {"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
45
+ )
46
+ direction: LinkDirection = LinkDirection.INWARD
47
+ rel_label: str = "RESOURCE"
48
+ properties: GuardDutyFindingToAWSAccountRelRelProperties = (
49
+ GuardDutyFindingToAWSAccountRelRelProperties()
50
+ )
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class GuardDutyFindingToEC2InstanceRelRelProperties(CartographyRelProperties):
55
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
56
+
57
+
58
+ @dataclass(frozen=True)
59
+ class GuardDutyFindingToEC2InstanceRel(CartographyRelSchema):
60
+ target_node_label: str = "EC2Instance"
61
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
62
+ {"id": PropertyRef("resource_id")},
63
+ )
64
+ direction: LinkDirection = LinkDirection.OUTWARD
65
+ rel_label: str = "AFFECTS"
66
+ properties: GuardDutyFindingToEC2InstanceRelRelProperties = (
67
+ GuardDutyFindingToEC2InstanceRelRelProperties()
68
+ )
69
+
70
+
71
+ @dataclass(frozen=True)
72
+ class GuardDutyFindingToS3BucketRelRelProperties(CartographyRelProperties):
73
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
74
+
75
+
76
+ @dataclass(frozen=True)
77
+ class GuardDutyFindingToS3BucketRel(CartographyRelSchema):
78
+ target_node_label: str = "S3Bucket"
79
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
80
+ {"id": PropertyRef("resource_id")},
81
+ )
82
+ direction: LinkDirection = LinkDirection.OUTWARD
83
+ rel_label: str = "AFFECTS"
84
+ properties: GuardDutyFindingToS3BucketRelRelProperties = (
85
+ GuardDutyFindingToS3BucketRelRelProperties()
86
+ )
87
+
88
+
89
+ @dataclass(frozen=True)
90
+ class GuardDutyFindingSchema(CartographyNodeSchema):
91
+ label: str = "GuardDutyFinding"
92
+ properties: GuardDutyFindingNodeProperties = GuardDutyFindingNodeProperties()
93
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["Risk"])
94
+ sub_resource_relationship: GuardDutyFindingToAWSAccountRel = (
95
+ GuardDutyFindingToAWSAccountRel()
96
+ )
97
+ other_relationships: OtherRelationships = OtherRelationships(
98
+ [
99
+ GuardDutyFindingToEC2InstanceRel(),
100
+ GuardDutyFindingToS3BucketRel(),
101
+ ],
102
+ )
@@ -0,0 +1,74 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.relationships import CartographyRelProperties
7
+ from cartography.models.core.relationships import CartographyRelSchema
8
+ from cartography.models.core.relationships import LinkDirection
9
+ from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import OtherRelationships
11
+ from cartography.models.core.relationships import TargetNodeMatcher
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class GitHubDependencyNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ name: PropertyRef = PropertyRef("name")
18
+ original_name: PropertyRef = PropertyRef("original_name")
19
+ version: PropertyRef = PropertyRef("version")
20
+ ecosystem: PropertyRef = PropertyRef("ecosystem")
21
+ package_manager: PropertyRef = PropertyRef("package_manager")
22
+ repo_name: PropertyRef = PropertyRef("repo_name")
23
+ manifest_file: PropertyRef = PropertyRef("manifest_file")
24
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
25
+
26
+
27
+ @dataclass(frozen=True)
28
+ class GitHubDependencyToRepositoryRelProperties(CartographyRelProperties):
29
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
30
+ requirements: PropertyRef = PropertyRef("requirements")
31
+ manifest_path: PropertyRef = PropertyRef("manifest_path")
32
+
33
+
34
+ @dataclass(frozen=True)
35
+ class GitHubDependencyToRepositoryRel(CartographyRelSchema):
36
+ target_node_label: str = "GitHubRepository"
37
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
38
+ {"id": PropertyRef("repo_url", set_in_kwargs=True)}
39
+ )
40
+ direction: LinkDirection = LinkDirection.INWARD
41
+ rel_label: str = "REQUIRES"
42
+ properties: GitHubDependencyToRepositoryRelProperties = (
43
+ GitHubDependencyToRepositoryRelProperties()
44
+ )
45
+
46
+
47
+ @dataclass(frozen=True)
48
+ class DependencyGraphManifestToDependencyRelProperties(CartographyRelProperties):
49
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
50
+
51
+
52
+ @dataclass(frozen=True)
53
+ class DependencyGraphManifestToDependencyRel(CartographyRelSchema):
54
+ target_node_label: str = "DependencyGraphManifest"
55
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
56
+ {"id": PropertyRef("manifest_id", set_in_kwargs=True)}
57
+ )
58
+ direction: LinkDirection = LinkDirection.INWARD
59
+ rel_label: str = "HAS_DEP"
60
+ properties: DependencyGraphManifestToDependencyRelProperties = (
61
+ DependencyGraphManifestToDependencyRelProperties()
62
+ )
63
+
64
+
65
+ @dataclass(frozen=True)
66
+ class GitHubDependencySchema(CartographyNodeSchema):
67
+ label: str = "Dependency"
68
+ properties: GitHubDependencyNodeProperties = GitHubDependencyNodeProperties()
69
+ sub_resource_relationship: GitHubDependencyToRepositoryRel = (
70
+ GitHubDependencyToRepositoryRel()
71
+ )
72
+ other_relationships: OtherRelationships = OtherRelationships(
73
+ [DependencyGraphManifestToDependencyRel()]
74
+ )