## Global Domain Test #domain = 'Global' #ac_policy = 'december-hackathon-global-acp' #api = FireREST(hostname=device, username=username, password=password) policyFile = open(ac_policy + ".csv", "w") # Get IDs for specified objects. API PK = UUID, so we have to find the matching api object for the name specified. if ac_policy: acp_id = api.get_acp_id_by_name(ac_policy) else: acp_id = "Not defined" print("-" * 85) print("Domain: " + api.get_domain_id(domain)) print("-" * 85) print("Access control policy: {0}: {1}".format(ac_policy, acp_id)) print("-" * 85) # Write CSV Header policyFile.write( "#, name, enabled, action, sourceZones, destZones, sourceNetworks, destNetworks, sourcePorts, " "destPorts, ipsPolicy, variableSet, filePolicy, logBegin, logEnd, sendEventsToFMC, syslogConfig\n" ) # Get all access control rules for the access control policy specified acp_rules = api.get_acp_rules(acp_id, expanded=True) # Loop through HTTP response objects for response in acp_rules:
result_file = None error_file = None def print_json(json_object): print(json.dumps(json_object.json(), indent=1)) def pretty_json(json_object): return json.dumps(json_object.json(), indent=1) # Initialize a new api object api = FireREST(hostname=device, username=username, password=password) domain_id = api.get_domain_id(domain) # Parent: Blocked-IPs-Security-Requested-FTDMig : 00505697-2F31-0ed3-0000-008590003520 # Child: Blocked-IPs-Security-Requested_split_1 : 00505697-2F31-0ed3-0000-008589941259 # Child: Blocked-IPs-Security-Requested_split_2-FTDMig: 00505697-2F31-0ed3-0000-008590003460 def main(): lines = log_file.readlines() line_count = 0 object_group = '' dictionary = dict() for line in lines: line_count += 1