oletools_rs 0.1.0

Rust port of oletools — analysis tools for Microsoft Office files (VBA macros, DDE, OLE objects, RTF exploits)
Documentation
/// Unified error types for oletools_rs.
///
/// All public functions return `Result<T>` which uses this `Error` enum.

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("I/O error: {0}")]
    Io(#[from] std::io::Error),

    #[error("Invalid OLE file: {0}")]
    InvalidOle(String),

    #[error("Invalid OOXML file: {0}")]
    InvalidOoxml(String),

    #[error("VBA decompression failed: {0}")]
    VbaDecompression(String),

    #[error("VBA parsing failed: {0}")]
    VbaParsing(String),

    #[error("XML parsing failed: {0}")]
    XmlParsing(String),

    #[error("ZIP error: {0}")]
    Zip(#[from] zip::result::ZipError),

    #[error("Unsupported encryption")]
    UnsupportedEncryption,

    #[error("Wrong password")]
    WrongPassword,

    #[error("Unsupported file format: {0}")]
    UnsupportedFormat(String),

    #[error("Encoding error: {0}")]
    Encoding(String),

    #[error("RTF parsing failed: {0}")]
    RtfParsing(String),

    #[error("OLE object parsing failed: {0}")]
    OleObjectParsing(String),

    #[error("DDE detection failed: {0}")]
    DdeParsing(String),
}

/// Convenience alias used throughout the crate.
pub type Result<T> = std::result::Result<T, Error>;