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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! # BinSleuth
//!
//! Binary inspection and security analysis toolkit for ELF and PE binaries.
//!
//! BinSleuth detects:
//! - Security hardening flags (NX, PIE, RELRO, Stack Canary, FORTIFY_SOURCE, RPATH/RUNPATH, debug-symbol stripping)
//! - Shannon entropy per section (detects packing/encryption)
//! - Dangerous symbol usage (`system()`, `execve()`, `mprotect()`, …) with category (Exec / Net / Mem)
//! - Per-section virtual address, file offset, and read/write/execute permissions
//!
//! ## Quick start (library)
//!
//! ```no_run
//! let data = std::fs::read("path/to/binary").unwrap();
//!
//! // Single call — returns everything including security score
//! let report = binsleuth::analyze(&data).unwrap();
//! println!("Score: {}/100", report.security_score);
//! println!("{}", report.to_json_pretty());
//! ```
//!
//! ## Lower-level API
//!
//! ```no_run
//! use binsleuth::analyzer::hardening::HardeningInfo;
//! use binsleuth::analyzer::entropy::SectionEntropy;
//!
//! let data = std::fs::read("path/to/binary").unwrap();
//!
//! let hardening = HardeningInfo::analyze(&data).unwrap();
//! println!("PIE: {:?}", hardening.pie);
//!
//! let sections = SectionEntropy::analyze(&data).unwrap();
//! for sec in §ions {
//! println!("{}: va={:#x} entropy={:.4} r={} w={} x={}",
//! sec.name, sec.virtual_address, sec.entropy,
//! sec.permissions.read, sec.permissions.write, sec.permissions.execute);
//! }
//! ```
//!
//! ## CLI
//!
//! ```text
//! cargo install binsleuth
//! binsleuth ./target/debug/binsleuth
//! binsleuth --json ./mybinary
//! binsleuth --strict --verbose ./mybinary
//! ```
pub use AnalysisReport;
/// Convenience wrapper: analyze raw binary bytes and return a complete [`AnalysisReport`].
///
/// Equivalent to [`AnalysisReport::analyze`].