sanitation

Crates.iosanitation
lib.rssanitation
version
sourcesrc
created_at2023-10-27 00:39:20.124161+00
updated_at2025-03-21 04:41:42.833297+00
descriptiontool for developing memory-safe programs while detecting and capturing possibly malicious bytes.
homepagehttps://github.com/gabrielfalcao/sanitation
repository
max_upload_size
id1015428
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Gabriel Falcão (gabrielfalcao)

documentation

https://docs.rs/sanitation

README

sanitation

Tool for developing memory-safe programs while detecting and capturing possibly malicious bytes.

Basic Design

Structs within the sanitation crate provide a garbage() method which returns potentially malicious bytes or covert communication channels.

Putting it simply, this crate serves as an effective tool to convert streams of bytes into valid strings while providing ways to check whether seeming garbage bytes might actually characterize exploits or covert communication channels, empowering developers and programs, for instance, to kill unwanted connections, insecure connections or even poorly-secured connections.

cargo add sanitation

Example

use sanitation::{to_hex, Error, SString};

fn main() -> Result<(), Error<'static>> {
    let data = [
        0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e,
        0x20, 0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, 0x73, 0x20, 0x6f, 0x76, 0x65, 0x72,
        0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x64, 0x6f, 0x67, 0xf4, 0xf1,
        0xf2, 0xf3,
    ];
    let sstring = SString::new(&data);
    println!("UTF-8 Safe String:\t{}", sstring.unchecked_safe());
    println!("Non-valid UTF-8 bytes:\t{}", to_hex(&sstring.garbage()));
    Ok(())
}
Commit count: 0

cargo fmt