use std::net::IpAddr;
use std::sync::Arc;
use std::time::Duration;
use url::Url;
use crate::discovery::cert::PeerCert;
use crate::impersonate::ImpersonateClient;
#[derive(Debug, Clone)]
pub enum Finding {
Url(Url),
Subdomain {
host: String,
source: SubdomainSource,
},
DnsRecord {
host: String,
kind: DnsKind,
value: String,
},
PeerCert(PeerCert),
OpenPort {
ip: IpAddr,
port: u16,
banner: Option<String>,
service: Option<String>,
},
Whois {
registrar: Option<String>,
registrant_org: Option<String>,
created_at: Option<String>,
expires_at: Option<String>,
nameservers: Vec<String>,
},
SecurityTxt { key: String, value: String },
Fact {
key: String,
value: serde_json::Value,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SubdomainSource {
Dns,
Cert,
CrtSh,
Wayback,
HtmlBody,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DnsKind {
A,
Aaaa,
Cname,
Mx,
Txt,
Ns,
Caa,
}
#[derive(Clone)]
pub struct DiscoveryContext {
pub target: String,
pub host: Option<String>,
pub http: Arc<ImpersonateClient>,
pub budget: Duration,
pub features: DiscoveryFeatures,
}
impl DiscoveryContext {
pub fn effective_host(&self) -> &str {
self.host.as_deref().unwrap_or(&self.target)
}
}
#[derive(Debug, Clone, Copy, Default)]
pub struct DiscoveryFeatures {
pub crtsh: bool,
pub dns: bool,
pub wayback: bool,
pub peer_cert: bool,
pub network_probe: bool,
pub well_known: bool,
pub robots_paths: bool,
pub pwa: bool,
pub security_txt: bool,
pub favicon: bool,
pub whois: bool,
}