コード例 #1
0
class Bison(VProject):
    """
    GNU Bison parser generator.

    (fetched by Git)
    """

    NAME = 'bison'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.PARSER

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="bison",
            remote="https://github.com/bincrafters/bison.git",
            local="bison",
            refspec="origin/HEAD",
            limit=None,
            shallow=False),
        bb.source.GitSubmodule(
            remote="https://github.com/coreutils/gnulib.git",
            local="bison/gnulib",
            refspec="origin/HEAD",
            limit=None,
            shallow=False,
            version_filter=project_filter_generator("bison"))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'autopoint', 'flex',
        'gettext', 'graphviz', 'help2man', 'perl', 'rsync', 'texinfo', 'wget')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Bison.NAME))

        binary_map.specify_binary('./src/bison', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        bison_source = local.path(self.source_of(self.primary_source))

        c_compiler = bb.compiler.cc(self)
        cxx_compiler = bb.compiler.cxx(self)
        with local.cwd(bison_source):
            bb.watch(git)("submodule", "update", "--init")

            with local.env(CC=str(c_compiler), CXX=str(cxx_compiler)):
                bb.watch(local["./bootstrap"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)
コード例 #2
0
class Libzmq(VProject):
    """The ZeroMQ lightweight messaging kernel is a library which extends the
    standard socket interfaces with features traditionally provided by
    specialised messaging middleware products."""

    NAME = 'libzmq'
    GROUP = 'cpp_projects'
    DOMAIN = ProjectDomains.C_LIBRARY

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="libzmq",
            remote="https://github.com/zeromq/libzmq.git",
            local="libzmq_git",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'cmake', 'build-essential', 'gnutls-dev',
        'libsodium-dev', 'pkg-config'
    )

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Libzmq.NAME))

        binary_map.specify_binary(
            "build/lib/libzmq.so", BinaryType.SHARED_LIBRARY
        )

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libzmq_version_source = local.path(self.source_of_primary)

        cpp_compiler = bb.compiler.cxx(self)
        mkdir(libzmq_version_source / "build")
        with local.cwd(libzmq_version_source / "build"):
            with local.env(CXX=str(cpp_compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", "..")

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

        with local.cwd(libzmq_version_source):
            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Zeromq", "Libzmq")]
コード例 #3
0
ファイル: grep.py プロジェクト: se-sic/VaRA-Tool-Suite
class Grep(VProject):
    """GNU Grep / UNIX command-line tools (fetched by Git)"""

    NAME = 'grep'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(project_name="grep",
                               remote="https://github.com/vulder/grep.git",
                               local="grep",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False),
        bb.source.GitSubmodule(
            remote="https://github.com/coreutils/gnulib.git",
            local="grep/gnulib",
            refspec="origin/HEAD",
            limit=None,
            shallow=False,
            version_filter=project_filter_generator("grep"))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'autopoint', 'wget', 'gettext',
        'texinfo', 'rsync', 'automake', 'autotools-dev', 'pkg-config', 'gperf')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Grep.NAME))

        binary_map.specify_binary("src/grep", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        grep_source = local.path(self.source_of_primary)
        with local.cwd(grep_source):
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()), "check")

    def compile(self) -> None:
        grep_source = local.path(self.source_of_primary)
        compiler = bb.compiler.cc(self)
        with local.cwd(grep_source):
            with local.env(CC=str(compiler)):
                bb.watch(local["./bootstrap"])()
                bb.watch(local["./configure"])("--disable-gcc-warnings")

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("gnu", "grep")]
コード例 #4
0
class Poppler(VProject):
    """Poppler is a free software utility library for rendering Portable
    Document Format documents."""

    NAME = 'poppler'
    GROUP = 'cpp_projects'
    DOMAIN = ProjectDomains.RENDERING

    SOURCE = [
        block_revisions([
            RevisionRange("e225b4b804881de02a5d1beb3f3f908a8f8ddc3d",
                          "2b2808719d2c91283ae358381391bb0b37d9061d",
                          "requiers QT6 which is not easily available")
        ])(PaperConfigSpecificGit(
            project_name="poppler",
            remote="https://gitlab.freedesktop.org/poppler/poppler.git",
            local="poppler",
            refspec="origin/HEAD",
            limit=None,
            shallow=False))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'cmake', 'libfreetype6-dev',
        'libfontconfig-dev', 'libjpeg-dev', 'qt5-default', 'libopenjp2-7-dev')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            Poppler.NAME))

        binary_map.specify_binary("libpoppler.so", BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        poppler_version_source = local.path(self.source_of(
            self.primary_source))

        c_compiler = bb.compiler.cc(self)
        cxx_compiler = bb.compiler.cxx(self)
        with local.cwd(poppler_version_source):
            with local.env(CC=str(c_compiler), CXX=str(cxx_compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", ".")
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Poppler", "Poppler")]
コード例 #5
0
ファイル: curl.py プロジェクト: se-sic/VaRA-Tool-Suite
class Curl(VProject):
    """
    Curl is a command-line tool for transferring data specified with URL syntax.

    (fetched by Git)
    """

    NAME = 'curl'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.WEB_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="curl",
            remote="https://github.com/curl/curl.git",
            local="curl",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    CONTAINER = get_base_image(
        ImageBase.DEBIAN_10
    ).run('apt', 'install', '-y', 'autoconf', 'automake', 'libtool', 'openssl')

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Curl.NAME))

        binary_map.specify_binary('src/.libs/curl', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        curl_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(curl_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./buildconf"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Haxx", "Curl")]
コード例 #6
0
ファイル: glib.py プロジェクト: se-sic/VaRA-Tool-Suite
class Glib(VProject):
    """
    GLib is the low-level core library that forms the basis for projects such as
    GTK and GNOME. It provides data structure handling for C, portability
    wrappers, and interfaces for such runtime functionality as an event loop,
    threads, dynamic loading, and an object system.

    (fetched by Git)
    """

    NAME = 'glib'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.DATA_STRUCTURES

    SOURCE = [
        PaperConfigSpecificGit(project_name="glib",
                               remote="https://github.com/GNOME/glib.git",
                               local="glib",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'meson', 'ninja-build')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Glib.NAME))

        binary_map.specify_binary('build/glib/libglib-2.0.so',
                                  BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        glib_source = local.path(self.source_of_primary)

        cc_compiler = bb.compiler.cc(self)
        with local.cwd(glib_source):
            with local.env(CC=str(cc_compiler)):
                bb.watch(meson)("build")

            bb.watch(ninja)("-j", get_number_of_jobs(bb_cfg()), "-C", "build")

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Gnome", "Glib")]
コード例 #7
0
class Gawk(VProject):
    """
    GNU awk.

    (fetched by Git)
    """

    NAME = 'gawk'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="gawk",
            remote="https://github.com/vulder/gawk.git",
            local="gawk",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'libtool', 'perl', 'm4',
        'autopoint', 'gettext', 'bison'
    )

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Gawk.NAME))

        binary_map.specify_binary('gawk', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        gawk_source = local.path(self.source_of(self.primary_source))

        compiler = bb.compiler.cc(self)
        with local.cwd(gawk_source):
            with local.env(CC=str(compiler)):
                bb.watch(local["autoreconf"])("-if")
                bb.watch(local["./configure"])()

            bb.watch(make)("MAKEINFO=true", "-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)
コード例 #8
0
ファイル: libsigrok.py プロジェクト: se-sic/VaRA-Tool-Suite
class Libsigrok(VProject):
    """
    The sigrok project aims at creating a portable, cross-platform,
    Free/Libre/Open-Source signal analysis software suite.

    (fetched by Git)
    """

    NAME = 'libsigrok'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.SIGNAL_PROCESSING

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="libsigrok",
            remote="https://github.com/sigrokproject/libsigrok.git",
            local="libsigrok",
            refspec="origin/HEAD",
            limit=None,
            shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'autotools-dev',
        'libtool', 'pkg-config', 'libzip-dev', 'libglib2.0-dev')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(
            get_local_project_git_path(Libsigrok.NAME))

        binary_map.specify_binary('.libs/libsigrok.so',
                                  BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        sigrok_source = local.path(self.source_of_primary)

        cc_compiler = bb.compiler.cc(self)
        with local.cwd(sigrok_source):
            with local.env(CC=str(cc_compiler)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)
コード例 #9
0
ファイル: libxml2.py プロジェクト: se-sic/VaRA-Tool-Suite
class Libxml2(VProject):
    """libxml2 is a software library for parsing XML documents."""

    NAME = 'libxml2'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.FILE_FORMAT

    SOURCE = [
        PaperConfigSpecificGit(project_name="libxml2",
                               remote="https://github.com/GNOME/libxml2.git",
                               local="libxml2",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10)\
        .run('apt', 'install', '-y', 'wget', 'liblzma-dev')\
        .run('/bin/bash', '-c',
             'wget -qO- '
             '\"https://cmake.org/files/v3.20'
             '/cmake-3.20.0-linux-x86_64.tar.gz\" '
             '| tar --strip-components=1 -xz -C /usr/local')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            Libxml2.NAME))

        binary_map.specify_binary("libxml2.so", BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libxml2_version_source = local.path(self.source_of(
            self.primary_source))

        c_compiler = bb.compiler.cc(self)
        with local.cwd(libxml2_version_source):
            with local.env(CC=str(c_compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", ".")
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Xmlsoft", "Libxml2")]
コード例 #10
0
class Lrzip(VProject):
    """Compression and decompression tool lrzip (fetched by Git)"""

    NAME = 'lrzip'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        PaperConfigSpecificGit(project_name="lrzip",
                               remote="https://github.com/ckolivas/lrzip.git",
                               local="lrzip",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'tar', 'libz-dev', 'autoconf', 'libbz2-dev',
        'liblzo2-dev', 'liblz4-dev', 'coreutils', 'libtool')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Lrzip.NAME))

        binary_map.specify_binary("lrzip", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        lrzip_source = local.path(self.source_of_primary)

        self.cflags += ["-fPIC"]

        cc_compiler = bb.compiler.cc(self)
        cxx_compiler = bb.compiler.cxx(self)

        with local.cwd(lrzip_source):
            with local.env(CC=str(cc_compiler), CXX=str(cxx_compiler)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("lrzip_project", "lrzip")]
コード例 #11
0
class Opus(VProject):
    """Opus is a codec for interactive speech and audio transmission over the
    Internet."""

    NAME = 'opus'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.CODEC

    SOURCE = [
        PaperConfigSpecificGit(project_name="opus",
                               remote="https://github.com/xiph/opus.git",
                               local="opus",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'libtool')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Opus.NAME))

        binary_map.specify_binary(".libs/libopus.so",
                                  BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        opus_source = local.path(self.source_of_primary)

        self.cflags += ["-fPIC"]

        clang = bb.compiler.cc(self)
        with local.cwd(opus_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("opus-codec", "opus")]
コード例 #12
0
class Libvpx(VProject):
    """Codec SDK libvpx (fetched by Git)"""

    NAME = 'libvpx'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.CODEC

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="libvpx",
            remote="https://github.com/webmproject/libvpx.git",
            local="libvpx",
            refspec="origin/HEAD",
            limit=None,
            shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'yasm')

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash  # pylint: disable=W0613
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Libvpx.NAME))

        binary_map.specify_binary("vpxdec", BinaryType.EXECUTABLE)
        binary_map.specify_binary("vpxenc", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libvpx_source = local.path(self.source_of_primary)

        self.cflags += ["-fPIC"]

        clang = bb.compiler.cc(self)
        with local.cwd(libvpx_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("john_koleszar", "libvpx")]
コード例 #13
0
ファイル: file.py プロジェクト: se-sic/VaRA-Tool-Suite
class File(VProject):
    """File command for recognizing the type of data contained in a file."""

    NAME = 'file'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(project_name="file",
                               remote="https://github.com/file/file",
                               local="file_git",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'autotools-dev',
        'build-essential')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(File.NAME))

        binary_map.specify_binary("src/.libs/file", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        file_version_source = local.path(self.source_of_primary)

        self.cflags += ["-fPIC"]

        c_compiler = bb.compiler.cc(self)
        with local.cwd(file_version_source):
            with local.env(CC=str(c_compiler)):
                bb.watch(autoreconf["-f", "-i"])()
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

        with local.cwd(file_version_source):
            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("File Project", "file")]
