pub struct EvtxParser<T: ReadSeek> { /* private fields */ }Expand description
Wraps a single EvtxFileHeader.
Example usage (single threaded):
let mut parser = EvtxParser::from_path(fp).unwrap();
for record in parser.records() {
match record {
Ok(r) => println!("Record {}\n{}", r.event_record_id, r.data),
Err(e) => eprintln!("{}", e),
}
}
Example usage (multi-threaded):
let settings = ParserSettings::default().num_threads(0);
let mut parser = EvtxParser::from_path(fp).unwrap().with_configuration(settings);
for record in parser.records() {
match record {
Ok(r) => println!("Record {}\n{}", r.event_record_id, r.data),
Err(e) => eprintln!("{}", e),
}
}
Implementations§
Source§impl EvtxParser<File>
impl EvtxParser<File>
Source§impl EvtxParser<Cursor<Vec<u8>>>
impl EvtxParser<Cursor<Vec<u8>>>
Sourcepub fn from_buffer(buffer: Vec<u8>) -> Result<Self>
pub fn from_buffer(buffer: Vec<u8>) -> Result<Self>
Attempts to load an evtx file from a given path, will fail the evtx header is invalid.
Source§impl<T: ReadSeek> EvtxParser<T>
impl<T: ReadSeek> EvtxParser<T>
pub fn from_read_seek(read_seek: T) -> Result<Self>
pub fn with_configuration(self, configuration: ParserSettings) -> Self
Sourcepub fn find_next_chunk(
&mut self,
chunk_number: u64,
) -> Option<(Result<EvtxChunkData>, u64)>
pub fn find_next_chunk( &mut self, chunk_number: u64, ) -> Option<(Result<EvtxChunkData>, u64)>
Find the next chunk, staring at chunk_number (inclusive).
If a chunk is found, returns the data of the chunk or the relevant error,
and the number of that chunk.
Sourcepub fn chunks(&mut self) -> IterChunks<'_, T> ⓘ
pub fn chunks(&mut self) -> IterChunks<'_, T> ⓘ
Return an iterator over all the chunks. Each chunk supports iterating over it’s records in their un-serialized state (before they are converted to XML or JSON).
Sourcepub fn into_chunks(self) -> IntoIterChunks<T> ⓘ
pub fn into_chunks(self) -> IntoIterChunks<T> ⓘ
Consumes the parser, returning an iterator over all the chunks. Each chunk supports iterating over it’s records in their un-serialized state (before they are converted to XML or JSON).
Sourcepub fn serialized_records<'a, U: Send>(
&'a mut self,
f: impl FnMut(Result<EvtxRecord<'_>>) -> Result<U> + Send + Sync + Clone + 'a,
) -> impl Iterator<Item = Result<U>> + 'a
pub fn serialized_records<'a, U: Send>( &'a mut self, f: impl FnMut(Result<EvtxRecord<'_>>) -> Result<U> + Send + Sync + Clone + 'a, ) -> impl Iterator<Item = Result<U>> + 'a
Return an iterator over all the records.
Records will be mapped f, which must produce owned data from the records.
Sourcepub fn records(
&mut self,
) -> impl Iterator<Item = Result<SerializedEvtxRecord<String>>> + '_
pub fn records( &mut self, ) -> impl Iterator<Item = Result<SerializedEvtxRecord<String>>> + '_
Return an iterator over all the records. Records will be XML-formatted.
Sourcepub fn records_json(
&mut self,
) -> impl Iterator<Item = Result<SerializedEvtxRecord<String>>> + '_
pub fn records_json( &mut self, ) -> impl Iterator<Item = Result<SerializedEvtxRecord<String>>> + '_
Return an iterator over all the records. Records will be JSON-formatted.
Sourcepub fn records_json_value(
&mut self,
) -> impl Iterator<Item = Result<SerializedEvtxRecord<Value>>> + '_
pub fn records_json_value( &mut self, ) -> impl Iterator<Item = Result<SerializedEvtxRecord<Value>>> + '_
Return an iterator over all the records.
Records will have a serde_json::Value data attribute.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for EvtxParser<T>where
T: Freeze,
impl<T> !RefUnwindSafe for EvtxParser<T>
impl<T> Send for EvtxParser<T>where
T: Send,
impl<T> Sync for EvtxParser<T>where
T: Sync,
impl<T> Unpin for EvtxParser<T>where
T: Unpin,
impl<T> !UnwindSafe for EvtxParser<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more