IBM QRadar SOAR

IBM QRadar

Join this online user 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.

 View Only
  • 1.  'FunctionMessage' has no attribute 'name'

    Posted Fri February 15, 2019 12:59 PM
    Edited by Anthony Bufort Fri February 15, 2019 04:07 PM
    Hello,

    Needing some help here.  Getting the following error message whenever I test my function and not sure what could be causing it.

    2019-02-15 09:32:55,080 ERROR [actions_component] type object 'FunctionMessage' has no attribute 'name'
    Traceback (most recent call last):
    File "c:\study\python\pycharmprojects\poc\dt_poc\venv\lib\site-packages\resilient_circuits\actions_component.py", line 421, in on_stomp_message
    log_dir=self.logging_directory)
    File "c:\study\python\pycharmprojects\poc\dt_poc\venv\lib\site-packages\resilient_circuits\action_message.py", line 243, in __init__
    self._log_message(log_dir)
    File "c:\study\python\pycharmprojects\poc\dt_poc\venv\lib\site-packages\resilient_circuits\action_message.py", line 110, in _log_message
    filename = "_".join((self.__class__.name, self.displayname,
    AttributeError: type object 'FunctionMessage' has no attribute 'name'

    The function:

    # -*- coding: utf-8 -*-
    # pragma pylint: disable=unused-argument, no-self-use
    """Function implementation"""

    import logging
    from resilient_circuits import ResilientComponent, function, handler, StatusMessage, FunctionResult, FunctionError
    import dt_poc.util.selftest as selftest


    class FunctionComponent(ResilientComponent):
    """Component that implements Resilient function 'fn_record_domaintools_domain_risk_score"""

    def __init__(self, opts):
    """constructor provides access to the configuration options"""
    super(FunctionComponent, self).__init__(opts)
    self.options = opts.get("dt_poc", {})
    selftest.selftest_function(opts)

    @handler("reload")
    def _reload(self, event, opts):
    """Configuration options have changed, save new values"""
    self.options = opts.get("dt_poc", {})

    @function("fn_record_domaintools_domain_risk_score")
    def _fn_record_domaintools_domain_risk_score_function(self, event, *args, **kwargs):
    """Function: """
    try:
    # Get the function parameters:
    domaintools_domain_name = kwargs.get("domaintools_domain_name") # text

    log = logging.getLogger(__name__)
    log.info("domaintools_domain_name: %s", domaintools_domain_name)

    # PUT YOUR FUNCTION IMPLEMENTATION CODE HERE
    # yield StatusMessage("starting...")
    # yield StatusMessage("done...")

    results = {
    "value": "xyz"
    }

    # Produce a FunctionResult with the results
    yield FunctionResult(results)
    except Exception:
    yield FunctionError()

    This is all very out-of-the-box (not much customization yet, as you can see), so something fundamental must be the issue.

    I am on resilient-circuits 32.0.0

    The full log:

    2019-02-15 13:02:20,236 DEBUG [client] Received MESSAGE frame [headers={'timestamp': '1550264531111', 'reply-to': '/queue/acks.233.domaintools', 'persistent': 'true', 'Co3ContentType': 'a
    pplication/json', 'message-id': 'ID:partnerlab-42560-1546612026534-3:2:2716:1:1', 'Co3MessagePayload': 'FunctionDataDTO', 'priority': '4', 'subscription': 'actions.233.domaintools', 'ack'
    : 'ID:partnerlab-40690-1546611986322-412:7', 'JMSXUserID': 'SYSTEM', 'destination': '/queue/actions.233.domaintools', 'correlation-id': 'invid:9146', 'Co3ContextToken': 'eyJhbGciOiJIUzI1N
    iJ9.bnVsbA.nPkoA3LJlnkErRnptTlIXX3fJ7rWVzzHRSPiM_JbnHU', 'expires': '0'}, body=b'{"function":{"creato...', version=1.2]
    <Message[stomp] ()>
    2019-02-15 13:02:20,245 DEBUG [stomp_component] Stomp message received
    2019-02-15 13:02:20,247 DEBUG [actions_component] STOMP listener: message for actions.233.domaintools
    2019-02-15 13:02:20,249 DEBUG [actions_component] Got Message: MESSAGE frame [headers={'timestamp': '1550264531111', 'reply-to': '/queue/acks.233.domaintools', 'persistent': 'true', 'Co3C
    ontentType': 'application/json', 'message-id': 'ID:partnerlab-42560-1546612026534-3:2:2716:1:1', 'Co3MessagePayload': 'FunctionDataDTO', 'priority': '4', 'subscription': 'actions.233.doma
    intools', 'ack': 'ID:partnerlab-40690-1546611986322-412:7', 'JMSXUserID': 'SYSTEM', 'destination': '/queue/actions.233.domaintools', 'correlation-id': 'invid:9146', 'Co3ContextToken': 'ey
    JhbGciOiJIUzI1NiJ9.bnVsbA.nPkoA3LJlnkErRnptTlIXX3fJ7rWVzzHRSPiM_JbnHU', 'expires': '0'}, body=b'{"function":{"creato...', version=1.2]
    2019-02-15 13:02:20,253 DEBUG [action_message] Source: <Actions/* 2056:MainThread (queued=0) [S]>
    2019-02-15 13:02:20,255 DEBUG [action_message] Headers: {
    "timestamp": "1550264531111",
    "reply-to": "/queue/acks.233.domaintools",
    "persistent": "true",
    "Co3ContentType": "application/json",
    "message-id": "ID:partnerlab-42560-1546612026534-3:2:2716:1:1",
    "Co3MessagePayload": "FunctionDataDTO",
    "priority": "4",
    "subscription": "actions.233.domaintools",
    "ack": "ID:partnerlab-40690-1546611986322-412:7",
    "JMSXUserID": "SYSTEM",
    "destination": "/queue/actions.233.domaintools",
    "correlation-id": "invid:9146",
    "Co3ContextToken": "eyJhbGciOiJIUzI1NiJ9.bnVsbA.nPkoA3LJlnkErRnptTlIXX3fJ7rWVzzHRSPiM_JbnHU",
    "expires": "0"
    }
    2019-02-15 13:02:20,259 DEBUG [action_message] Message: {
    "function": {
    "creator": null,
    "description": null,
    "display_name": "fn Record DomainTools Domain Risk Score",
    "id": 394,
    "name": "fn_record_domaintools_domain_risk_score",
    "uuid": null,
    "version": null,
    "view_items": [],
    "workflows": []
    },
    "groups": [],
    "inputs": {
    "domaintools_domain_name": "test.com"
    },
    "principal": {
    "display_name": "Tony Bufort",
    "id": 108,
    "name": "tbufort@domaintools.com",
    "type": "user"
    },
    "workflow": {
    "actions": [],
    "description": null,
    "name": "Workflow Record DomainTools Domain Risk Score",
    "object_type": {
    "name": "artifact",
    "id": 4
    },
    "programmatic_name": "workflow_record_domaintools_domain_risk_score",
    "uuid": null,
    "workflow_id": 320
    },
    "workflow_instance": {
    "workflow": {
    "actions": [],
    "description": null,
    "name": "Workflow Record DomainTools Domain Risk Score",
    "object_type": {
    "name": "artifact",
    "id": 4
    },
    "programmatic_name": "workflow_record_domaintools_domain_risk_score",
    "uuid": null,
    "workflow_id": 320
    },
    "workflow_instance_id": 1718
    }
    }
    2019-02-15 13:02:20,263 ERROR [actions_component] type object 'FunctionMessage' has no attribute 'name'
    Traceback (most recent call last):
    File "c:\study\python\pycharmprojects\poc\dt_poc\venv\lib\site-packages\resilient_circuits\actions_component.py", line 421, in on_stomp_message
    log_dir=self.logging_directory)
    File "c:\study\python\pycharmprojects\poc\dt_poc\venv\lib\site-packages\resilient_circuits\action_message.py", line 243, in __init__
    self._log_message(log_dir)
    File "c:\study\python\pycharmprojects\poc\dt_poc\venv\lib\site-packages\resilient_circuits\action_message.py", line 110, in _log_message
    filename = "_".join((self.__class__.name, self.displayname,
    AttributeError: type object 'FunctionMessage' has no attribute 'name'
    2019-02-15 13:02:20,268 DEBUG [client] Received heart-beat
    <Message_success[stomp] (<Message[stomp] ()>, None )>
    <ServerHeartbeat[*] ()>
    <ServerHeartbeat_success[*] (<ServerHeartbeat[*] ()>, None )>
    2019-02-15 13:02:40,036 DEBUG [client] Received heart-beat


    Thanks,

    -Tony

    P.S. - If this is not the best place to post help requests, please advise.

    ------------------------------
    Anthony Bufort
    ------------------------------


  • 2.  RE: 'FunctionMessage' has no attribute 'name'

    Posted Sat February 16, 2019 04:33 PM

    Hi Anthony,

    You're in the right place. I ran your code below and was able to get it to run correctly using Resilient v31 and resilient-circuits v32. One common problem folks have is when creating a rule to only reference a workflow and not a destination as well. But even when I tried that I couldn't reproduce your error.

    What platform are you running resilient-circuits on?



    ------------------------------
    Mark Scherfling
    ------------------------------



  • 3.  RE: 'FunctionMessage' has no attribute 'name'

    Posted Sat February 16, 2019 04:45 PM
    Hi Mark,

    Sorry I did not get back to you with more info earlier.  Very busy week. :)

    The server reports Version: 32.0.4502, and my circuits is on 32.0.0

    Thanks,

    -Tony

    ------------------------------
    Anthony Bufort
    Integrations Engineer
    DomainTools
    Renton WA
    14252214447
    ------------------------------



  • 4.  RE: 'FunctionMessage' has no attribute 'name'

    Posted Sat February 16, 2019 04:46 PM
    I am on Windows in PyCharm.

    ------------------------------
    Anthony Bufort
    Integrations Engineer
    DomainTools
    Renton WA
    14252214447
    ------------------------------



  • 5.  RE: 'FunctionMessage' has no attribute 'name'

    Posted Tue February 19, 2019 01:32 PM
    Hello Mark,

    Update: After revamping my dev environment a bit, it appears that the error is no longer present, and things seem to be working as expected.  Thank you for your assistance.

    -Tony

    --
    Anthony (Tony) Bufort
    Product Integrations Engineer
    DomainTools, LLC

    T: (425) 221-4447
    E: tbufort@domaintools.com
    www.domaintools.com

    Virus-free. www.avg.com