Windows EVTX and BINXML codec with CRC verification, XML rendering and an in-memory writer
moon add kekeshuo/moonevtx@0.1.1let bytes = @evtx.write_events(@evtx.sample_event_drafts()).unwrap()
let file = @evtx.parse_evtx(bytes).unwrap()
file.verify().unwrap()
let xml = file.records[0].xml(@evtx.PythonEvtx).unwrap()
let events = file.events(@evtx.PythonEvtx).unwrap()moon run examples/inspect
moon run examples/filter
moon run examples/roundtripmoon check --target wasm-gc --deny-warn
moon check --target wasm --deny-warn
moon check --target js --deny-warn
moon check --target native --deny-warn
moon build --target wasm-gc
moon test --target wasm-gc
moon test --target js
moon test --target nativepub(all) struct ChunkHeader {
offset : Int
first_record : UInt64
last_record : UInt64
log_first_record : UInt64
log_last_record : UInt64
header_size : UInt
last_record_offset : UInt
next_record_offset : UInt
data_checksum : UInt
header_checksum : UInt
header_ok : Bool
data_ok : Bool
} derive(Debug)pub(all) struct EventDraft {
provider : String
event_id : UInt
level : Int
timestamp : UInt64
channel : String
computer : String
message : String
} derive(Debug)pub(all) enum EvtxError {
Truncated(String, Int, Int)
InvalidMagic(String, String)
InvalidChecksum(String, UInt, UInt)
InvalidHeader(String)
InvalidChunk(String)
InvalidRecord(String)
UnexpectedToken(Int, Int)
InvalidName(String)
UnsupportedType(Int, Int)
InvalidSubstitution(String)
InvalidDraft(String)
InvalidXmlName(String)
} derive(Eq, Debug)pub(all) struct EvtxFile {
data : Bytes
header : FileHeader
chunks : Array[ChunkHeader]
records : Array[EvtxRecord]
}pub(all) struct EvtxRecord {
number : UInt64
timestamp : UInt64
size : UInt
chunk_offset : Int
offset : Int
root : ParsedRoot
} derive(Debug)pub(all) struct FileHeader {
oldest_chunk : UInt64
current_chunk_number : UInt64
next_record_number : UInt64
header_size : UInt
minor_version : Int
major_version : Int
header_chunk_size : Int
chunk_count : Int
flags : UInt
checksum : UInt
checksum_ok : Bool
} derive(Debug)pub(all) struct FilterSpec {
event_id : UInt?
provider : String?
channel : String?
computer : String?
level : Int?
contains : String?
since : UInt64?
until : UInt64?
} derive(Debug)fn base64_encode(data : Bytes) -> Stringfn bytes_slice(data : Bytes, start : Int, end : Int) -> Bytesfn concat_bytes(left : Bytes, right : Bytes) -> Bytesfn crc32_two_slices(data : Bytes, a0 : Int, a1 : Int, b0 : Int, b1 : Int) -> Result[UInt, EvtxError]fn escape_xml_value(text : String) -> Stringfn filetime_to_unix(filetime : UInt64) -> Int64fn variant_type_name(type_code : Int) -> StringInstall
Download zipWindows EVTX and BINXML codec with CRC verification, XML rendering and an in-memory writer