@@ -5548,7 +5548,42 @@ def __csv_core_network_vcn_security_lists(self, region_name, sec_lists, vcn):
55485548
55495549 for sl in sec_lists:
55505550 if len(sl['sec_rules']) == 0:
5551- data = {'region_name': region_name,
5551+ data = {
5552+ 'region_name': region_name,
5553+ 'vcn_name': vcn['display_name'],
5554+ 'vcn_cidr': "",
5555+ 'vcn_cidrs': str(','.join(x for x in vcn['cidr_blocks'])),
5556+ 'vcn_compartment': vcn['compartment_name'],
5557+ 'vcn_compartment_path': vcn['compartment_path'],
5558+ 'sec_name': sl['name'],
5559+ 'sec_compartment': sl['compartment_name'],
5560+ 'sec_compartment_path': sl['compartment_path'],
5561+ 'sec_rules': "Empty",
5562+ 'direction': "",
5563+ 'is_stateless': "",
5564+ 'source': "",
5565+ 'destination': "",
5566+ 'protocol': "",
5567+ 'sec_protocol': "",
5568+ 'src_port_min': "",
5569+ 'src_port_max': "",
5570+ 'dst_port_min': "",
5571+ 'dst_port_max': "",
5572+ 'icmp_code': "",
5573+ 'icmp_type': "",
5574+ 'description': "",
5575+ 'security_alert': "FALSE",
5576+ 'time_created': sl['time_created'][0:16],
5577+ 'vcn_id': vcn['id'],
5578+ 'sec_id': sl['id'],
5579+ 'id': sl['id'] + ":" + str(hash("Empty"))
5580+ }
5581+ self.csv_network_security_list.append(data)
5582+
5583+ else:
5584+ for slr in sl['sec_rules']:
5585+ data = {
5586+ 'region_name': region_name,
55525587 'vcn_name': vcn['display_name'],
55535588 'vcn_cidr': "",
55545589 'vcn_cidrs': str(','.join(x for x in vcn['cidr_blocks'])),
@@ -5557,57 +5592,26 @@ def __csv_core_network_vcn_security_lists(self, region_name, sec_lists, vcn):
55575592 'sec_name': sl['name'],
55585593 'sec_compartment': sl['compartment_name'],
55595594 'sec_compartment_path': sl['compartment_path'],
5560- 'sec_protocol': "",
5561- 'src_port_min': "",
5562- 'src_port_max': "",
5563- 'is_stateless': "",
5564- 'description': "",
5565- 'destination': "",
5566- 'dst_port_min': "",
5567- 'dst_port_max': "",
5568- 'icmp_code': "",
5569- 'icmp_type': "",
5570- 'direction': "",
5571- 'security_alert': "FALSE",
5572- 'sec_rules': "Empty",
5573- 'time_created': sl['time_created'][0:16],
5595+ 'sec_rules': slr['desc'],
5596+ 'direction': slr['direction'],
5597+ 'is_stateless': slr['is_stateless'],
5598+ 'source': slr['source'],
5599+ 'destination': slr['destination'],
5600+ 'protocol': slr['protocol'],
5601+ 'sec_protocol': slr['protocol_name'],
5602+ 'src_port_min': slr['src_port_min'],
5603+ 'src_port_max': slr['src_port_max'],
5604+ 'dst_port_min': slr['dst_port_min'],
5605+ 'dst_port_max': slr['dst_port_max'],
5606+ 'icmp_code': slr['icmp_code'],
5607+ 'icmp_type': slr['icmp_type'],
5608+ 'security_alert': slr['security_alert'],
5609+ 'description': slr['description'],
5610+ 'time_created': sl['time_created'],
55745611 'vcn_id': vcn['id'],
55755612 'sec_id': sl['id'],
5576- 'id': sl['id'] + ":" + str(hash("Empty"))
5577- }
5578- self.csv_network_security_list.append(data)
5579-
5580- else:
5581- for slr in sl['sec_rules']:
5582- data = {'region_name': region_name,
5583- 'vcn_name': vcn['display_name'],
5584- 'vcn_cidr': "",
5585- 'vcn_cidrs': str(','.join(x for x in vcn['cidr_blocks'])),
5586- 'vcn_compartment': vcn['compartment_name'],
5587- 'vcn_compartment_path': vcn['compartment_path'],
5588- 'sec_name': sl['name'],
5589- 'sec_compartment': sl['compartment_name'],
5590- 'sec_compartment_path': sl['compartment_path'],
5591- 'source': slr['source'],
5592- 'protocol': slr['protocol'],
5593- 'sec_protocol': slr['protocol_name'],
5594- 'src_port_min': slr['src_port_min'],
5595- 'src_port_max': slr['src_port_max'],
5596- 'is_stateless': slr['is_stateless'],
5597- 'description': slr['description'],
5598- 'destination': slr['destination'],
5599- 'dst_port_min': slr['dst_port_min'],
5600- 'dst_port_max': slr['dst_port_max'],
5601- 'icmp_code': slr['icmp_code'],
5602- 'icmp_type': slr['icmp_type'],
5603- 'direction': slr['direction'],
5604- 'security_alert': slr['security_alert'],
5605- 'sec_rules': slr['desc'],
5606- 'time_created': sl['time_created'],
5607- 'vcn_id': vcn['id'],
5608- 'sec_id': sl['id'],
5609- 'id': sl['id'] + ":" + str(hash(slr['desc']))
5610- }
5613+ 'id': sl['id'] + ":" + str(hash(slr['desc']))
5614+ }
56115615 # check if id is in the list already
56125616 item_exists = False
56135617 for ls in self.csv_network_security_list:
@@ -5813,7 +5817,49 @@ def __csv_core_network_vcn_security_groups(self, region_name, nsg, vcn):
58135817
58145818 for sl in nsg:
58155819 if len(sl['sec_rules']) == 0:
5816- data = {'region_name': region_name,
5820+ data = {
5821+ 'region_name': region_name,
5822+ 'vcn_name': vcn['display_name'],
5823+ 'vcn_cidr': "",
5824+ 'vcn_cidrs': str(','.join(x for x in vcn['cidr_blocks'])),
5825+ 'vcn_compartment': vcn['compartment_name'],
5826+ 'vcn_compartment_path': vcn['compartment_path'],
5827+ 'sec_name': sl['name'],
5828+ 'sec_compartment': sl['compartment_name'],
5829+ 'sec_compartment_path': sl['compartment_path'],
5830+ 'rule_id': '',
5831+ 'sec_rules': "Empty",
5832+ 'direction': '',
5833+ 'is_stateless': '',
5834+ 'is_valid': '',
5835+ 'source': '',
5836+ 'source_name': '',
5837+ 'source_type': '',
5838+ 'destination': '',
5839+ 'destination_name': '',
5840+ 'destination_type': '',
5841+ 'protocol': '',
5842+ 'sec_protocol': '',
5843+ 'src_port_min': '',
5844+ 'src_port_max': '',
5845+ 'dst_port_min': '',
5846+ 'dst_port_max': '',
5847+ 'icmp_code': '',
5848+ 'icmp_type': '',
5849+ 'sec_time_created': '',
5850+ 'security_alert': "FALSE",
5851+ 'description': '',
5852+ 'time_created': sl['time_created'],
5853+ 'vcn_id': vcn['id'],
5854+ 'sec_id': sl['id'],
5855+ 'id': sl['id'] + ":Empty"
5856+ }
5857+ self.csv_network_security_group.append(data)
5858+
5859+ else:
5860+ for slr in sl['sec_rules']:
5861+ data = {
5862+ 'region_name': region_name,
58175863 'vcn_name': vcn['display_name'],
58185864 'vcn_cidr': "",
58195865 'vcn_cidrs': str(','.join(x for x in vcn['cidr_blocks'])),
@@ -5822,73 +5868,33 @@ def __csv_core_network_vcn_security_groups(self, region_name, nsg, vcn):
58225868 'sec_name': sl['name'],
58235869 'sec_compartment': sl['compartment_name'],
58245870 'sec_compartment_path': sl['compartment_path'],
5825- 'rule_id': '' ,
5826- 'protocol ': '' ,
5827- 'sec_protocol ': '' ,
5828- 'is_stateless ': '' ,
5829- 'description ': '' ,
5830- 'direction ': '' ,
5831- 'destination ': '' ,
5832- 'destination_name ': '' ,
5833- 'destination_type ': '' ,
5834- 'source ': '' ,
5835- 'source_name ': '' ,
5836- 'source_type ': '' ,
5837- 'is_valid ': '' ,
5838- 'src_port_min': '' ,
5839- 'src_port_max': '' ,
5840- 'dst_port_min': '' ,
5841- 'dst_port_max': '' ,
5842- 'icmp_code': '' ,
5843- 'icmp_type': '' ,
5844- 'sec_time_created ': '' ,
5845- 'security_alert': "FALSE" ,
5846- 'sec_rules ': "Empty" ,
5871+ 'rule_id': slr['id'] ,
5872+ 'sec_rules ': slr['desc'] ,
5873+ 'direction ': slr['direction'] ,
5874+ 'protocol ': slr['protocol'] ,
5875+ 'sec_protocol ': slr['protocol_name'] ,
5876+ 'is_stateless ': slr['is_stateless'] ,
5877+ 'is_valid ': slr['is_valid'] ,
5878+ 'source ': slr['source'] ,
5879+ 'source_name ': slr['source_name'] ,
5880+ 'source_type ': slr['source_type'] ,
5881+ 'destination ': slr['destination'] ,
5882+ 'destination_name ': slr['destination_name'] ,
5883+ 'destination_type ': slr['destination_type'] ,
5884+ 'src_port_min': slr['src_port_min'] ,
5885+ 'src_port_max': slr['src_port_max'] ,
5886+ 'dst_port_min': slr['dst_port_min'] ,
5887+ 'dst_port_max': slr['dst_port_max'] ,
5888+ 'icmp_code': slr['icmp_code'] ,
5889+ 'icmp_type': slr['icmp_type'] ,
5890+ 'description ': slr['description'] ,
5891+ 'security_alert': slr['security_alert'] ,
5892+ 'sec_time_created ': slr['time_created'] ,
58475893 'time_created': sl['time_created'],
58485894 'vcn_id': vcn['id'],
58495895 'sec_id': sl['id'],
5850- 'id': sl['id'] + ":Empty"
5851- }
5852- self.csv_network_security_group.append(data)
5853-
5854- else:
5855- for slr in sl['sec_rules']:
5856- data = {'region_name': region_name,
5857- 'vcn_name': vcn['display_name'],
5858- 'vcn_cidr': "",
5859- 'vcn_cidrs': str(','.join(x for x in vcn['cidr_blocks'])),
5860- 'vcn_compartment': vcn['compartment_name'],
5861- 'vcn_compartment_path': vcn['compartment_path'],
5862- 'sec_name': sl['name'],
5863- 'sec_compartment': sl['compartment_name'],
5864- 'sec_compartment_path': sl['compartment_path'],
5865- 'rule_id': slr['id'],
5866- 'protocol': slr['protocol'],
5867- 'sec_protocol': slr['protocol_name'],
5868- 'is_stateless': slr['is_stateless'],
5869- 'description': slr['description'],
5870- 'security_alert': slr['security_alert'],
5871- 'direction': slr['direction'],
5872- 'destination': slr['destination'],
5873- 'destination_name': slr['destination_name'],
5874- 'destination_type': slr['destination_type'],
5875- 'source': slr['source'],
5876- 'source_name': slr['source_name'],
5877- 'source_type': slr['source_type'],
5878- 'is_valid': slr['is_valid'],
5879- 'src_port_min': slr['src_port_min'],
5880- 'src_port_max': slr['src_port_max'],
5881- 'dst_port_min': slr['dst_port_min'],
5882- 'dst_port_max': slr['dst_port_max'],
5883- 'icmp_code': slr['icmp_code'],
5884- 'icmp_type': slr['icmp_type'],
5885- 'sec_rules': slr['desc'],
5886- 'sec_time_created': slr['time_created'],
5887- 'time_created': sl['time_created'],
5888- 'vcn_id': vcn['id'],
5889- 'sec_id': sl['id'],
5890- 'id': sl['id'] + ":" + slr['id']
5891- }
5896+ 'id': sl['id'] + ":" + slr['id']
5897+ }
58925898
58935899 # check if id is in the list already
58945900 item_exists = False
0 commit comments