コード例 #14
0
class Htop(VProject):
    """Process visualization tool (fetched by Git)"""

    NAME = 'htop'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(project_name="htop",
                               remote="https://github.com/htop-dev/htop.git",
                               local="htop",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'autotools-dev',
        'libtool')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Htop.NAME))

        binary_map.specify_binary('htop', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        htop_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(htop_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Htop", "Htop")]
コード例 #15
0
class Tmux(VProject):
    """Terminal multiplexer Tmux."""

    NAME = 'tmux'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(project_name="tmux",
                               remote="https://github.com/tmux/tmux.git",
                               local="tmux",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'libevent-dev', 'pkg-config', 'bison',
        'autoconf', 'automake')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Tmux.NAME))

        binary_map.specify_binary("tmux", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        tmux_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(tmux_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("nicholas_marriott", "tmux")]
コード例 #16
0
class LibjpegTurbo(VProject):
    """libjpeg-turbo is a JPEG image codec."""

    NAME = 'libjpeg_turbo'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.FILE_FORMAT

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="libjpeg_turbo",
            remote="https://github.com/libjpeg-turbo/libjpeg-turbo",
            local="libjpeg-turbo",
            refspec="origin/HEAD",
            limit=None,
            shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'cmake')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(
            get_local_project_git_path(LibjpegTurbo.NAME))

        binary_map.specify_binary("libjpeg.so", BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libjpeg_version_source = local.path(self.source_of_primary)

        c_compiler = bb.compiler.cc(self)
        with local.cwd(libjpeg_version_source):
            with local.env(CC=str(c_compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", ".")
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("JpegCodec", "Libjpeg")]
コード例 #17
0
ファイル: lz4.py プロジェクト: se-sic/VaRA-Tool-Suite
class Lz4(VProject):
    """
    LZ4 is lossless compression algorithm.

    (fetched by Git)
    """

    NAME = 'lz4'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        PaperConfigSpecificGit(project_name="lz4",
                               remote="https://github.com/lz4/lz4.git",
                               local="lz4",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10)

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Lz4.NAME))

        binary_map.specify_binary('lz4', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        lz4_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(lz4_source):
            with local.env(CC=str(clang)):
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Yann Collet", "LZ4")]
コード例 #18
0
ファイル: openssl.py プロジェクト: se-sic/VaRA-Tool-Suite
class OpenSSL(VProject):
    """TLS-framework OpenSSL (fetched by Git)"""

    NAME = 'openssl'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.SECURITY

    SOURCE = [
        PaperConfigSpecificGit(project_name="openssl",
                               remote="https://github.com/openssl/openssl.git",
                               local="openssl",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'perl')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            OpenSSL.NAME))

        binary_map.specify_binary("libssl.so", BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        openssl_source = local.path(self.source_of_primary)

        compiler = bb.compiler.cc(self)
        with local.cwd(openssl_source):
            with local.env(CC=str(compiler)):
                bb.watch(local['./config'])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("openssl_project", "openssl"), ("openssl", "openssl")]
