Get Reports

TruStar.get_reports(is_enclave=None, enclave_ids=None, tag=None, excluded_tags=None, from_time=None, to_time=None)

Uses the get_reports_page method to create a generator that returns each successive report as a trustar report object.

Parameters:
  • is_enclave (boolean) – restrict reports to specific distribution type (optional - by default all accessible reports are returned).
  • enclave_ids (list(str)) – list of enclave ids used to restrict reports to specific enclaves (optional - by default reports from all enclaves are returned)
  • tag (list(str)) – a list of tags; only reports containing ALL of these tags will be returned. If a tag with this name exists in more than one enclave in the list passed as the enclave_ids argument, the request will fail. Handle this by making separate requests for each enclave ID if necessary.
  • excluded_tags (list(str)) – a list of tags; reports containing ANY of these tags will not be returned.
  • from_time (int) – start of time window in milliseconds since epoch (optional)
  • to_time (int) – end of time window in milliseconds since epoch (optional)
Returns:

A generator of Report objects.

Note: If a report contains all of the tags in the list passed as argument to the ‘tag’ parameter and also contains any (1 or more) of the tags in the list passed as argument to the ‘excluded_tags’ parameter, that report will not be returned by this function.

Example:

>>> page = ts.get_reports(is_enclave=True, tag="malicious", from_time=1425695711000, to_time=1514185311000)
>>> for report in reports: print((report.id))
'661583cb-a6a7-4cbd-8a90-01578fa4da89'
'da131660-2708-4c8a-926e-f91fb5dbbc62'
'2e3400d6-fa37-4a8c-bc2f-155aaa02ae5a'
'38064828-d3db-4fff-8ab8-e0e3b304ff44'
'dbf26104-cee5-4ca4-bdbf-a01d0178c007'