-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan Starke
committed
Nov 2, 2023
1 parent
450bbba
commit 0330115
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod x64dbg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use std::{ | ||
io::{BufRead, BufReader, Cursor}, | ||
path::PathBuf, | ||
}; | ||
|
||
use assert_cmd::Command; | ||
use dfir_toolkit::common::bodyfile::Bodyfile3Line; | ||
|
||
#[test] | ||
fn test_x64dbg() { | ||
let mut cmd = Command::cargo_bin("lnk2bodyfile").unwrap(); | ||
let mut data_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()); | ||
data_path.push("tests"); | ||
data_path.push("data"); | ||
data_path.push("lnk2bodyfile"); | ||
data_path.push("x64dbg.lnk"); | ||
|
||
let result = cmd.arg(data_path).ok(); | ||
if result.is_err() { | ||
println!("{}", result.as_ref().err().unwrap()); | ||
} | ||
|
||
assert!(result.is_ok()); | ||
|
||
// parse the result as bodyfile 😈 | ||
let reader = BufReader::new(Cursor::new(result.unwrap().stdout)); | ||
let mut lines_iterator = reader.lines(); | ||
let first_line = lines_iterator.next().unwrap().unwrap(); | ||
|
||
let bfline = Bodyfile3Line::try_from(&first_line[..]).unwrap(); | ||
assert_eq!(bfline.get_name(), r#"C:\Program Files\x64dbg\release\x64\x64dbg.exe - (referred to by "x64dbg.lnk")"#); | ||
assert_eq!(*bfline.get_size(), 172768); | ||
assert_eq!(*bfline.get_atime(), 1695724808); | ||
assert_eq!(*bfline.get_mtime(), 1695250410); | ||
assert_eq!(*bfline.get_ctime(), -1); | ||
assert_eq!(*bfline.get_crtime(), 1695724422); | ||
|
||
assert!(lines_iterator.next().is_none()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mod mactime2; | ||
mod ts2date; | ||
mod ts2date; | ||
mod lnk2bodyfile; |