Here's a structured and detailed prompt for an LLM to generate a comprehensive domain reconnaissance bash script:
Task: Create a comprehensive bash script for initial domain reconnaissance that performs various scans and information gathering operations.
Script Requirements:
-
Input Handling:
- Accept a domain name as the first command-line argument
- Validate that a domain was provided
- Display usage instructions if no domain is given
-
Output Organization:
- Create a timestamped directory structure:
scans/[domain]_[YYYY-MM-DD_HH-MM-SS]/
- Create subdirectories for different scan types (dns, ssl, web, ports, etc.)
- Save each tool's output to a separate, descriptively named file
-
Scanning Operations to Include:
DNS Reconnaissance:
- Perform DNS lookups (A, AAAA, MX, TXT, NS records)
- Attempt zone transfers
- Subdomain enumeration
- Tools: dig, host, dnsrecon, or similar
Port Scanning:
- TCP port scan (top 1000 ports minimum)
- Service version detection
- OS fingerprinting
- Tools: nmap with appropriate flags
SSL/TLS Analysis:
- Certificate information extraction
- TLS version enumeration
- Cipher suite analysis
- Certificate chain validation
- Tools: sslscan, testssl, or openssl
Web Application Discovery:
- HTTP/HTTPS service detection
- Technology stack identification
- Common directories and files
- HTTP headers analysis
- Tools: whatweb, nikto, gobuster/dirb
Additional Information Gathering:
- WHOIS lookup
- Search for associated IP ranges
- Check for WAF presence
-
Script Features:
- Progress indicators for long-running scans
- Error handling for missing tools
- Check for tool availability before running
- Option to run in verbose or quiet mode
- Generate a summary report of findings
- Color-coded output for better readability
-
Performance Considerations:
- Implement reasonable delays between requests
- Allow for parallel execution where appropriate
- Include options for scan intensity (light/normal/aggressive)
-
Output Format:
- Each tool output in its raw format in separate files
- Create a unified summary report in markdown format
- Include timestamps for each scan
- Log any errors or issues encountered
Example Usage:
./domain-recon.sh example.com
./domain-recon.sh example.com --intensity light
./domain-recon.sh example.com --verbose
Additional Constraints:
- Make the script POSIX-compliant where possible
- Include comments explaining each section
- Add a function to check and install missing dependencies (with user permission)
- Ensure the script handles both domains and subdomains properly
- Include proper exit codes
- Add option to specify custom output directory
Expected Output Structure:
scans/
└── example.com_2024-01-15_14-30-45/
├── dns/
│ ├── dig_records.txt
│ ├── subdomains.txt
│ └── zone_transfer.txt
├── ports/
│ ├── nmap_tcp_scan.txt
│ └── service_versions.txt
├── ssl/
│ ├── certificate_info.txt
│ ├── tls_versions.txt
│ └── cipher_suites.txt
├── web/
│ ├── technology_stack.txt
│ ├── directories.txt
│ └── headers.txt
├── misc/
│ ├── whois.txt
│ └── waf_detection.txt
├── summary_report.md
└── scan_log.txt
Please create a well-documented, modular bash script that fulfills all these requirements and follows security best practices for reconnaissance tools.
This prompt provides clear structure and requirements while allowing flexibility for the LLM to implement the specific details. It covers all the major aspects of domain reconnaissance while emphasizing organization and proper output handling.