TZH-nh/moonwire/pcap does not have a README file

    PcapError

    pub(all) suberror PcapError {
    TruncatedGlobalHeader
    UnsupportedMagic(UInt)
    TruncatedRecordHeader(offset~ : Int)
    TruncatedRecordPayload(offset~ : Int)
    InvalidKeylogLine(line~ : Int, reason~ : String)
    } derive(Eq,
    Debug
    )

    CaptureAuditSummary

    pub(all) struct CaptureAuditSummary {
    total_udp_frames : Int
    wireguard_frames : Int
    initiations : Int
    responses : Int
    cookie_replies : Int
    transport_packets : Int
    decrypted_packets : Int
    records : Array[InspectedWireFrame]
    } derive(Eq,
    Debug
    )

    Summary of an inspected WireGuard PCAP capture.

    CaptureAuditSummary::format_report

    fn CaptureAuditSummary::format_report(self : CaptureAuditSummary, max_records? : Int) -> String

    InspectedWireFrame

    pub(all) struct InspectedWireFrame {
    frame_no : Int
    src : String
    dst : String
    packet_kind : String
    mac1_verified : Bool?
    decrypted_ok : Bool
    detail : String
    } derive(Eq,
    Debug
    )

    High-level inspection result for a single WireGuard frame in a PCAP capture.

    KeyLog

    pub struct KeyLog {
    static_private_keys : Array[Bytes]
    static_public_keys : Array[Bytes]
    ephemeral_private_keys : Array[Bytes]
    preshared_keys : Array[Bytes]
    direct_traffic_keys : Map[UInt, Bytes]
    handshake_stage_keys : Map[(String, UInt), (Bytes, Bytes)]
    } derive(Eq,
    Debug
    )

    Parsed WireGuard key material supporting both:
    1. Standard Wireshark wg.keylog_file (LOCAL_STATIC_PRIVATE_KEY = ..., LOCAL_EPHEMERAL_PRIVATE_KEY = ..., etc.)
    2. Kernel probe session keylogs (STAT/TIME/EMPT + 0x<receiver_idx> <base64_traffic_key>).

    KeyLog::empty

    fn KeyLog::empty() -> KeyLog

    UdpCaptureFrame

    pub(all) struct UdpCaptureFrame {
    frame_no : Int
    ts_sec : UInt
    ts_subsec : UInt
    src_ip :
    IpAddr

    dst_ip :
    IpAddr

    src_port : Int
    dst_port : Int
    udp_payload : Bytes
    } derive(Eq,
    Debug
    )

    Extracted UDP datagram from a Libpcap packet record.

    build_ipv4_udp_pcap

    fn build_ipv4_udp_pcap(datagrams : Array[(UInt, Int, UInt, Int, UInt, UInt, Bytes)]) -> Bytes

    Build a standards-compliant Little-Endian LINKTYPE_ETHERNET (.pcap) capture containing IPv4 UDP datagrams, directly readable by Wireshark, tshark, and parse_pcap_udp_frames.

    format_wireshark_keylog

    fn format_wireshark_keylog(local_static_private : BytesView, remote_static_public : BytesView, ephemeral_privates : Array[Bytes], preshared_key? : BytesView) -> String

    Format key material in standard Wireshark wg.keylog_file syntax.

    inspect_wireguard_pcap

    fn inspect_wireguard_pcap(pcap_bytes : BytesView, keylog? : KeyLog) -> CaptureAuditSummary raise PcapError

    Inspect all UDP frames in pcap_bytes, dissect WireGuard frames, validate mac1 when keys are available, derive session keys from keylog (if provided), and decrypt inner IPv4/IPv6 payloads.

    parse_keylog

    fn parse_keylog(text : StringView) -> KeyLog raise PcapError

    Parse a WireGuard keylog text (Wireshark KEY = BASE64 format or 0xINDEX BASE64 session trace format).

    parse_pcap_udp_frames

    fn parse_pcap_udp_frames(pcap_bytes : BytesView) -> Array[UdpCaptureFrame] raise PcapError

    Parse a binary Libpcap file and extract all IPv4/IPv6 UDP datagrams.

    Source Files