当前位置: 首页>>代码示例>>Python>>正文


Python CUCKOO_VERSION.split方法代码示例

本文整理汇总了Python中lib.cuckoo.common.constants.CUCKOO_VERSION.split方法的典型用法代码示例。如果您正苦于以下问题:Python CUCKOO_VERSION.split方法的具体用法?Python CUCKOO_VERSION.split怎么用?Python CUCKOO_VERSION.split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.cuckoo.common.constants.CUCKOO_VERSION的用法示例。


在下文中一共展示了CUCKOO_VERSION.split方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _check_signature_version

# 需要导入模块: from lib.cuckoo.common.constants import CUCKOO_VERSION [as 别名]
# 或者: from lib.cuckoo.common.constants.CUCKOO_VERSION import split [as 别名]
    def _check_signature_version(self, current):
        """Check signature version.
        @param current: signature class/instance to check.
        @return: check result.
        """
        # Since signatures can hardcode some values or checks that might
        # become obsolete in future versions or that might already be obsolete,
        # I need to match its requirements with the running version of Cuckoo.
        version = CUCKOO_VERSION.split("-")[0]

        # If provided, check the minimum working Cuckoo version for this
        # signature.
        if current.minimum:
            try:
                # If the running Cuckoo is older than the required minimum
                # version, skip this signature.
                if StrictVersion(version) < StrictVersion(current.minimum.split("-")[0]):
                    log.debug(
                        "You are running an older incompatible version "
                        'of Cuckoo, the signature "%s" requires '
                        "minimum version %s",
                        current.name,
                        current.minimum,
                    )
                    return None

                if StrictVersion("1.2") > StrictVersion(current.minimum.split("-")[0]):
                    log.warn(
                        "Cuckoo signature style has been redesigned in "
                        "cuckoo 1.2. This signature is not "
                        "compatible: %s.",
                        current.name,
                    )
                    return None

            except ValueError:
                log.debug("Wrong minor version number in signature %s", current.name)
                return None

        # If provided, check the maximum working Cuckoo version for this
        # signature.
        if current.maximum:
            try:
                # If the running Cuckoo is newer than the required maximum
                # version, skip this signature.
                if StrictVersion(version) > StrictVersion(current.maximum.split("-")[0]):
                    log.debug(
                        "You are running a newer incompatible version "
                        'of Cuckoo, the signature "%s" requires '
                        "maximum version %s",
                        current.name,
                        current.maximum,
                    )
                    return None
            except ValueError:
                log.debug("Wrong major version number in signature %s", current.name)
                return None

        return True
开发者ID:ksmaheshkumar,项目名称:cuckoo,代码行数:61,代码来源:plugins.py

示例2: __init__

# 需要导入模块: from lib.cuckoo.common.constants import CUCKOO_VERSION [as 别名]
# 或者: from lib.cuckoo.common.constants.CUCKOO_VERSION import split [as 别名]
    def __init__(self, results):
        self.results = results
        self.matched = []

        # While developing our version is generally something along the lines
        # of "2.0-dev" whereas StrictVersion() does not handle "-dev", so we
        # strip that part off.
        self.version = CUCKOO_VERSION.split("-")[0]

        # Gather all enabled, up-to-date, and applicable signatures.
        self.signatures = []
        for signature in list_plugins(group="signatures"):
            if self._should_enable_signature(signature):
                self.signatures.append(signature(self))
开发者ID:453483289,项目名称:cuckoo,代码行数:16,代码来源:plugins.py

示例3: _run_signature