コード例 #19
0
ファイル: libtiff.py プロジェクト: se-sic/VaRA-Tool-Suite
class Libtiff(VProject):
    """Libtiff is a library for reading and writing Tagged Image File Format
    files."""

    NAME = 'libtiff'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.FILE_FORMAT

    SOURCE = [
        block_revisions([
            GoodBadSubgraph(["0ef31e1f62aa7a8b1c488a59c4930775ee0046e4"],
                            ["a63512c436c64ad94b8eff09d6d7faa7e638d45d"],
                            "Bug in Libtiff"),
            GoodBadSubgraph(["88df59e89cfb096085bc5299f087eaceda73f12e"], [
                "901535247413d30d9380ee837ecdb9fb661350c6",
                "5ef6de4c7055a3b426d97d5af1a77484ee92eb30"
            ], "Does not build"),
            GoodBadSubgraph(
                ["6d46b8e4642f372192e94976576b13dcb89970d8"],
                ["88df59e89cfb096085bc5299f087eaceda73f12e"],
                "Does not build because of libtool version discrepancy"),
            GoodBadSubgraph(["5cbfc68f0625d6c29d724b6e57fa7e98017ad325"],
                            ["59e0f5cb3316089eb81064efdc3ba0eac7145fab"],
                            "Bug in Libtiff"),
            SingleRevision("614095e3d06f6ac95fc9bb2e9333cf95c228be1c",
                           "Bug in Libtiff"),
            SingleRevision("a1caf14ce4640eec759a801ea601bd022bdc02d3",
                           "Bug in Libtiff"),
            GoodBadSubgraph(
                ["f7aebc264761adc41142e98e2285700dc51d384e"],
                ["9f3e08cf9409573ffa67e243c8bfbf6263b0fcb5"],
                "Issue on some machines, not sure whos fault it is"),
            GoodBadSubgraph(["97049062b9d1efa7b00d7a13bcf97365b57c937b"],
                            ["66eb5c7cd07fec0647517f418e5fc81c4e26d402"],
                            "Bug in Libtiff"),
            GoodBadSubgraph(["0769c447b7108fe616d855e1ba367ecbb90ba471"],
                            ["40c664948371d60908328f7ccb5982aebda1d04d"],
                            "Error in the Makefile of Libtiff"),
            GoodBadSubgraph(["0730d44a00a34db8659a16833453d231501722a7"],
                            ["5b60852fe65b5908130e809e1011b10afcaf1c9c"],
                            "Bub in Libtiff"),
            GoodBadSubgraph(["145eb81dc87441e400f2bdaf7b873c429ce8c768"],
                            ["0e40776b337855277cf8093cdc9fa1f838642be1"],
                            "Bug in Libtiff"),
            SingleRevision("d7afc8c14f379f1e7dcf91d9c57cb9b2d1f2d926",
                           "Bug in Libtiff"),
            SingleRevision("292c431e5d99464134255e7e2dc8d24fd6f797d5",
                           "Bug in Libtiff"),
            SingleRevision("5b90af247ea3801ce93ec0922b8b81396caa885d",
                           "Bug in Libtiff"),
            SingleRevision("45efaab3950e9aeb4bb6b697e5795613c629826c",
                           "Bug in Libtiff"),
            SingleRevision("394965766478c9fb028b2bc2ca09e92a49a35f14",
                           "Bug in Libtiff"),
            SingleRevision("0e3c0d0550dc5790779bd222844ac736d83e99a5",
                           "Bug in Libtiff"),
            SingleRevision("d4bef27ee8361ee2d8aae6c30c7074d2547ee2f0",
                           "Bug in Libtiff")
        ])(PaperConfigSpecificGit(
            project_name="libtiff",
            remote="https://gitlab.com/libtiff/libtiff.git",
            local="libtiff",
            refspec="origin/HEAD",
            limit=None,
            shallow=False))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'autopoint', 'automake',
        'autotools-dev', 'libtool', 'pkg-config')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            Libtiff.NAME))

        binary_map.specify_binary("libtiff/.libs/libtiff.so",
                                  BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libtiff_version_source = local.path(self.source_of(
            self.primary_source))

        c_compiler = bb.compiler.cc(self)
        with local.cwd(libtiff_version_source):
            with local.env(CC=str(c_compiler)):
                bb.watch(local["./autogen.sh"])()
                configure = bb.watch(local["./configure"])
                configure()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Libtiff", "Libtiff")]
コード例 #20
0
ファイル: openvpn.py プロジェクト: se-sic/VaRA-Tool-Suite
class OpenVPN(VProject):
    """
    OpenVPN is open-source commercial software that implements virtual private
    network techniques to create secure point-to-point or site-to-site
    connections in routed or bridged configurations and remote access
    facilities.

    (fetched by Git)
    """

    NAME = 'openvpn'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.SECURITY

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="openvpn",
            remote="https://github.com/openvpn/openvpn.git",
            local="openvpn",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'libssl-dev', 'openssl', 'autoconf', 'automake',
        'libtool', 'liblz4-dev', 'liblzo2-dev', 'libpam0g-dev'
    )

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(OpenVPN.NAME))

        binary_map.specify_binary(
            './src/openvpn/openvpn', BinaryType.EXECUTABLE
        )

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        openvpn_source = local.path(self.source_of(self.primary_source))

        self.cflags += ["-fPIC"]

        c_compiler = bb.compiler.cc(self)
        with local.cwd(openvpn_source):
            with local.env(CC=str(c_compiler)):
                bb.watch(autoreconf)("-vi")
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Openvpn", "Openvpn")]
コード例 #21
0
ファイル: gravity.py プロジェクト: se-sic/VaRA-Tool-Suite
class Gravity(VProject):
    """Programming language Gravity."""

    NAME = 'gravity'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.PROG_LANG

    SOURCE = [
        block_revisions([
            RevisionRange(
                "0b8e0e047fc3d5e18ead3221ad54920f1ad0eedc",
                "8f417752dd14deea64249b5d32b6138ebc877fa9", "nothing to build"
            ),
            GoodBadSubgraph(["e8999a84efbd9c3e739bff7af39500d14e61bfbc"],
                            ["0e918ce0798407dd6c981e1cd26b4ba138d22fab"],
                            "missing -lm"),
            GoodBadSubgraph(["244c5aa91358a5b2472d351e6c7f38ba7da94ef6"],
                            ["371152de2f38534d4da332349d1def83fc66d5bc"],
                            "Visual studio project breaks makefile"),
            GoodBadSubgraph(["112be515b5ef3b67011c7272e5a50ac3a1fcadc4"],
                            ["b9a62dfad41ae06d029493cf4d5757de2a0281b2"],
                            "bug in gravity"),
            SingleRevision(
                "e207f0cc87bf57e9ccb6f0d18ff4fe4d6ef0c096", "bug in gravity"
            ),
            GoodBadSubgraph(["d2a04f92347fb5f2b6fd23bea9b0e12817cd6d8e"],
                            ["e8fbd6a4a2a9618456f1460dc9138b617dc7af4b"],
                            "bug in gravity"),
            GoodBadSubgraph(["968534c5d4f28501b7f34da48cab2c153ae7449b"],
                            ["0caf15328bda90ffb1911077e03b28ea9970208b"],
                            "bug in gravity"),
            GoodBadSubgraph(["e4f95e669a4c5cf2d142d5b0b72a11c117f7092f"],
                            ["09e59da4deff9b35224f4784fae9d0f132be9cea"],
                            "missing -lbsd"),
        ])(
            PaperConfigSpecificGit(
                project_name="gravity",
                remote="https://github.com/marcobambini/gravity.git",
                local="gravity",
                refspec="origin/HEAD",
                limit=None,
                shallow=False
            )
        )
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10
                              ).run('apt', 'install', '-y', 'cmake')

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Gravity.NAME))

        binary_map.specify_binary("gravity", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        gravity_git_path = get_local_project_git_path(self.NAME)
        gravity_version = self.version_of_primary

        # commit 46133fb47d6da1f0dec27ae23db1d633bc72e9e3 introduced
        # cmake as build system
        with local.cwd(gravity_git_path):
            cmake_revisions = get_all_revisions_between(
                "dbb4d61fc2ebb9aca44e8e6bb978efac4a6def87", "master",
                ShortCommitHash
            )

        if gravity_version in cmake_revisions:
            self.__compile_cmake()
        else:
            self.__compile_make()

    def __compile_cmake(self) -> None:
        gravity_version_source = local.path(self.source_of_primary)
        clang = bb.compiler.cc(self)
        with local.cwd(gravity_version_source):
            with local.env(CC=str(clang)):
                bb.watch(cmake)("-G", "Unix Makefiles", ".")
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    def __compile_make(self) -> None:
        gravity_version_source = local.path(self.source_of_primary)
        clang = bb.compiler.cc(self)
        with local.cwd(gravity_version_source):
            with local.env(CC=str(clang)):
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("creolabs", "gravity")]
コード例 #22
0
class Xz(VProject):
    """Compression and decompression tool xz (fetched by Git)"""

    NAME = 'xz'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        block_revisions([
            GoodBadSubgraph(["cf49f42a6bd40143f54a6b10d6e605599e958c0b"],
                            ["4c7ad179c78f97f68ad548cb40a9dfa6871655ae"],
                            "missing file api/lzma/easy.h"),
            GoodBadSubgraph(["335fe260a81f61ec99ff5940df733b4c50aedb7c"],
                            ["24e0406c0fb7494d2037dec033686faf1bf67068"],
                            "use of undeclared LZMA_THREADS_MAX"),
            RevisionRange("5d018dc03549c1ee4958364712fb0c94e1bf2741",
                          "c324325f9f13cdeb92153c5d00962341ba070ca2",
                          "Initial git import without xz")
        ])(PaperConfigSpecificGit(project_name='xz',
                                  remote="https://github.com/xz-mirror/xz.git",
                                  local="xz",
                                  refspec="origin/HEAD",
                                  limit=None,
                                  shallow=False))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'autopoint', 'automake',
        'autotools-dev', 'libtool', 'pkg-config')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Xz.NAME))

        binary_map.specify_binary('src/xz/xz',
                                  BinaryType.EXECUTABLE,
                                  only_valid_in=RevisionRange(
                                      "5d018dc035", "3f86532407"))

        binary_map.specify_binary('src/xz/.libs/xz',
                                  BinaryType.EXECUTABLE,
                                  override_entry_point='src/xz/xz',
                                  only_valid_in=RevisionRange(
                                      "880c330938", "master"))

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        xz_git_path = get_local_project_git_path(self.NAME)
        xz_version_source = local.path(self.source_of_primary)
        xz_version = self.version_of_primary

        # dynamic linking is off by default until
        # commit f9907503f882a745dce9d84c2968f6c175ba966a
        # (fda4724 is its parent)
        with local.cwd(xz_git_path):
            revisions_wo_dynamic_linking = get_all_revisions_between(
                "5d018dc03549c1ee4958364712fb0c94e1bf2741",
                "fda4724d8114fccfa31c1839c15479f350c2fb4c", ShortCommitHash)

        self.cflags += ["-fPIC"]

        clang = bb.compiler.cc(self)
        with local.cwd(xz_version_source):
            with local.env(CC=str(clang)):
                bb.watch(autoreconf)("--install")
                configure = bb.watch(local["./configure"])

                if xz_version in revisions_wo_dynamic_linking:
                    configure("--enable-dynamic=yes")
                else:
                    configure()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("tukaani", "xz")]
