Skip to main content

encodex/
lib.rs

1#![warn(missing_docs)]
2#![warn(clippy::pedantic)]
3#![forbid(unsafe_code)]
4//! Universal content-to-bytes encoding for vyre-compatible pattern sets.
5//!
6//! `encodex` converts higher-level content representations into byte patterns
7//! suitable for literal matching. Supported conversions are intentionally
8//! explicit so callers can see which inputs are implemented and which are not.
9//!
10//! The [`semantic`] module extends this to ML embedding vectors, producing
11//! hierarchical byte hashes where prefix matching yields semantic category
12//! search through the warpscan pipeline.
13
14#![allow(unknown_lints)]
15#![deny(unsafe_code)]
16#![cfg_attr(
17    not(test),
18    deny(
19        clippy::unwrap_used,
20        clippy::expect_used,
21        clippy::todo,
22        clippy::unimplemented,
23        clippy::panic
24    )
25)]
26#![allow(clippy::doc_markdown, clippy::module_name_repetitions)]
27#![allow(
28    clippy::cast_possible_truncation,
29    clippy::cast_sign_loss,
30    clippy::collapsible_if,
31    clippy::if_not_else,
32    clippy::manual_strip,
33    clippy::match_same_arms,
34    clippy::missing_errors_doc,
35    clippy::needless_continue,
36    clippy::needless_pass_by_value,
37    clippy::redundant_closure_for_method_calls,
38    clippy::single_char_pattern,
39    clippy::sliced_string_as_bytes,
40    clippy::too_many_lines,
41    clippy::unnecessary_wraps,
42    clippy::wrong_self_convention
43)]
44#![cfg_attr(
45    test,
46    allow(
47        clippy::manual_string_new,
48        clippy::needless_raw_string_hashes,
49        clippy::unwrap_used
50    )
51)]
52
53/// Base64 decoding support.
54pub mod base64;
55pub(crate) mod bio;
56pub(crate) mod code;
57/// Structured content types.
58pub mod content_type;
59pub(crate) mod copyright;
60pub(crate) mod cve;
61/// Encoding detection for raw byte streams.
62pub mod detect;
63/// Error definitions for encodex.
64pub mod error;
65/// File-based pattern loading and IWF hash decoding.
66pub mod file;
67/// Hex decoding and YARA hex parsing support.
68pub mod hex;
69/// IOC variant expansion for URL and domain indicators.
70pub mod ioc_expand;
71/// Semantic IOC hashing.
72pub mod ioc_hash;
73/// JSON string literal extraction.
74pub mod json;
75/// Perceptual hash handling.
76pub mod perceptual;
77/// Raw bytes pass-through encoding.
78pub mod raw;
79/// Regex pattern string handling.
80pub mod regex;
81/// ML embedding semantic hash capabilities.
82pub mod semantic;
83pub(crate) mod suricata;
84/// Compile-time pattern variant expansion (base64, hex, URL-encode, unicode, reverse).
85pub mod variants;
86#[cfg(feature = "yara")]
87/// YAML string value and matchers extraction.
88pub mod yaml;
89/// YARA pattern literals parsing
90pub mod yara_literals;
91
92pub use content_type::{ContentType, Language};
93pub use error::{Error, Result};
94pub use file::{decode_iwf_hashes, load_pattern_file};
95
96/// Compile-checks the README quick-start example as a doctest.
97#[cfg(doctest)]
98#[doc = include_str!("../README.md")]
99struct ReadmeExamples;