|
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
|
@@ -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