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
61
62
63
64
65
66
67
68
69
#[derive(Debug)]
pub struct HideConfig<'a> {
pub payload_path: &'a str,
pub carrier_path: &'a str,
pub output_path: Option<&'a str>,
pub strategy: Option<&'a str>,
}
#[derive(Debug)]
pub struct RevealConfig<'a> {
pub carrier_path: &'a str,
pub output_path: Option<&'a str>,
pub strategy: Option<&'a str>,
}
mod text;
mod images;
mod videos;
pub fn run_hide (config: HideConfig) {
if config.payload_path.ends_with(".png") && config.carrier_path.ends_with(".png") {
println!("Hide using - Least Significant Bit PNG Steganography (lsb_png_steganography)");
if let Some(output_path) = config.output_path {
images::lsb_png_steganography::hide(config.payload_path, config.carrier_path, output_path);
} else {
images::lsb_png_steganography::hide(config.payload_path, config.carrier_path, "./steg_hide_output.png");
}
}
}
pub fn run_reveal (config: RevealConfig) {
if config.carrier_path.ends_with(".png") {
if let Some(output_path) = config.output_path {
images::lsb_png_steganography::reveal(config.carrier_path, output_path);
} else {
images::lsb_png_steganography::reveal(config.carrier_path, "./steg_reveal_output.png");
}
}
}
#[cfg(test)]
mod tests {
use super::{ HideConfig, RevealConfig };
#[test]
fn lsb_png_steganography_hide_does_not_panic() {
let config = HideConfig {
strategy: Some(""),
output_path: Some("images/output/lsb_png_steganography_hide_does_not_panic.png"),
payload_path: "./images/payload.png",
carrier_path: "./images/carrier.png",
};
super::run_hide(config);
}
#[test]
fn lsb_png_steganography_reveal_does_not_panic() {
let config = RevealConfig {
strategy: Some(""),
output_path: Some("images/output/lsb_png_steganography_reveal_does_not_panic.png"),
carrier_path: "./images/hidden.png",
};
super::run_reveal(config);
}
}