INNER CODE UNIT · Python

compare_versions

cyberark/KubiScan · KubiScan.py:169

def compare_versions(version1, version2):
    version1 = sanitize_version(version1)
    version2 = sanitize_version(version2)
    version1_nums = [int(num) for num in version1.split('.')]
    version2_nums = [int(num) for num in version2.split('.')]
    for i in range(len(version2_nums)):
        if version2_nums[i] > version1_nums[i]:
            return -1
        elif version2_nums[i] < version1_nums[i]:
            return 1
    else:
        return 0


def find_max_fixed_version(cve):
    versions = []
    for fixed_version in cve['FixedVersions']:
        versions.append(fixed_version['Raw'])

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…