|
1 | 1 | class YaraX < Formula
|
2 | 2 | desc "Tool to do pattern matching for malware research"
|
3 | 3 | homepage "https://virustotal.github.io/yara-x/"
|
4 |
| - url "https://github.com/VirusTotal/yara-x/archive/refs/tags/v1.1.0.tar.gz" |
5 |
| - sha256 "90bbe970a85ff2c707b2706a89cb165cd5b8c706451cfa4b25e0aaa77250a6da" |
6 | 4 | license "BSD-3-Clause"
|
7 | 5 | head "https://github.com/VirusTotal/yara-x.git", branch: "main"
|
8 | 6 |
|
| 7 | + stable do |
| 8 | + url "https://github.com/VirusTotal/yara-x/archive/refs/tags/v1.2.0.tar.gz" |
| 9 | + sha256 "f825a24bb2132d284fc9b2bdde1440f6a1f55d699388fee15f859b535e8074e3" |
| 10 | + |
| 11 | + # patch to fix `elf` module error, upstream commit ref, https://github.com/VirusTotal/yara-x/commit/ae9a6323ff5e6725fac69b76997db82aa53e713a |
| 12 | + patch :DATA |
| 13 | + end |
| 14 | + |
9 | 15 | livecheck do
|
10 | 16 | url :stable
|
11 | 17 | strategy :github_latest
|
12 | 18 | end
|
13 | 19 |
|
14 | 20 | bottle do
|
15 |
| - sha256 cellar: :any, arm64_sequoia: "241017c95d97f39e29730d0d51ede05cb5d943934a7d78fa51990a0aff3d9406" |
16 |
| - sha256 cellar: :any, arm64_sonoma: "a3ef596bb84a5f2d0168dcc1079bd261a9ec8cd50646b738ffc9fecc0b15e60a" |
17 |
| - sha256 cellar: :any, arm64_ventura: "8d3c52a044cca700e1c1d9e3b2d807f9760adbc513b787ed128994c4928ff504" |
18 |
| - sha256 cellar: :any, sonoma: "85afc2e825ceba6a13e6ff6061be2bdd451af1d8a0293066c8cab13e28ccad77" |
19 |
| - sha256 cellar: :any, ventura: "5f156f595d7860ce0ee015413bc04b38ee4dd348b3cfe714685d0b69948bfa8e" |
20 |
| - sha256 cellar: :any_skip_relocation, arm64_linux: "7919951cd67ef7d57570c87763581d2c12ce381dc2951ac1e989df24f3bbc90c" |
21 |
| - sha256 cellar: :any_skip_relocation, x86_64_linux: "f036347d37eb1ce446004253bf99ae9de37bf662bfe1a18808bf37802c8a95fe" |
| 21 | + sha256 cellar: :any, arm64_sequoia: "8091bed57071a0e879a57e604eff39832ffb904120d1bb34f96666c6c455975a" |
| 22 | + sha256 cellar: :any, arm64_sonoma: "e26f750314254c0b9ec5a2ef5d564b31658577f5a422f940760a8c36111dd475" |
| 23 | + sha256 cellar: :any, arm64_ventura: "bc3f6a357cb9f432d7ef56962367f862925c28d286929cebadfff32ad95eb150" |
| 24 | + sha256 cellar: :any, sonoma: "a7b5f6508bd875fe780bfa529c3de5336955cca4cbd168dab2f5857deefbb3ee" |
| 25 | + sha256 cellar: :any, ventura: "c75158ee76e14430ea03f8175941a2a7a3a657780668e9647c24072335692c62" |
| 26 | + sha256 cellar: :any_skip_relocation, arm64_linux: "dd53aea4851259f822ba58d5fa863fa406e71660dc376b9494e7b97b3c9de426" |
| 27 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "5fbdf9d8ad0a2561e60172de60f5a44ed2ebc3cfe4e5a518314763e1f0b3e686" |
22 | 28 | end
|
23 | 29 |
|
24 | 30 | depends_on "cargo-c" => :build
|
@@ -57,3 +63,44 @@ def install
|
57 | 63 | assert_match version.to_s, shell_output("#{bin}/yr --version")
|
58 | 64 | end
|
59 | 65 | end
|
| 66 | + |
| 67 | +__END__ |
| 68 | +diff --git a/lib/src/modules/elf/mod.rs b/lib/src/modules/elf/mod.rs |
| 69 | +index 5384fcea7..7a38dc4de 100644 |
| 70 | +--- a/lib/src/modules/elf/mod.rs |
| 71 | ++++ b/lib/src/modules/elf/mod.rs |
| 72 | +@@ -30,9 +30,11 @@ thread_local!( |
| 73 | + fn main(data: &[u8], _meta: Option<&[u8]>) -> Result<ELF, ModuleError> { |
| 74 | + IMPORT_MD5_CACHE.with(|cache| *cache.borrow_mut() = None); |
| 75 | + TLSH_CACHE.with(|cache| *cache.borrow_mut() = None); |
| 76 | +- parser::ElfParser::new() |
| 77 | +- .parse(data) |
| 78 | +- .map_err(|e| ModuleError::InternalError { err: e.to_string() }) |
| 79 | ++ |
| 80 | ++ match parser::ElfParser::new().parse(data) { |
| 81 | ++ Ok(elf) => Ok(elf), |
| 82 | ++ Err(_) => Ok(ELF::new()), |
| 83 | ++ } |
| 84 | + } |
| 85 | + |
| 86 | + #[module_export] |
| 87 | +diff --git a/lib/src/modules/lnk/mod.rs b/lib/src/modules/lnk/mod.rs |
| 88 | +index 22f06a3a1..fd73767fe 100644 |
| 89 | +--- a/lib/src/modules/lnk/mod.rs |
| 90 | ++++ b/lib/src/modules/lnk/mod.rs |
| 91 | +@@ -18,7 +18,12 @@ pub mod parser; |
| 92 | + |
| 93 | + #[module_main] |
| 94 | + fn main(data: &[u8], _meta: Option<&[u8]>) -> Result<Lnk, ModuleError> { |
| 95 | +- parser::LnkParser::new() |
| 96 | +- .parse(data) |
| 97 | +- .map_err(|e| ModuleError::InternalError { err: e.to_string() }) |
| 98 | ++ match parser::LnkParser::new().parse(data) { |
| 99 | ++ Ok(lnk) => Ok(lnk), |
| 100 | ++ Err(_) => { |
| 101 | ++ let mut lnk = Lnk::new(); |
| 102 | ++ lnk.is_lnk = Some(false); |
| 103 | ++ Ok(lnk) |
| 104 | ++ } |
| 105 | ++ } |
| 106 | + } |
0 commit comments