function utils.CurrentVersionLessThan()

in ransomware/artifact.lua [442:498]


function utils.CurrentVersionLessThan(targetVersion)
    if not utils.IsVersionAvailable() then
        return true
    end

    local currentVersion = lversion('sensor')

    
    if (not currentVersion) or (not targetVersion) then
        return false
    end

    
    local currentMajor, currentMinor, currentRelease
    local targetMajor, targetMinor, targetRelease
    _, _, currentMajor, currentMinor, currentRelease = string.find(currentVersion, '(%d+)%.(%d+)%.(%d+)')
    _, _, targetMajor, targetMinor, targetRelease = string.find(targetVersion, '(%d+)%.(%d+)%.(%d+)')

    
    if (not currentMajor) or (not targetMajor) then
        return false
    end

    
    if (currentMajor < targetMajor) then
        return true
    end

    if (currentMajor == targetMajor) then

        
        if (not currentMinor) or (not targetMinor) then
            return false
        end

        
        if (currentMinor < targetMinor) then
            return true
        end

        if (currentMinor == targetMinor) then

            
            if (not currentRelease) or (not targetRelease) then
                return false
            end

            
            if (currentRelease < targetRelease) then
                return true
            end
        end
    end

    return false

end