# 需要导入模块: from lib.cuckoo.common.constants import CUCKOO_VERSION [as 别名]
# 或者: from lib.cuckoo.common.constants.CUCKOO_VERSION import split [as 别名]
    def _run_signature(self, signature, results):
        """Run a signature.
        @param signature: signature to run.
        @param signs: signature results dict.
        @return: matched signature.
        """
        current = signature()
        log.debug("Running signature \"%s\"" % current.name)

        if not current.enabled:
            return None

        version = CUCKOO_VERSION.split("-")[0]
        if current.minimum:
            try:
                if StrictVersion(version) < StrictVersion(current.minimum.split("-")[0]):
                    log.debug("You are running an older incompatible version of Cuckoo, the signature \"%s\" requires minimum version %s"
                              % (current.name, current.minimum))
                    return None
            except ValueError:
                log.debug("Wrong minor version number in signature %s" % current.name)
                return None

        if current.maximum:
            try:
                if StrictVersion(version) > StrictVersion(current.maximum.split("-")[0]):
                    log.debug("You are running a newer incompatible version of Cuckoo, the signature \"%s\" requires maximum version %s"
                              % (current.name, current.maximum))
                    return None
            except ValueError:
                log.debug("Wrong major version number in signature %s" % current.name)
                return None

        try:
            if current.run(copy.deepcopy(results)):
                matched = {"name" : current.name,
                           "description" : current.description,
                           "severity" : current.severity,
                           "references" : current.references,
                           "data" : current.data,
                           "alert" : current.alert}
                log.debug("Analysis at \"%s\" matched signature \"%s\"" % (self.analysis_path, current.name))
                return matched
        except NotImplementedError:
            log.debug("The signature \"%s\" is not correctly implemented" % current.name)
        except Exception as e:
            log.exception("Failed to run signature \"%s\":" % (current.name))

        return None
开发者ID:dicato,项目名称:cuckoo,代码行数:51,代码来源:processor.py

示例4: _run_signature

# 需要导入模块: from lib.cuckoo.common.constants import CUCKOO_VERSION [as 别名]
# 或者: from lib.cuckoo.common.constants.CUCKOO_VERSION import split [as 别名]
    def _run_signature(self, signature, results):
        """Run a signature.
        @param signature: signature to run.
        @param signs: signature results dict.
        @return: matched signature.
        """
        # Initialize the current signature.
        current = signature(LocalDict(results))

        log.debug("Running signature \"%s\"" % current.name)

        # If the signature is disabled, skip it.
        if not current.enabled:
            return None

        # Since signatures can hardcode some values or checks that might
        # become obsolete in future versions or that might already be obsolete,
        # I need to match its requirements with the running version of Cuckoo.
        version = CUCKOO_VERSION.split("-")[0]

        # If provided, check the minimum working Cuckoo version for this
        # signature.
        if current.minimum:
            try:
                # If the running Cuckoo is older than the required minimum
                # version, skip this signature.
                if StrictVersion(version) < StrictVersion(current.minimum.split("-")[0]):
                    log.debug("You are running an older incompatible version "
                              "of Cuckoo, the signature \"%s\" requires "
                              "minimum version %s"
                              % (current.name, current.minimum))
                    return None
            except ValueError:
                log.debug("Wrong minor version number in signature %s"
                          % current.name)
                return None

        # If provided, check the maximum working Cuckoo version for this
        # signature.
        if current.maximum:
            try:
                # If the running Cuckoo is newer than the required maximum
                # version, skip this signature.
                if StrictVersion(version) > StrictVersion(current.maximum.split("-")[0]):
                    log.debug("You are running a newer incompatible version "
                              "of Cuckoo, the signature \"%s\" requires "
                              "maximum version %s"
                              % (current.name, current.maximum))
                    return None
            except ValueError:
                log.debug("Wrong major version number in signature %s"
                          % current.name)
                return None

        try:
            # Run the signature and if it gets matched, extract key information
            # from it and append it to the results container.
            if current.run():
                matched = {"name" : current.name,
                           "description" : current.description,
                           "severity" : current.severity,
                           "references" : current.references,
                           "data" : current.data,
                           "alert" : current.alert}

                log.debug("Analysis at \"%s\" matched signature \"%s\""
                          % (self.analysis_path, current.name))

                # Return information on the matched signature.
                return matched
        except Exception as e:
            log.exception("Failed to run signature \"%s\":" % (current.name))

        return None
开发者ID:Missuniverse110,项目名称:cuckoo,代码行数:76,代码来源:processor.py


注:本文中的lib.cuckoo.common.constants.CUCKOO_VERSION.split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。