| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 |
|
| 23 | (define-module (gnu packages antivirus)
|
| 24 | #:use-module ((guix licenses) #:prefix license:)
|
| 25 | #:use-module (guix build-system cargo)
|
| 26 | #:use-module (guix build-system cmake)
|
| 27 | #:use-module (guix build-system gnu)
|
| 28 | #:use-module (guix gexp)
|
| 29 | #:use-module (guix packages)
|
| 30 | #:use-module (guix download)
|
| 31 | #:use-module (guix git-download)
|
| 32 | #:use-module (guix utils)
|
| 33 | #:use-module (gnu packages)
|
| 34 | #:use-module (gnu packages autotools)
|
| 35 | #:use-module (gnu packages bash)
|
| 36 | #:use-module (gnu packages check)
|
| 37 | #:use-module (gnu packages compression)
|
| 38 | #:use-module (gnu packages cmake)
|
| 39 | #:use-module (gnu packages curl)
|
| 40 | #:use-module (gnu packages ncurses)
|
| 41 | #:use-module (gnu packages pcre)
|
| 42 | #:use-module (gnu packages pkg-config)
|
| 43 | #:use-module (gnu packages protobuf)
|
| 44 | #:use-module (gnu packages python)
|
| 45 | #:use-module (gnu packages python-check)
|
| 46 | #:use-module (gnu packages rust)
|
| 47 | #:use-module (gnu packages rust-apps)
|
| 48 | #:use-module (gnu packages rust)
|
| 49 | #:use-module (gnu packages tls)
|
| 50 | #:use-module (gnu packages web)
|
| 51 | #:use-module (gnu packages xml))
|
| 52 |
|
| 53 | (define-public clamav
|
| 54 | (package
|
| 55 | (name "clamav")
|
| 56 | (version "1.4.3")
|
| 57 | (source (origin
|
| 58 | (method url-fetch)
|
| 59 | (uri
|
| 60 | (list
|
| 61 | (string-append "https://www.clamav.net/downloads/production/"
|
| 62 | "clamav-" version ".tar.gz")
|
| 63 | (string-append "https://github.com/Cisco-Talos/clamav/"
|
| 64 | "releases/download/clamav-" version
|
| 65 | "/clamav-" version ".tar.gz")))
|
| 66 | (sha256
|
| 67 | (base32
|
| 68 | "041j6jhll4lz7xhissh0094cfvhyi9jkbxcfa5dv6ra77nzwlx6q"))
|
| 69 | (modules '((guix build utils)))
|
| 70 | (snippet
|
| 71 | '(begin
|
| 72 | (for-each delete-file-recursively
|
| 73 | '(".cargo" |
| 74 | "win32" |
| 75 | "libclamunrar")))))) |
| 76 | (build-system cmake-build-system)
|
| 77 | (arguments
|
| 78 | (list
|
| 79 | #:configure-flags ''("-DENABLE_MILTER=OFF" "-DENABLE_UNRAR=OFF")
|
| 80 | #:imported-modules `(,@%cmake-build-system-modules
|
| 81 | ,@%cargo-build-system-modules)
|
| 82 | #:modules '(((guix build cargo-build-system) #:prefix cargo:)
|
| 83 | (guix build cmake-build-system)
|
| 84 | (guix build utils))
|
| 85 | #:phases
|
| 86 | #~(modify-phases %standard-phases
|
| 87 | (add-after 'unpack 'prepare-cargo-build-system
|
| 88 | (lambda args
|
| 89 | (for-each
|
| 90 | (lambda (phase)
|
| 91 | (format #t "Running cargo phase: ~a~%" phase)
|
| 92 | (apply (assoc-ref cargo:%standard-phases phase)
|
| 93 | #:vendor-dir ".cargo/vendor"
|
| 94 | #:cargo-target #$(cargo-triplet)
|
| 95 | args))
|
| 96 | '(unpack-rust-crates
|
| 97 | configure
|
| 98 | check-for-pregenerated-files
|
| 99 | patch-cargo-checksums))))
|
| 100 | (add-after 'prepare-cargo-build-system 'patch-rust-requirements
|
| 101 | (lambda _
|
| 102 | (substitute* "libclamav_rust/Cargo.toml"
|
| 103 | |
| 104 | (("onenote_parser = .*")
|
| 105 | "onenote_parser = \"*\"\n"))))
|
| 106 | (add-after 'unpack 'skip-clamd-tests
|
| 107 | |
| 108 | |
| 109 | (lambda* (#:key tests? #:allow-other-keys)
|
| 110 | (when tests?
|
| 111 | (substitute* "unit_tests/CMakeLists.txt"
|
| 112 | (("clamd_test\\.py" test)
|
| 113 | (string-append
|
| 114 | test " -k \"not test_clamd_08_VirusEvent\"")))))))))
|
| 115 | (native-inputs
|
| 116 | (append
|
| 117 | (list pkg-config
|
| 118 | python-minimal
|
| 119 | python-pytest
|
| 120 | rust
|
| 121 | `(,rust "cargo"))
|
| 122 | (or (and=> (%current-target-system)
|
| 123 | (compose list make-rust-sysroot))
|
| 124 | '())))
|
| 125 | (inputs
|
| 126 | (cons* bzip2
|
| 127 | check |
| 128 | curl
|
| 129 | json-c
|
| 130 | libressl
|
| 131 | libxml2
|
| 132 | ncurses
|
| 133 | pcre2
|
| 134 | zlib
|
| 135 | (cargo-inputs 'clamav)))
|
| 136 | (home-page "https://www.clamav.net")
|
| 137 | (synopsis "Antivirus engine")
|
| 138 | (description
|
| 139 | "Clam AntiVirus is an anti-virus toolkit, designed especially for e-mail
|
| 140 | scanning on mail gateways. It provides a number of utilities including a
|
| 141 | flexible and scalable multi-threaded daemon, a command line scanner, and
|
| 142 | advanced tool for automatic database updates. The core of the package is an
|
| 143 | anti-virus engine available in the form of a shared library.")
|
| 144 | (properties `((release-monitoring-url
|
| 145 | . "https://github.com/Cisco-Talos/clamav/releases")))
|
| 146 | (license (list license:gpl2+ |
| 147 | license:lgpl2.1 |
| 148 | license:public-domain |
| 149 | (package-license bzip2) |
| 150 | license:bsd-2 |
| 151 | license:bsd-3 |
| 152 | license:ncsa |
| 153 | license:zlib |
| 154 | license:x11 |
| 155 | (license:non-copyleft "libclamav/strlcat.c") |
| 156 | license:asl2.0 |
| 157 | license:expat)))) |
| 158 |
|
| 159 | (define-public yara
|
| 160 | (package
|
| 161 | (name "yara")
|
| 162 | (version "4.5.2")
|
| 163 | (source
|
| 164 | (origin
|
| 165 | (method git-fetch)
|
| 166 | (uri (git-reference
|
| 167 | (url "https://github.com/VirusTotal/yara")
|
| 168 | (commit (string-append "v" version))))
|
| 169 | (file-name (git-file-name name version))
|
| 170 | (sha256
|
| 171 | (base32 "1qaw1zv618jkqa5g39p1sdv8s6a7q23ayqfrqv0bj2z1g4nmn95g"))))
|
| 172 | (build-system gnu-build-system)
|
| 173 | (arguments
|
| 174 | (list
|
| 175 | #:phases
|
| 176 | #~(modify-phases %standard-phases
|
| 177 | (add-after 'unpack 'patch-tests
|
| 178 | (lambda _
|
| 179 | (substitute* "tests/test-rules.c"
|
| 180 | (("/bin/sh")
|
| 181 | (string-append #$(this-package-input "bash-minimal")
|
| 182 | "/bin/sh"))))))))
|
| 183 | (inputs (list openssl bash-minimal))
|
| 184 | (native-inputs (list autoconf automake libtool protobuf pkg-config))
|
| 185 | (home-page "https://github.com/VirusTotal/yara")
|
| 186 | (synopsis "Pattern matching swiss knife")
|
| 187 | (description
|
| 188 | "YARA is a tool aimed at helping malware researchers to identify and
|
| 189 | classify malware samples. With YARA you can create rules that evaluate
|
| 190 | conditions based on textual and binary patterns. This package also provides
|
| 191 | an executable to scan files, folders, and running processes and report those
|
| 192 | that match said rules.")
|
| 193 | (license license:bsd-3)))
|