diff --git a/README.md b/README.md index 19440f418112fcaef89f90c7025830e4cffef8a2..79d0ef19e33702b7df7cfb8ff977f33807bd4549 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,19 @@ This repository contains tools to parse contacts from eduGAIN metadata and from the eduGAIN APIs published on https://technical.edugain.org/api.php. +## Identity federations contacts + +Script name :`identity_federations_contacts.py` + +This script consume the eduGAIN API to retrieve the details of all the eduGAIN identity +federations and parse it to create a list of contacts per each federation in CSV format. This list will be printed to stdout. + +CSV Format: + +``` +FEDERATION,COUNTRIES,SECURITY CONTACT,FEDERATION CONTACT +``` + ## Identity federations security contacts Script name :`identity_federations_security_contacts.py` @@ -20,3 +33,44 @@ This script will download the current edugain metadata aggregate XML and parse a identity providers found in order to derive a list of Organization names, domains and security contacts in CSV format. This list will be printed to stdout. +## Entities Details + +Script: `entity_details.py` + +This script will print out some details about a single entity or a list of entities +passed as a list of entityIDs. + +CSV Format: + +``` +entityID,FederationName,RegistrationAuthority,OrganizationName,TechnicalContact,SupportContact,AdministrativeContact +``` + +Usage: + +``` +usage: entity_details.py [-h] [-e E] [-f F] [-u U] [ENTITYID] + +Show detailed information about an eduGAIN entity. + +positional arguments: + ENTITYID entityID of the entity to look up + +options: + -h, --help show this help message and exit + -e E load entityIDs from file E + -f F load metadata from file F + -u U download metadata from url U (default to https://mds.edugain.org/edugain-v2.xml) + +Examples + +- Retrieve details about a single entity using eduGAIN metadata: + +./entity_details.py https://idp.dir.garr.it/idp/shibboleth + +- Retrieve details for a list of idps using a local metadata file: + +./entity_details.py -e idp_list -f edugain-v2.xml +``` + + diff --git a/identity_federations_contacts.py b/identity_federations_contacts.py new file mode 100755 index 0000000000000000000000000000000000000000..7ba5db77cb507ef4c48d0b69b43fa4be2c7360c6 --- /dev/null +++ b/identity_federations_contacts.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +# This script consume the eduGAIN API to retrieve the details of all the +# eduGAIN identity federations and parse it to create a list of security +# email addresses, if available, and the corresponding federation name in +# CSV format. +# This list will be printed to stdout. + +import requests + +feds = requests.get('https://technical.edugain.org/api.php?action=list_feds_full') + +feds_dict = feds.json() + +print('FEDERATION,COUNTRIES,SECURITY CONTACT,FEDERATION CONTACT') + +for fed in feds_dict: + if feds_dict[fed]['status'] == '6': + countries = "" + security_contact = "" + if 'security_contact' in feds_dict[fed]: + if 'mail' in feds_dict[fed]['security_contact']: + security_contact = feds_dict[fed]['security_contact']['mail']['value'] + if 'countries' in feds_dict[fed]: + countries_array = feds_dict[fed]['countries'] + for country in countries_array: + countries = countries + " " + country + print(f"{fed},{countries.strip()},{security_contact},{feds_dict[fed]['contact_email']}")