Function minos_codex::create_scanner

source ยท
pub fn create_scanner(config_dir: &str) -> Result<Scanner, MinosCodexError>
Examples found in repository?
examples/basic_usage.rs (line 11)
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
fn run() -> Result<(), MinosCodexError> {
    let mut scanner = create_scanner("detections")?;

    let input = "My email is example@email.com and my AWS access key is AKIAIOSFODNN7EXAMPLE";

    let found_secrets = scanner.scan(input)?;

    if found_secrets.is_empty() {
        println!("No secrets found.");
    } else {
        println!("Found secrets:");
        for secret in found_secrets {
            println!("  Type: {}", secret.secret_type);
            println!("  Value: {}", secret.value);
            println!("  Position: {}:{}", secret.start, secret.end);
            println!();
        }
    }

    Ok(())
}