Skip to content

Commit 8c50430

Browse files
authored
Merge pull request #9 from Axonius/improve.ip-search
Changing ip lookup device query
2 parents f98308f + a1f2aa6 commit 8c50430

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

custom_axonius_helpers.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ def find_ip(ip_address: str) -> dict: # pylint: disable=R1260,R0911
199199
}
200200
return out
201201

202-
query = f'("specific_data.data.network_interfaces.ips" == regex("{ip_address}", "i"))'
202+
query = f'("specific_data.data.public_ips" == regex("{ip_address}", "i"))'
203203
fields = [
204204
"specific_data.data.last_seen",
205-
"specific_data.data.email",
205+
"specific_data.data.last_used_users_mail_association",
206206
]
207207
params = {"filter": query, "fields": {"devices": fields}}
208208
try:
@@ -215,7 +215,11 @@ def find_ip(ip_address: str) -> dict: # pylint: disable=R1260,R0911
215215
res = res.get("data")
216216
ip_users = []
217217
for record in res:
218-
ip_users.append(record.get("attributes").get("specific_data.data.email"))
218+
ip_users.append(
219+
record.get("attributes").get(
220+
"specific_data.data.last_used_users_mail_association"
221+
)
222+
)
219223

220224
res = res[0].get("attributes")
221225
out = {

0 commit comments

Comments
 (0)