Skip to content

Instantly share code, notes, and snippets.

@bandrel
Created February 3, 2022 15:53
Show Gist options
  • Save bandrel/a60983dc3c0f7d7a8f1fe9ced426a70e to your computer and use it in GitHub Desktop.
Save bandrel/a60983dc3c0f7d7a8f1fe9ced426a70e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import os
import caracara
import sys
hosts = caracara.HostsToolbox(key=os.environ["FALCON_CLIENT_ID"],secret=os.environ["FALCON_CLIENT_SECRET"],verbose=True)
with open(sys.argv[1]) as doc:
for _hostname in doc.readlines():
target_aid = hosts.host.find_host_aid(hostname=_hostname.strip())
if target_aid:
hostname = hosts.host.get_host(target_aid)[0]["hostname"]
else:
print(f'{_hostname.strip()} is not in CSFalcon')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment