How to Delete Splunk Phantom Custom Lists Using Python
To delete a custom list in Splunk Phantom using Python, you can use the following code:
import requests
import json
phantom_host = 'https://your.phantom.server'
phantom_token = 'your_phantom_token'
list_id = 123 # replace with the ID of the custom list you want to delete
headers = {
'ph-auth-token': phantom_token,
'Content-Type': 'application/json'
}
url = f'{phantom_host}/rest/custom_list/{list_id}'
response = requests.delete(url, headers=headers)
if response.status_code == 200:
print('Custom list deleted successfully')
else:
print(f'Error deleting custom list. Status code: {response.status_code}')
This code makes a DELETE request to the Splunk Phantom API to delete the custom list with the specified ID. Make sure to replace 'phantom_host' and 'phantom_token' with your own values. Also, replace 'list_id' with the ID of the custom list you want to delete.
原文地址: https://www.cveoy.top/t/topic/on93 著作权归作者所有。请勿转载和采集!