-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into documentation
- Loading branch information
Showing
18 changed files
with
593 additions
and
276 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,31 @@ | ||
use std::{future, path::PathBuf, pin::pin}; | ||
use rayhunter::{analysis::analyzer::Harness, diag::DataType, qmdl::QmdlReader}; | ||
use tokio::fs::File; | ||
use clap::Parser; | ||
use futures::TryStreamExt; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(version, about)] | ||
struct Args { | ||
#[arg(short, long)] | ||
qmdl_path: PathBuf, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
env_logger::init(); | ||
let args = Args::parse(); | ||
|
||
let mut harness = Harness::new_with_all_analyzers(); | ||
|
||
let qmdl_file = File::open(args.qmdl_path).await.expect("failed to open QMDL file"); | ||
let file_size = qmdl_file.metadata().await.expect("failed to get QMDL file metadata").len(); | ||
let mut qmdl_reader = QmdlReader::new(qmdl_file, Some(file_size as usize)); | ||
let mut qmdl_stream = pin!(qmdl_reader.as_stream() | ||
.try_filter(|container| future::ready(container.data_type == DataType::UserSpace))); | ||
println!("{}\n", serde_json::to_string(&harness.get_metadata()).expect("failed to serialize report metadata")); | ||
while let Some(container) = qmdl_stream.try_next().await.expect("failed getting QMDL container") { | ||
let row = harness.analyze_qmdl_messages(container); | ||
println!("{}\n", serde_json::to_string(&row).expect("failed to serialize row")); | ||
} | ||
} |
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
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
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
Oops, something went wrong.