EvtxParser

Struct EvtxParser 

Source
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>

Source

pub fn from_path(path: impl AsRef<Path>) -> Result<Self>

Attempts to load an evtx file from a given path, will fail if the path does not exist, or if evtx header is invalid.

Source§

impl EvtxParser<Cursor<Vec<u8>>>

Source

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>

Source

pub fn from_read_seek(read_seek: T) -> Result<Self>

Source

pub fn with_configuration(self, configuration: ParserSettings) -> Self

Source

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.

Source

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).

Source

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).

Source

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.

Source

pub fn records( &mut self, ) -> impl Iterator<Item = Result<SerializedEvtxRecord<String>>> + '_

Return an iterator over all the records. Records will be XML-formatted.

Source

pub fn records_json( &mut self, ) -> impl Iterator<Item = Result<SerializedEvtxRecord<String>>> + '_

Return an iterator over all the records. Records will be JSON-formatted.

Source

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§

Source§

impl<T: ReadSeek> Debug for EvtxParser<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.