コード例 #23
0
ファイル: brotli.py プロジェクト: se-sic/VaRA-Tool-Suite
class Brotli(VProject):
    """Brotli compression format."""

    NAME = 'brotli'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        block_revisions([
            RevisionRange('8f30907d0f2ef354c2b31bdee340c2b11dda0fb0',
                          'e1739826c04a9944672b99b98249dda021bdeb36',
                          'Encoder and Decoder don\'t have a shared Makefile'),
            SingleRevision("378485b097fd7b80a5e404a3cb912f7b18f78cdb",
                           "Missing required build files")
        ])(PaperConfigSpecificGit(
            project_name="brotli",
            remote="https://github.com/google/brotli.git",
            local="brotli_git",
            refspec="origin/HEAD",
            limit=None,
            shallow=False))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'cmake')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Brotli.NAME))

        binary_map.specify_binary(
            "out/brotli",
            BinaryType.EXECUTABLE,
            only_valid_in=RevisionRange(
                "03739d2b113afe60638069c4e1604dc2ac27380d", "HEAD"))
        binary_map.specify_binary(
            "out/bro",
            BinaryType.EXECUTABLE,
            only_valid_in=RevisionRange(
                "5814438791fb2d4394b46e5682a96b68cd092803",
                "03739d2b113afe60638069c4e1604dc2ac27380d"))
        binary_map.specify_binary(
            "bin/bro",
            BinaryType.EXECUTABLE,
            only_valid_in=RevisionRange(
                "f9ab24a7aaee93d5932ba212e5e3d32e4306f748",
                "5814438791fb2d4394b46e5682a96b68cd092803"))
        binary_map.specify_binary(
            "tools/bro",
            BinaryType.EXECUTABLE,
            only_valid_in=RevisionRange(
                "e1739826c04a9944672b99b98249dda021bdeb36",
                "378485b097fd7b80a5e404a3cb912f7b18f78cdb"))
        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        brotli_version_source = local.path(self.source_of_primary)
        brotli_git_path = get_local_project_git_path(self.NAME)
        brotli_version = ShortCommitHash(self.version_of_primary)
        with local.cwd(brotli_git_path):
            configure_revisions = get_all_revisions_between(
                "f9ab24a7aaee93d5932ba212e5e3d32e4306f748",
                "5814438791fb2d4394b46e5682a96b68cd092803", ShortCommitHash)
            simple_make_revisions = get_all_revisions_between(
                "e1739826c04a9944672b99b98249dda021bdeb36",
                "378485b097fd7b80a5e404a3cb912f7b18f78cdb", ShortCommitHash)
        c_compiler = bb.compiler.cc(self)

        if brotli_version in simple_make_revisions:
            with local.cwd(brotli_version_source / "tools"):
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))
        elif brotli_version in configure_revisions:
            with local.cwd(brotli_version_source):
                with local.env(CC=str(c_compiler)):
                    bb.watch(local["./configure"])()
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))
        else:
            mkdir(brotli_version_source / "out")
            with local.cwd(brotli_version_source / "out"):
                with local.env(CC=str(c_compiler)):
                    bb.watch(local["../configure-cmake"])()
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

        with local.cwd(brotli_version_source):
            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("google", "brotli")]
