Skip to content

Commit 9ee3e09

Browse files
committed
add example using logbook cursor and host asset
1 parent 94022b5 commit 9ee3e09

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

examples/asm/get_host_risks.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Retrieve host risks and subsequent host info for each host risk."""
2+
from censys.asm import Events, HostsAssets
3+
4+
e = Events()
5+
h = HostsAssets()
6+
7+
cursor = e.get_cursor(filters=["HOST_RISK"])
8+
events = e.get_events(cursor)
9+
10+
for event in events:
11+
# only show logbook events with the 'add' tag
12+
if event["operation"] == "ADD":
13+
print(event)
14+
15+
# enrich the data of this host_risk with more data from the host itself
16+
host = h.get_asset_by_id(event["entity"]["ipAddress"])
17+
print(host)

0 commit comments

Comments
 (0)