Skip to content

shaifsec/Vhost-Grouper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Vhost-Grouper

A Python tool to group hostnames by their resolved IP addresses.
It reads a list of hostnames, resolves their A/AAAA records, and outputs groupings of hostnames sharing the same IP.

Note:
The resolved IPs represent the addresses returned by DNS at the time of the scan.
Actual serving IPs may vary due to CDNs, load balancers, or custom domain routing, and can change between scans.

Features

  • Reads hostnames from a text file (one per line).
  • Resolves both IPv4 and IPv6 addresses.
  • Groups hostnames by IP address.
  • Outputs results in human-readable and JSON formats.
  • Highlights IPs hosting multiple hostnames (potential vhost targets).
  • Logs DNS resolution errors.
  • Fast: uses multithreading for concurrent lookups.
  • No external dependencies (pure stdlib).

Usage

python3 vhost_grouper.py -i subdomains.txt
python3 vhost_grouper.py -i subdomains.txt -o results -t 50 --only-duplicates

Arguments

  • -i, --input (required): Input file containing hostnames (one per line).
  • -o, --outdir: Output directory (default: vhost_results).
  • -t, --threads: Number of concurrent resolver threads (default: 20).
  • --timeout: Resolver timeout in seconds (default: 5.0).
  • --only-duplicates: Print only IPs that host multiple vhosts.
  • --grouped-file: Custom output file for grouped results.

Output Files

  • grouped_by_ip.json: Full JSON export of IP-to-host mappings and errors.
  • grouped_by_ip.txt: Human-friendly grouping of hostnames by IP.
  • duplicates_by_ip.txt: Only IPs with more than one hostname.
  • resolution_errors.txt: List of hostnames that failed to resolve.

Example

Given subdomains.txt:

example.com
www.example.com
test.example.com

Run:

python3 vhost_grouper.py -i subdomains.txt

Requirements

  • Python 3.7 or newer.
  • No external packages required.

Acknowledgments

  • Inspired by the need to efficiently manage and resolve large lists

About

Lightweight Python tool to group virtual hosts by IP from subdomains.txt; fast, threaded DNS resolver with JSON and text outputs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages