1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! # 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, Encoding};
//!
//! let config = FileConfig::new("/bin/ls").with_min_length(5);
//! let extracted_strings = strings(&config);
//!
//! // Extract utf16le strings
//! let config = FileConfig::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("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());
//! ```

mod encodings;
mod strings;
mod strings_extractor;

pub use encodings::{Encoding, EncodingNotFoundError};
pub use strings::{strings, BytesConfig, Config, FileConfig};

#[cfg(feature = "python_bindings")]
mod python_bindings;