コード例 #24
0
ファイル: libssh.py プロジェクト: se-sic/VaRA-Tool-Suite
class Libssh(VProject):
    """
    SSH library.

    (fetched by Git)
    """

    NAME = 'libssh'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.PROTOCOL

    SOURCE = [
        block_revisions([
            GoodBadSubgraph(["c65f56aefa50a2e2a78a0e45564526ecc921d74f"],
                            ["0151b6e17041c56813c882a3de6330c82acc8d93"],
                            "Disabled to quickly get this running")
        ])(
            PaperConfigSpecificGit(
                project_name="libssh",
                remote="https://github.com/libssh/libssh-mirror.git",
                local="libssh",
                refspec="origin/HEAD",
                limit=None,
                shallow=False
            )
        )
    ]

    CONTAINER = get_base_image(
        ImageBase.DEBIAN_10
    ).run('apt', 'install', '-y', 'libssl-dev', 'cmake')

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Libssh.NAME))

        binary_map.specify_binary(
            'build/src/libssh.so',
            BinaryType.SHARED_LIBRARY,
            only_valid_in=RevisionRange("c65f56aefa", "aa899f8ec0")
        )

        binary_map.specify_binary(
            'build/lib/libssh.so',
            BinaryType.SHARED_LIBRARY,
            only_valid_in=RevisionRange("aa899f8ec0", "master")
        )

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libssh_source = local.path(self.source_of(self.primary_source))
        libssh_version = ShortCommitHash(self.version_of_primary)
        cmake_revisions = get_all_revisions_between(
            "0151b6e17041c56813c882a3de6330c82acc8d93", "master",
            ShortCommitHash, libssh_source
        )
        if libssh_version in cmake_revisions:
            self.__compile_cmake()
        else:
            self.__compile_make()

    def __compile_cmake(self) -> None:
        libssh_source = local.path(self.source_of(self.primary_source))

        compiler = bb.compiler.cc(self)
        mkdir("-p", libssh_source / "build")
        with local.cwd(libssh_source / "build"):
            with local.env(CC=str(compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", "..")

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

        with local.cwd(libssh_source):
            verify_binaries(self)

    def __compile_make(self) -> None:
        libssh_source = local.path(self.source_of(self.primary_source))
        libssh_version = ShortCommitHash(self.version_of_primary)
        autoconf_revisions = get_all_revisions_between(
            "5e02c25291d594e01a910fce097a3fc5084fd68f",
            "21e639cc3fd54eb3d59568744c9627beb26e07ed", ShortCommitHash,
            libssh_source
        )
        autogen_revisions = get_all_revisions_between(
            "ca32b0aa146b31d7772f27d16098845e615432aa",
            "ee54acb417c5589a8dc9dab0676f34b3d40a182b", ShortCommitHash,
            libssh_source
        )
        compiler = bb.compiler.cc(self)
        with local.cwd(libssh_source):
            with local.env(CC=str(compiler)):
                if libssh_version in autogen_revisions:
                    bb.watch("./autogen.sh")()
                if libssh_version in autoconf_revisions:
                    bb.watch("autoreconf")()
                configure = bb.watch(local["./configure"])
                configure()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Libssh", "Libssh")]
コード例 #25
0
class Gzip(VProject, ReleaseProviderHook):
    """Compression and decompression tool Gzip (fetched by Git)"""

    NAME = 'gzip'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        block_revisions([
            # TODO (se-sic/VaRA#537): glibc < 2.28
            # see e.g. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915151
            RevisionRange("6ef28aeb035af20818578b1a1bc537f797c27029",
                          "203e40cc4558a80998d05eb74b373a51e796ca8b",
                          "Needs glibc < 2.28")
        ])(PaperConfigSpecificGit(project_name="gzip",
                                  remote="https://github.com/vulder/gzip.git",
                                  local="gzip",
                                  refspec="origin/HEAD",
                                  limit=None,
                                  shallow=False)),
        bb.source.GitSubmodule(
            remote="https://github.com/coreutils/gnulib.git",
            local="gzip/gnulib",
            refspec="origin/HEAD",
            limit=None,
            shallow=False,
            version_filter=project_filter_generator("gzip"))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'libtool', 'autopoint',
        'gettext', 'texinfo', 'rsync')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Gzip.NAME))

        binary_map.specify_binary("build/gzip", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        gzip_version_source = local.path(self.source_of_primary)

        # Build binaries in separate dir because executing the binary with path
        # 'gzip' will execute '/usr/bin/gzip' independent of the current working
        # directory.
        mkdir("-p", gzip_version_source / "build")

        self.cflags += [
            "-Wno-error=string-plus-int", "-Wno-error=shift-negative-value",
            "-Wno-string-plus-int", "-Wno-shift-negative-value"
        ]

        with local.cwd(gzip_version_source):
            bb.watch(local["./bootstrap"])()

        c_compiler = bb.compiler.cc(self)
        with local.cwd(gzip_version_source /
                       "build"), local.env(CC=str(c_compiler)):
            bb.watch(local["../configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

        with local.cwd(gzip_version_source):
            verify_binaries(self)

    @classmethod
    def get_release_revisions(
            cls, release_type: ReleaseType
    ) -> tp.List[tp.Tuple[FullCommitHash, str]]:
        major_release_regex = "^v[0-9]+\\.[0-9]+$"
        minor_release_regex = "^v[0-9]+\\.[0-9]+(\\.[0-9]+)?$"

        tagged_commits = get_tagged_commits(cls.NAME)
        if release_type == ReleaseType.MAJOR:
            return [(FullCommitHash(h), tag) for h, tag in tagged_commits
                    if re.match(major_release_regex, tag)]
        return [(FullCommitHash(h), tag) for h, tag in tagged_commits
                if re.match(minor_release_regex, tag)]

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("gzip", "gzip"), ("gnu", "gzip")]
コード例 #26
0
ファイル: libpng.py プロジェクト: se-sic/VaRA-Tool-Suite
class Libpng(VProject):
    """
    Picture library.

    (fetched by Git)
    """

    NAME = 'libpng'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.FILE_FORMAT

    SOURCE = [
        block_revisions([
            GoodBadSubgraph(["8694cd8bf5f7d0d2739e503218eaf749c6cb7071"],
                            ["0e13545712dc39db5689452ff3299992fc0a8377"],
                            "missing generic libpng.so"),
            GoodBadSubgraph(["9d2ab7b40505c5e94a7783e80217b60f474488fe"],
                            ["b17c75b222942a31394e65c0c1da9fd7ec9f3a4c"],
                            "missing generic libpng.so"),
            GoodBadSubgraph(["0d5805822f8817a17937462a2fd0606ffdad378e"],
                            ["917648ecb92f45537924b3c46a4a811b956c7023"],
                            "build not atomatable"),
            GoodBadSubgraph(["917648ecb92f45537924b3c46a4a811b956c7023"], [
                "9d2ab7b40505c5e94a7783e80217b60f474488fe",
                "6611322a8b29103a160c971819f1c5a031cd9d4f"
            ], "cmake not available"),
            GoodBadSubgraph(["a04b5352310727f20b38e360006feeca94b7201f"],
                            ["0e13545712dc39db5689452ff3299992fc0a8377"],
                            "Not libpng"),
            GoodBadSubgraph(["e209df47c4b821f277504e0cc248d9022b639e55"],
                            ["d61b42c81d9d6f0905039ccc66870b2a27eafdd9"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["8d9e494dfb208c88a9497038977b539310c7fca5"],
                            ["bf15ac7e86f4fc95b6b33831f212c3f13f955623"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["7de02e722f8f6bdb2756e20091c42fa4ffaa89c1"],
                            ["45bb9a62ba343250497c33da2b0bad78376d55b8"],
                            "Bug in Libpng"),
            SingleRevision(
                "79b7e4e621fd611df658ec24a07080708fffe1de", "Bug in Libpng"
            ),
            SingleRevision(
                "67a289ffa924a00fab96a9bd6da8c069441138fa", "Bug in Libpng"
            ),
            GoodBadSubgraph(["b76ab1260d156a390a47f81c0ea6ef0524208b8e"],
                            ["e4f124e3352d63f7162ab7c1360a2db6d54f2ff2"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["5bc90389bffa3cf3d2b8325bfac5c4344a206bc0"],
                            ["c35f888c46986093582f73cafcd7185472748e4b"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["5b79cd52f440a7e1ce418f87b92b526765719c54"],
                            ["c4081f05c88d171cd476d5df78ed4a690296c602"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["9c946e22fcad10c2a44c0380c0909da6732097ce"],
                            ["342c4eab2a0565de456f1f3efcc41b635544160e"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["40afb685704f1a5bf8d9edc0b5c7ec7f25e94b77"],
                            ["619cf868e60807d759639cfb070987ad059fa0c9"],
                            "Bug in Libpng"),
            SingleRevision(
                "7c709f039f7ff3cc92eea03af0660a171ef0673d", "Bug in Libpng"
            ),
            SingleRevision(
                "3fa1df48a1c14d3004733471ce7fbce916750911", "Bug in Libpng"
            ),
            SingleRevision(
                "a1312f7b190df545fb7ec90e23cc4a9b6328af00", "Bug in Libpng"
            ),
            SingleRevision(
                "42369ccd85a48c0802093ecf02444cc4dfc4f1dd", "Bug in Libpng"
            ),
            SingleRevision(
                "d930d36155fe79b277c11d868572769cb4ffb586", "Bug in Libpng"
            ),
            SingleRevision(
                "6e8ba0fab666eb6c90e929988e8fb3439449e7f9", "Bug in Libpng"
            ),
            SingleRevision(
                "ad41b8838a91ab36880716c2264f70ef4651b89f", "Bug in Libpng"
            ),
            GoodBadSubgraph(["d332c67da7818132e462fc44ec28b0b7420bc5b5"],
                            ["1d7f56ab64f397d5841cc277fae7aeaac44ac088"],
                            "Bug in Libpng"),
            SingleRevision(
                "db67cba8d42f5f13a96ce6080a61567f66afd915", "Bug in Libpng"
            ),
            SingleRevision(
                "c9e27d026de520a8646f8f5ee6d20a4080d258b6", "Bug in Libpng"
            ),
            SingleRevision(
                "7b9796539d8d15a61f2aa495fd23fbd5b4a90335", "Bug in Libpng"
            ),
            GoodBadSubgraph(["05a4db1fcd776931bbba0c3472ada94014c3a395"], [
                "403636577395221e63e27b69c5546ae6606f4fa2",
                "2e7c3a6e706e8d3cb54587c2bf8b3b3fdc30ae5a"
            ], "Bug in Libpng"),
            SingleRevision(
                "6cae24c265ea7a3d19a1655b0f7692ada4273290", "Bug in Libpng"
            ),
            SingleRevision(
                "04336ba10ff4da8b69292f6c936c4c0d7bbe67c7", "Bug in Libpng"
            )
        ])(
            PaperConfigSpecificGit(
                project_name="libpng",
                remote="https://github.com/glennrp/libpng.git",
                local="libpng",
                refspec="origin/HEAD",
                limit=None,
                shallow=False
            )
        )
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10
                              ).run('apt', 'install', '-y', 'cmake')

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Libpng.NAME))

        binary_map.specify_binary('build/libpng.so', BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libpng_source = local.path(self.source_of(self.primary_source))

        compiler = bb.compiler.cc(self)
        mkdir(libpng_source / "build")
        with local.cwd(libpng_source / "build"):
            with local.env(CC=str(compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", "..")

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))
        with local.cwd(libpng_source):
            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Libpng", "Libpng")]