Debian Codegraph @

examples/search/view_host_certificates.py

raw
1 """View host certificates."""
2
3 from censys.search import CensysHosts
4
5 h = CensysHosts()
6
7 # Fetch a list of certificates for the specified IP address.
8 certificates = h.view_host_certificates("1.1.1.1")
9 # print(certificates)
10
11 # You can also pass in a date or datetime objects.
12 from datetime import date
13
14 certificates = h.view_host_certificates("1.1.1.1", per_page=1, start_time=date(2023, 1, 1))
15 print(certificates)
16 # {
17 # "ip": "1.1.1.1",
18 # "certificates": [
19 # {
20 # "fingerprint": "string",
21 # "port": 0,
22 # "service_name": "string",
23 # "transport_protocol": "TCP",
24 # "first_observed_at": "2023-10-02T13:32:26.202Z",
25 # "last_observed_at": "2023-10-02T13:32:26.202Z",
26 # "first_updated_at": "2023-10-02T13:32:26.202Z",
27 # "last_updated_at": "2023-10-02T13:32:26.202Z",
28 # },
29 # ...
30 # ],
31 # "links": {"next": "nextCursorToken"},
32 # }