Created
February 3, 2022 15:53
-
-
Save bandrel/a60983dc3c0f7d7a8f1fe9ced426a70e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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