#![allow(dead_code, reason = "each area's test uses its own part of this")]
use std::path::PathBuf;
use super::corpus::{file_bytes, root};
pub const CRLF_MIXED: &[u8] = b"crlf one\r\nlf two\ncr three\rcrlf four\r\n";
pub fn lab_root() -> PathBuf {
root().join("windows-lab")
}
pub fn lab(file: &str) -> Vec<(String, Vec<u8>)> {
let root = lab_root();
let mut found: Vec<(String, Vec<u8>)> = std::fs::read_dir(&root)
.unwrap_or_else(|e| panic!("{root:?}: {e}"))
.flatten()
.filter_map(|image| {
let bytes = std::fs::read(image.path().join(file)).ok()?;
Some((image.file_name().to_string_lossy().into_owned(), bytes))
})
.collect();
found.sort();
assert!(!found.is_empty(), "no windows-lab image holds {file}");
found
}
pub fn event_4688() -> (Vec<u8>, Vec<u8>) {
let crlf = file_bytes(
"attack-data",
"datasets/attack_techniques/T1003.001/atomic_red_team/windows-security.log",
);
let lf = String::from_utf8(crlf.clone())
.expect("the 4688 sample is ASCII")
.replace("\r\n", "\n")
.into_bytes();
assert!(lf.len() < crlf.len(), "the corpus file lost its CRLF");
(crlf, lf)
}