コード例 #1
0
    def update_name(self, name):
        """
        Update the name (short description) of an IOC

        This creates the short description node if it is not present.

        :param name: Value to set the short description too
        :return:
        """
        short_desc_node = self.metadata.find('short_description')
        if short_desc_node is None:
            log.debug('Could not find short description node for [{}].'.format(str(self.iocid)))
            log.debug('Creating & inserting the short description node')
            short_desc_node = ioc_et.make_short_description_node(name)
            self.metadata.insert(0, short_desc_node)
        else:
            short_desc_node.text = name
        return True
コード例 #2
0
ファイル: ioc_api.py プロジェクト: mandiant/ioc_writer
    def update_name(self, name):
        """
        Update the name (short description) of an IOC

        This creates the short description node if it is not present.

        :param name: Value to set the short description too
        :return:
        """
        short_desc_node = self.metadata.find('short_description')
        if short_desc_node is None:
            log.debug('Could not find short description node for [{}].'.format(str(self.iocid)))
            log.debug('Creating & inserting the short description node')
            short_desc_node = ioc_et.make_short_description_node(name)
            self.metadata.insert(0, short_desc_node)
        else:
            short_desc_node.text = name
        return True
コード例 #3
0
ファイル: tests.py プロジェクト: osla/ioc_writer-1
 def test_make_short_description_node(self):
     r = ioc_et.make_short_description_node(self.name)
     self.assertEqual(r.tag, 'short_description')
     self.assertEqual(r.text, self.name)
コード例 #4
0
ファイル: tests.py プロジェクト: jiangzhw/ioc_writer
 def test_make_short_description_node(self):
     r = ioc_et.make_short_description_node(self.name)
     self.assertEqual(r.tag, 'short_description')
     self.assertEqual(r.text, self.name)