scanner: Report compressed and uncompressed file size of each SWF

This commit is contained in:
David Wendt 2021-09-10 23:26:31 -04:00 committed by Mike Welsh
parent 37f084e3e0
commit 9bb5229e14
3 changed files with 13 additions and 0 deletions

View File

@ -103,6 +103,8 @@ pub fn execute_report_main(execute_report_opt: ExecuteReportOpt) -> Result<(), s
}
};
file_result.compressed_len = Some(data.len());
let mut hash = Sha256::new();
hash.update(&data[..]);
@ -131,6 +133,7 @@ pub fn execute_report_main(execute_report_opt: ExecuteReportOpt) -> Result<(), s
let stage_width = (stage_size.x_max - stage_size.x_min).to_pixels();
let stage_height = (stage_size.y_max - stage_size.y_min).to_pixels();
file_result.uncompressed_len = Some(swf.header.uncompressed_len());
file_result.compression = Some(swf.header.compression().into());
file_result.version = Some(swf.header.version());
file_result.stage_size = Some(format!("{}x{}", stage_width, stage_height));

View File

@ -72,6 +72,12 @@ pub struct FileResults {
/// How long testing took to complete
pub testing_time: u128,
/// The compressed length of the SWF file.
pub compressed_len: Option<usize>,
/// The uncompressed length of the SWF file.
pub uncompressed_len: Option<u32>,
/// Any errors encountered while testing.
pub error: Option<String>,
@ -116,6 +122,8 @@ impl FileResults {
hash: vec![],
progress: Step::Start,
testing_time: 0,
compressed_len: None,
uncompressed_len: None,
error: None,
compression: None,
version: None,

View File

@ -106,6 +106,8 @@ pub fn scan_main(opt: ScanOpt) -> Result<(), std::io::Error> {
"SHA256 Hash",
"Progress",
"Test Duration",
"Compressed Length",
"Uncompressed Length",
"Error",
"Compression",
"SWF Version",