Skip to content

aphexlog/pentesting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Penetration Testing Reconnaissance Scripts

A collection of bash scripts for gathering intelligence during penetration testing engagements.

Scripts

1. domain_recon.sh - Domain Reconnaissance Tool

Comprehensive domain intelligence gathering script that collects DNS, WHOIS, SSL, and infrastructure information.

Usage:

./domain_recon.sh example.com

Features:

  • WHOIS information lookup
  • Complete DNS record enumeration (A, AAAA, MX, NS, TXT)
  • Nameserver identification
  • IP address resolution and reverse DNS
  • Geolocation data
  • HTTP/HTTPS header analysis
  • SSL/TLS certificate information
  • Basic subdomain enumeration
  • Technology stack detection
  • ASN information
  • Traceroute analysis
  • robots.txt and security.txt discovery

Output: Creates a timestamped directory recon_<domain>_<timestamp>/ containing:

  • Individual analysis files for each check
  • SUMMARY.txt - Consolidated report

2. hosting_recon.sh - Hosting Provider Identification Tool

Advanced hosting provider reconnaissance script that identifies cloud platforms and hosting services for penetration testing.

Usage:

./hosting_recon.sh example.com

Features:

Cloud Provider Detection:

  • Amazon Web Services (AWS) - EC2, CloudFront, ELB, S3, with region identification
  • Google Cloud Platform (GCP) - Compute, Storage, CDN
  • Microsoft Azure - Web Apps, Cloud Services, Blob Storage
  • Oracle Cloud Infrastructure (OCI)
  • IBM Cloud / SoftLayer
  • Alibaba Cloud / Aliyun

CDN/Edge Providers:

  • Cloudflare (CDN/DDoS Protection)
  • Akamai (CDN/Edge)
  • Fastly (CDN)

VPS/Hosting Providers:

  • DigitalOcean
  • Linode
  • Vultr
  • OVH
  • Hetzner

Website Builders/Platforms:

  • Squarespace
  • WordPress.com (Automattic)
  • Wix
  • Shopify
  • GoDaddy
  • Bluehost
  • HostGator
  • DreamHost
  • Netlify
  • Vercel
  • Heroku
  • GitHub Pages
  • Namecheap

Analysis Performed:

  1. IP Resolution - Resolves all IPv4/IPv6 addresses
  2. CNAME Analysis - Detects hosting patterns in DNS aliases
  3. WHOIS Lookup - Organization, network name, CIDR blocks, ASN
  4. Geolocation - Country, region, city, ISP information
  5. HTTP Header Analysis - Server signatures, CDN indicators
  6. SSL Certificate - Issuer, SANs for related domains
  7. DNS TXT Records - Hosting verification records
  8. Network Path - Traceroute to identify infrastructure
  9. Port Scanning - Common services (80, 443, 22, 3389, etc.)
  10. AWS-Specific Checks - S3 buckets, CloudFront, ELB
  11. Cloud DNS Patterns - Provider-specific DNS configurations

Output: Creates a timestamped directory hosting_recon_<domain>_<timestamp>/ containing:

  • hosting_analysis.txt - Complete analysis with summary
  • whois_<ip>.txt - WHOIS data for each IP
  • geo_<ip>.json - Geolocation data for each IP
  • cdn_headers.txt - HTTP headers with CDN indicators
  • ip_addresses.txt - List of resolved IPs
  • cname.txt - CNAME records

Penetration Testing Notes:

The script provides specific guidance based on detected providers:

  • CDN Detection → Origin server discovery techniques
  • AWS Detection → S3 bucket misconfigurations, metadata service access
  • Azure Detection → Blob storage misconfigurations
  • GCP Detection → Storage bucket permissions
  • Website Builders → Focus on application-level vulnerabilities

Requirements

Both scripts require the following tools to be installed:

  • bash (version 4.0+)
  • dig (DNS lookup)
  • whois
  • curl
  • openssl
  • host
  • traceroute
  • python3 (for JSON parsing)

Installation on macOS:

brew install bind whois curl openssl

Installation on Debian/Ubuntu:

sudo apt-get install dnsutils whois curl openssl traceroute

Installation on RedHat/CentOS:

sudo yum install bind-utils whois curl openssl traceroute

Example Usage

Basic Domain Recon:

./domain_recon.sh example.com

Hosting Provider Identification:

./hosting_recon.sh example.com

Combined Reconnaissance:

./domain_recon.sh example.com && ./hosting_recon.sh example.com

Security & Legal Notice

⚠️ IMPORTANT: These tools are designed for authorized penetration testing and security research only.

  • Only use these tools on domains/systems you own or have explicit written permission to test
  • Unauthorized scanning may be illegal in your jurisdiction
  • Always comply with applicable laws and regulations
  • Respect rate limits and don't cause service disruption
  • Some techniques may trigger security alerts

The authors are not responsible for misuse of these tools.


Tips for Penetration Testers

  1. Always run both scripts - They provide complementary information
  2. Review WHOIS files - Look for network ranges to expand scope
  3. Check for CDNs - May need to bypass to find origin servers
  4. Examine SSL certificates - SANs often reveal related infrastructure
  5. Analyze HTTP headers - Technology stack hints for vulnerability research
  6. Geolocation matters - Consider data residency and jurisdiction
  7. Save all output - Include in your penetration testing report

Cloud-Specific Testing Tips:

AWS:

  • Check for public S3 buckets using bucket name permutations
  • Test for SSRF to metadata service (169.254.169.254)
  • Look for exposed Lambda functions
  • Check IAM misconfigurations

Azure:

  • Test blob storage permissions
  • Look for exposed storage accounts
  • Check for function app misconfigurations

GCP:

  • Test storage bucket ACLs
  • Look for exposed Cloud Functions
  • Check metadata service access

CDNs:

  • Use origin discovery techniques
  • Check for cache poisoning
  • Test for header injection
  • Look for misconfigurations allowing direct origin access

Output Examples

Domain Recon Output:

recon_example.com_20250118_120000/
├── SUMMARY.txt              # Main report
├── whois.txt               # WHOIS data
├── dns_*.txt               # DNS records
├── ssl_cert.txt            # SSL certificate
├── technology_stack.txt    # Detected technologies
└── ...

Hosting Recon Output:

hosting_recon_example.com_20250118_120000/
├── hosting_analysis.txt    # Complete analysis
├── whois_192.0.2.1.txt    # Per-IP WHOIS
├── geo_192.0.2.1.json     # Geolocation
└── ...

Contributing

Feel free to submit issues or pull requests to improve these scripts.

License

These scripts are provided as-is for educational and authorized security testing purposes.


Changelog

v1.1.0 (2025-01-18)

  • Performance Improvements: Significant speed improvements for ASN/WHOIS lookups
    • Eliminated duplicate WHOIS lookups (50% reduction in calls)
    • Added parallel WHOIS fetching for multiple IPs (up to 85% faster)
    • Added 10-second timeouts to prevent hanging on slow/unresponsive servers
    • Implemented WHOIS result caching for instant repeated queries
    • See PERFORMANCE_IMPROVEMENTS.md for details

v1.0.0 (2025-10-18)

  • Initial release of domain_recon.sh
  • Initial release of hosting_recon.sh
  • Support for major cloud providers (AWS, GCP, Azure)
  • CDN detection (Cloudflare, Akamai, Fastly)
  • Website builder detection (Squarespace, Wix, Shopify, etc.)
  • Comprehensive geolocation and WHOIS analysis

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages