Crate rust_strings
source ·Expand description
§Rust Strings
rust-strings
is a library to extract ascii strings from binary data.
It is similar to the command strings
.
§Examples:
use rust_strings::{FileConfig, BytesConfig, strings, dump_strings, Encoding};
use std::path::{Path, PathBuf};
let config = FileConfig::new(Path::new("/bin/ls")).with_min_length(5);
let extracted_strings = strings(&config);
// Extract utf16le strings
let config = FileConfig::new(Path::new("C:\\Windows\\notepad.exe"))
.with_min_length(15)
.with_encoding(Encoding::UTF16LE);
let extracted_strings = strings(&config);
// Extract ascii and utf16le strings
let config = FileConfig::new(Path::new("C:\\Windows\\notepad.exe"))
.with_min_length(15)
.with_encoding(Encoding::ASCII)
.with_encoding(Encoding::UTF16LE);
let extracted_strings = strings(&config);
let config = BytesConfig::new(b"test\x00".to_vec());
let extracted_strings = strings(&config);
assert_eq!(vec![(String::from("test"), 0)], extracted_strings.unwrap());
// Dump strings into `strings.json` file.
let config = BytesConfig::new(b"test\x00".to_vec());
dump_strings(&config, PathBuf::from("strings.json"));
Structs§
Enums§
Traits§
Functions§
- Dump strings from binary data to json file.
- Extract strings from binary data.