IBM QRadar SOAR

IBM QRadar

Join this online topic group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#Security
#QRadar
#SecuringhybridcloudandAI
 View Only
  • 1.  Python script to get a list of installed Custom Threat Source

    Posted 07/20/20 05:15 AM
    Hi

    As of today we have a command (resutil threatserviceshow) which show the installed Custom Threat Sources for Resilient.
    Is there a way to do this with a Python script ? I mean, something like calling an API (no a command call in a .py script).

    I achieved successfully how to see some properties of a CTS with the following code:

    import json
    import resilient


    class ArgumentParser(resilient.ArgumentParser):
    def __init__(self, config_file=None):
    super(ArgumentParser, self).__init__(config_file=config_file)


    parser = ArgumentParser(config_file=resilient.get_config_file())
    opts = parser.parse_args()

    # Create SimpleClient for a REST connection to the Resilient services
    resilient_client = resilient.get_client(opts)

    switch_cts = "true" # false or true
    payload = {"id": 110, "uuid": "uuid_number", "name": "cts_name", "description": None,
    "enabled": switch_cts, "custom": "true", "properties": {}, "tos_agreement_date": None, "tos": None,
    "prompt_license": "false", "license": None}

    threat_sources = resilient_client.put('/threat_sources/110', payload)
    print(json.dumps(threat_sources, indent=4))

    As you can see, I have to pass an ID in the payload (and also in the PUT request). For example, does exist a parameter (to pass in the call) which give me all ID's ?

    My main goal is to have a list of CTS and enable/disable them by code.

    Thanks

    ------------------------------
    Lucian Sipos
    ------------------------------


  • 2.  RE: Python script to get a list of installed Custom Threat Source

    Posted 07/20/20 05:56 AM
    Was easier than I thought.

    threat_sources = resilient_client.get('/threat_sources/')
    print(json.dumps(threat_sources, indent=4))


    ------------------------------
    Lucian Sipos
    ------------------------------