MCPcopy Create free account
hub / github.com/KingOfBugbounty/enumrust / process_domain_impl

Function process_domain_impl

src/main.rs:884–3120  ·  view source on GitHub ↗

Internal implementation of domain scanning

(domain: &str, args: &Args, base_path: PathBuf)

Source from the content-addressed store, hash-verified

882
883/// Internal implementation of domain scanning
884async fn process_domain_impl(domain: &str, args: &Args, base_path: PathBuf) -> Result<()> {
885 // Initialize metrics
886 let mut metrics = EnumRustMetrics::new_web_scan(domain.to_string());
887
888 // Create output directory
889 fs::create_dir_all(&base_path)
890 .context(format!("Failed to create output directory: {}", base_path.display()))?;
891
892 // Create files_ subdirectory for tool outputs
893 let files_dir = base_path.join("files_");
894 fs::create_dir_all(&files_dir)
895 .context(format!("Failed to create files directory: {}", files_dir.display()))?;
896
897 // Initialize progress tracker
898 let scan_id = uuid::Uuid::new_v4().to_string();
899 let progress = ProgressTracker::new(scan_id.clone(), domain.to_string(), base_path.clone());
900 progress.scan_started();
901
902 println!("{}", format!("[*] Output directory: {}/", base_path.display()).cyan());
903 println!("{}", format!("[*] Scan ID: {}", scan_id).cyan());
904
905 // Initialize HTTP client (async)
906 let client = Client::builder()
907 .timeout(Duration::from_secs(30))
908 .danger_accept_invalid_certs(true)
909 .build()?;
910
911 // Initialize Ollama AI client (auto-installs, auto-starts, auto-pulls model)
912 let ollama = ollama::OllamaClient::new().await;
913
914 // ═══════════════════════════════════════════════════════════════════════════
915 // STAGE 1: WHOIS LOOKUP (Optional, 0-5%)
916 // ═══════════════════════════════════════════════════════════════════════════
917 if args.whois {
918 println!("\n{}", "═══════════════════════════════════════════════════════════════".yellow().bold());
919 println!("{}", " STAGE 1: WHOIS LOOKUP (0-5%)".yellow().bold());
920 println!("{}", "═══════════════════════════════════════════════════════════════".yellow().bold());
921
922 progress.add_event(
923 EventType::ToolStarted {
924 tool_name: "WHOIS".to_string(),
925 },
926 "Starting WHOIS lookup...".to_string(),
927 0.0,
928 None,
929 );
930
931 let whois_file = base_path.join("whois_ips.txt");
932 println!("{}", format!("[*] Running WHOIS lookup for domain: {}", domain).cyan());
933
934 let whois_status = Command::new("sh")
935 .arg("-c")
936 .arg(format!("whois {} > {}", domain, whois_file.display()))
937 .status()
938 .await?;
939
940 if whois_status.success() {
941 progress.tool_completed("WHOIS", 5.0);

Callers 2

process_domainFunction · 0.85

Calls 15

write_subdomains_sortedFunction · 0.85
filter_ips_for_domainFunction · 0.85
save_filtered_ipsFunction · 0.85
get_optimal_threadsFunction · 0.85
get_top_1000_portsFunction · 0.85
scan_ips_and_fuzzFunction · 0.85
validate_domains_batchFunction · 0.85

Tested by

no test coverage detected