def test_supported_version(): assert utils.supported_version("2.0", "2.0.0", None) is True assert utils.supported_version("2.0.0", "2.0.0", None) is True assert utils.supported_version("2.0.0", "2.0.0", "2.0.1") is True assert utils.supported_version("2.0.0", "2.0.0", "2.0.0") is True assert utils.supported_version("2.0.1a1", "2.0.0", "2.0.1") is True assert utils.supported_version("2.0.1a1", "2.0.1a0", "2.0.1b1") is True assert utils.supported_version("2.0.1b1", "2.0.1", None) is False assert utils.supported_version("2.0.1b1", "2.0.1a1", None) is True assert utils.supported_version("2.0.1b1", "2.0.1a1", "2.0.1") is True
def test_supported_version(): assert utils.supported_version("2.0", "2.0.0", None) is True assert utils.supported_version("2.0.0", "2.0.0", None) is True assert utils.supported_version("2.0.0", "2.0.0", "2.0.1") is True assert utils.supported_version("2.0.0", "2.0.0", "2.0.0") is True assert utils.supported_version("2.0.1a1", "2.0.0", "2.0.1") is True assert utils.supported_version("2.0.1a1", "2.0.1a0", "2.0.1b1") is True assert utils.supported_version("2.0.1b1", "2.0.1", None) is False assert utils.supported_version("2.0.1b1", "2.0.1a1", None) is True assert utils.supported_version("2.0.1b1", "2.0.1a1", "2.0.1") is True
def init_once(cls): cls.extractors = [] # Gather all up-to-date Extractors. TODO Also handle nested subclasses. for ext in Extractor.__subclasses__(): if not supported_version(version, ext.minimum, ext.maximum): log.debug( "You are running a version of Cuckoo that's not " "compatible with this Extractor (either it's too old or " "too new): cuckoo=%s extractor=%s minversion=%s " "maxversion=%s", version, ext.__name__, ext.minimum, ext.maximum) continue cls.extractors.append(ext) # Turn str/unicode into a tuple of size one. if isinstance(ext.yara_rules, basestring): ext.yara_rules = ext.yara_rules,
def init_once(cls): cls.extractors = [] # Gather all up-to-date Extractors. TODO Also handle nested subclasses. for ext in Extractor.__subclasses__(): if not supported_version(version, ext.minimum, ext.maximum): log.debug( "You are running a version of Cuckoo that's not " "compatible with this Extractor (either it's too old or " "too new): cuckoo=%s extractor=%s minversion=%s " "maxversion=%s", version, ext.__name__, ext.minimum, ext.maximum ) continue cls.extractors.append(ext) # Turn str/unicode into a tuple of size one. if isinstance(ext.yara_rules, basestring): ext.yara_rules = ext.yara_rules,
def check_signature_version(self, sig): """Check signature version. @param current: signature class/instance to check. @return: check result. """ if not supported_version(self.version, sig.minimum, sig.maximum): log.debug( "You are running a version of Cuckoo that's not compatible " "with this signature (either it's too old or too new): " "cuckoo=%s signature=%s minversion=%s maxversion=%s", self.version, sig.name, sig.minimum, sig.maximum) return False if hasattr(sig, "run"): log.warning( "This signatures features one or more deprecated functions " "which indicates that it is very likely an old-style " "signature. Please upgrade this signature: %s.", sig.name) return False return True
def check_signature_version(self, sig): """Check signature version. @param current: signature class/instance to check. @return: check result. """ if not supported_version(self.version, sig.minimum, sig.maximum): log.debug( "You are running a version of Cuckoo that's not compatible " "with this signature (either it's too old or too new): " "cuckoo=%s signature=%s minversion=%s maxversion=%s", self.version, sig.name, sig.minimum, sig.maximum ) return False if hasattr(sig, "run"): log.warning( "This signatures features one or more deprecated functions " "which indicates that it is very likely an old-style " "signature. Please upgrade this signature: %s.", sig.name ) return False return True