Created
November 2, 2018 00:56
-
-
Save jfrantz1-r7/67811ab7eb09e3f29fdc1d3bce14aab2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import requests | |
# this url is to your console API endpoint | |
url = "https://<console IP>/api/3/assets/search?size=500&page=0" | |
# quick and dirty, stores creds (you can use cyberark's api to pull down creds) | |
r = requests.post(url, auth=('nxadmin', 'nxpassword'), json={"filters": [{"field": "operating-system", "operator": "is-empty"}, {"field": "host-name", "operator": "is-empty"}], "match": "all"}, verify=False) | |
assets = r.json() | |
# loops through every asset pulled back that hasn't been scanned and deletes it | |
for i in assets["resources"]: | |
asset_id = i["id"] | |
url = "https://<console ip>:3780/api/3/assets/" + str(asset_id) | |
requests.delete(url, auth=('nxadmin', 'nxpassword'), verify=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment