Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 41 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace.package]
version = "1.16.0"
version = "1.17.0"
authors = ["Victor M. Alvarez <vmalvarez@virustotal.com>"]
edition = "2024"
homepage = "https://virustotal.github.io/yara-x"
Expand Down Expand Up @@ -109,13 +109,13 @@ wasm-opt = "0.116.1"
wasmtime = { version = "43.0.2", default-features = false }
x509-parser = "0.18.0"
yansi = "1.0.1"
yara-x = { path = "lib", version = "1.16.0" }
yara-x-fmt = { path = "fmt", version = "1.16.0" }
yara-x-macros = { path = "macros", version = "1.16.0" }
yara-x-parser = { path = "parser", version = "1.16.0" }
yara-x-proto = { path = "proto", version = "1.16.0"}
yara-x-proto-yaml = { path = "proto-yaml", version = "1.16.0" }
yara-x-proto-json = { path = "proto-json", version = "1.16.0" }
yara-x = { path = "lib", version = "1.17.0" }
yara-x-fmt = { path = "fmt", version = "1.17.0" }
yara-x-macros = { path = "macros", version = "1.17.0" }
yara-x-parser = { path = "parser", version = "1.17.0" }
yara-x-proto = { path = "proto", version = "1.17.0"}
yara-x-proto-yaml = { path = "proto-yaml", version = "1.17.0" }
yara-x-proto-json = { path = "proto-json", version = "1.17.0" }
zip = { version = "8.2.0", default-features = false }
simd-adler32 = "0.3.9"
simd_cesu8 = "1.1.1"
Expand Down
6 changes: 3 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ yara-x-proto-yaml = { workspace = true }
yara-x-proto-json = { workspace = true }
yara-x-fmt = { workspace = true }

chardetng = "0.1.17"
chardetng = "1.0.0"
crossbeam = "0.8.4"
crossterm = "0.29.0"
dunce = "1.0.5"
Expand All @@ -83,6 +83,6 @@ unicode-width = "0.2.2"
wild = "2.2.1"

[dev-dependencies]
assert_cmd = "2.1.2"
assert_fs = "1.1.3"
assert_cmd = "2.2.2"
assert_fs = "1.1.4"
predicates = { workspace = true }
9 changes: 6 additions & 3 deletions cli/src/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,17 @@ pub fn exec_fix_encoding(
})?;

// Detect the original encoding.
let mut detector = chardetng::EncodingDetector::new();
let mut detector = chardetng::EncodingDetector::new(
chardetng::Iso2022JpDetection::Allow,
);
detector.feed(src.as_slice(), true);

// Decode the source file as UTF-8. `invalid_chars` will be true
// if some character could not be encoded as UTF-8 and was replaced
// by the replacement character.
let (src_utf8, encoding, invalid_chars) =
detector.guess(None, true).decode(src.as_slice());
let (src_utf8, encoding, invalid_chars) = detector
.guess(None, chardetng::Utf8Detection::Allow)
.decode(src.as_slice());

// Re-write the source as UTF-8, except if --dry-run was used or
// the original source was not modified at all.
Expand Down
8 changes: 8 additions & 0 deletions cli/src/commands/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ pub fn scan() -> Command {
.help("Print only the number of matches per file"),
arg!(--"disable-console-logs")
.help("Disable printing console log messages"),
arg!(-f --"fast-scan")
.help("Enable fast-scan mode")
.long_help(help::FAST_SCAN_LONG_HELP),
arg!(--"max-matches-per-pattern" <MATCHES>)
.help("Maximum number of matches per pattern")
.long_help(help::MAX_MATCHES_PER_PATTERN_LONG_HELP)
Expand Down Expand Up @@ -181,6 +184,7 @@ pub fn exec_scan(args: &ArgMatches, config: &Config) -> anyhow::Result<()> {
let scan_list = args.get_flag("scan-list");
let recursive = args.get_one::<usize>("recursive");
let no_mmap = args.get_flag("no-mmap");
let fast_scan = args.get_flag("fast-scan");
let max_matches_per_pattern =
args.get_one::<usize>("max-matches-per-pattern");

Expand Down Expand Up @@ -311,6 +315,10 @@ pub fn exec_scan(args: &ArgMatches, config: &Config) -> anyhow::Result<()> {
scanner.use_mmap(false);
}

if fast_scan {
scanner.fast_scan(true);
}

if let Some(max_matches_per_pattern) = max_matches_per_pattern {
scanner.max_matches_per_pattern(*max_matches_per_pattern);
}
Expand Down
Loading
Loading