meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| soc:irt:playbooks:windows_disk [2026/06/18 16:35] – titannet | soc:irt:playbooks:windows_disk [2026/06/18 16:51] (current) – [Prefetch on Linux] titannet | ||
|---|---|---|---|
| Line 180: | Line 180: | ||
| use std::fs; | use std::fs; | ||
| use std:: | use std:: | ||
| + | use chrono:: | ||
| /// based on https:// | /// based on https:// | ||
| + | |||
| + | |||
| + | fn filetime_to_datetime(ft: | ||
| + | // FILETIME epoch (1601-01-01) -> Unix epoch (1970-01-01) | ||
| + | const EPOCH_DIFF_100NS: | ||
| + | |||
| + | let unix_100ns = ft - EPOCH_DIFF_100NS; | ||
| + | let secs = unix_100ns / 10_000_000; | ||
| + | let nanos = ((unix_100ns % 10_000_000) * 100) as u32; | ||
| + | |||
| + | DateTime:: | ||
| + | .expect(" | ||
| + | } | ||
| + | |||
| + | fn csv_escape(s: | ||
| + | let mut out = String:: | ||
| + | out.push('"' | ||
| + | for c in s.chars() { | ||
| + | match c { | ||
| + | '"' | ||
| + | _ => out.push(c), | ||
| + | } | ||
| + | } | ||
| + | out.push('"' | ||
| + | out | ||
| + | } | ||
| fn main() { | fn main() { | ||
| Line 207: | Line 234: | ||
| // | // | ||
| + | println!( | ||
| + | " | ||
| + | ); | ||
| for name in files { | for name in files { | ||
| - | |||
| let p = PathBuf:: | let p = PathBuf:: | ||
| - | | + | |
| let raw = std:: | let raw = std:: | ||
| let scca = prefetch_core:: | let scca = prefetch_core:: | ||
| - | // Write the decompressed payload so the harness can diff it against its | + | |
| - | // own (dissect.util) decompression byte-for-byte. | + | |
| std:: | std:: | ||
| .expect(" | .expect(" | ||
| let info = prefetch_core:: | let info = prefetch_core:: | ||
| - | | + | |
| - | let vols: Vec< | + | |
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | .join(" | ||
| + | |||
| + | let volumes | ||
| .volumes | .volumes | ||
| .iter() | .iter() | ||
| .map(|v| { | .map(|v| { | ||
| format!( | format!( | ||
| - | "{{\"serial\":{},\"device_path\":\"{}\",\"creation_time\": | + | " |
| v.serial, | v.serial, | ||
| escape(& | escape(& | ||
| - | v.creation_time | + | |
| ) | ) | ||
| }) | }) | ||
| - | .collect(); | + | .collect::< |
| + | .join(";" | ||
| + | |||
| + | let last_runs = info | ||
| + | .last_run_times | ||
| + | .iter() | ||
| + | .map(|t| filetime_to_datetime(*t).to_string()) | ||
| + | .collect::< | ||
| + | .join(";" | ||
| println!( | println!( | ||
| - | | + | " |
| - | name, | + | |
| scca.len(), | scca.len(), | ||
| info.version, | info.version, | ||
| - | | + | |
| info.run_count, | info.run_count, | ||
| - | | + | |
| info.filenames.len(), | info.filenames.len(), | ||
| - | | + | |
| - | | + | |
| ); | ); | ||
| } | } | ||