| 1 |
"""View specific host.""" |
| 2 |
|
| 3 |
from censys.search import CensysHosts |
| 4 |
|
| 5 |
h = CensysHosts() |
| 6 |
|
| 7 |
# Fetch a specific host and its services |
| 8 |
host = h.view("8.8.8.8") |
| 9 |
print(host) |
| 10 |
|
| 11 |
# You can optionally pass in a RFC3339 timestamp to |
| 12 |
# fetch a host at the given point in time. |
| 13 |
# Please note historical API access is required. |
| 14 |
host = h.view("8.8.8.8", at_time="2021-03-01T17:49:05Z") |
| 15 |
print(host) |
| 16 |
|
| 17 |
# You can also pass in a date or datetime object. |
| 18 |
from datetime import date |
| 19 |
|
| 20 |
host = h.view("8.8.8.8", at_time=date(2021, 3, 1)) |
| 21 |
print(host) |
| 22 |
# { |
| 23 |
# "ip": "8.8.8.8", |
| 24 |
# "services": [ |
| 25 |
# { |
| 26 |
# "dns": { |
| 27 |
# "server_type": "FORWARDING", |
| 28 |
# "resolves_correctly": False, |
| 29 |
# "r_code": "UNKNOWN_CODE", |
| 30 |
# }, |
| 31 |
# "extended_service_name": "DNS", |
| 32 |
# "observed_at": "2021-02-28T23:58:55.705035895Z", |
| 33 |
# "perspective_id": "PERSPECTIVE_TELIA", |
| 34 |
# "port": 53, |
| 35 |
# "service_name": "DNS", |
| 36 |
# "source_ip": "74.120.14.37", |
| 37 |
# "transport_protocol": "UDP", |
| 38 |
# "truncated": False, |
| 39 |
# }, |
| 40 |
# ..., |
| 41 |
# ], |
| 42 |
# "location": { |
| 43 |
# "continent": "North America", |
| 44 |
# "country": "United States", |
| 45 |
# "country_code": "US", |
| 46 |
# "postal_code": "", |
| 47 |
# "timezone": "America/Chicago", |
| 48 |
# "coordinates": {"latitude": 37.751, "longitude": -97.822}, |
| 49 |
# "registered_country": "United States", |
| 50 |
# "registered_country_code": "US", |
| 51 |
# }, |
| 52 |
# "location_updated_at": "2022-01-20T16:08:47.237933Z", |
| 53 |
# "autonomous_system": { |
| 54 |
# "asn": 15169, |
| 55 |
# "description": "GOOGLE", |
| 56 |
# "bgp_prefix": "8.8.8.0/24", |
| 57 |
# "name": "GOOGLE", |
| 58 |
# "country_code": "US", |
| 59 |
# }, |
| 60 |
# "autonomous_system_updated_at": "2022-01-20T16:08:47.237933Z", |
| 61 |
# "dns": {}, |
| 62 |
# "last_updated_at": "2021-02-28T23:58:55.765Z", |
| 63 |
# } |