Skip to content

Possible bug in reactutils #368

Open
@WildDogOne

Description

@WildDogOne

For some reason the initialisation does not work like this:
def normalize_react_title(title,fmtrules={"abbreviations": ["ip", "dns", "ms", "ngfw", "ips", "url", "pe", "pdf","elf", "dhcp", "vpn", "smb", "ftp", "http"],"capitalizeWords":["unix", "windows", "proxy", "firewall", "mach-o"]}):

def normalize_react_title(title,fmtrules={"abbreviations": ["ip", "dns", "ms", "ngfw", "ips", "url", "pe", "pdf","elf", "dhcp", "vpn", "smb", "ftp", "http"],"capitalizeWords":["unix", "windows", "proxy", "firewall", "mach-o"]}):

I get some really hard to understand errors, because it should work

Err message: 'NoneType' object is not subscriptable
------------------------------------------------------------
Traceback (most recent call last):
  File "XXXXXXXXX\atomic-threat-coverage\response\atc_react\scripts\populatemarkdown.py", line 89, in response_action
    ra.render_template("markdown")
  File "XXXXXXXXX\atomic-threat-coverage\response\atc_react\scripts\responseaction.py", line 76, in render_template
    {'title': REACTutils.normalize_react_title(self.ra_parsed_file
  File "XXXXXXXXX\atomic-threat-coverage\response\atc_react\scripts\reactutils.py", line 472, in normalize_react_title
    if word.lower() in fmtrules["abbreviations"]:
TypeError: 'NoneType' object is not subscriptable
------------------------------------------------------------

When I initialise like this it works perfectly:

    @staticmethod
    def normalize_react_title(title, fmtrules=None):
        """Normalize title if it is a RA/RP title in the following format:
        RP_0003_identification_make_sure_email_is_a_phishing
        """

        if fmtrules is None:
            fmtrules = {
                "abbreviations": ["ip", "dns", "ms", "ngfw", "ips", "url", "pe", "pdf", "elf", "dhcp", "vpn", "smb",
                                  "ftp", "http"], "capitalizeWords": ["unix", "windows", "proxy", "firewall", "mach-o"]}

I am not sure why this is happening to me, I feel it could be because of a python version conflict

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions