recon-cli 0.92.2

Versatile network reconnaissance CLI: HTTP/TLS/DNS, multi-protocol probes, and a Rhai script engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! `whois(host)` script binding. Auto-discovers the authoritative WHOIS
//! server via IANA then follows a registrar-WHOIS referral if present,
//! matching the CLI's --whois behaviour. Returns `#{ host, server, body }`.

use crate::script::convert::anyhow_to_rhai;
use crate::whois as core;
use rhai::{Engine, EvalAltResult, Map};

pub fn register(engine: &mut Engine) {
    engine.register_fn("whois", |host: &str| -> Result<Map, Box<EvalAltResult>> {
        let r = core::probe(host).map_err(anyhow_to_rhai)?;
        let mut m = Map::new();
        m.insert("host".into(), r.host.into());
        m.insert("server".into(), r.server.into());
        m.insert("body".into(), r.body.into());
        Ok(m)
    });
}