Command line utility for analysis domain names and reporting useful information
Project description
Domain Analysis Reporter
The Domain Analysis Reporter is a Python script designed to analyze a list of domains and generate detailed reports, including IP resolution, hostname resolution, and redirection URLs. The output is saved in both Markdown (.md) and CSV formats for easy sharing and analysis.
A corresponding CSV file
Features
- Validate domain names using regular expressions.
- Resolve domains to IP addresses.
- Resolve IP addresses to hostnames.
- Follow and capture HTTP redirects for domains.
- Store results in:
- Markdown (.md) for human-readable reports.
- CSV (.csv) for structured data analysis.
- Automatically detects and avoids re-processing previously analyzed domains by loading prior results from CSV.
Prerequisites
Ensure the following are installed on your system:
- Python 3.6+
- Required Python packages:
requestsboilerpy3- Currently unused
Usage
Command-Line Arguments
| Argument | Description | Required |
|---|---|---|
-f, --file |
Path to the input file containing domains to analyze. One domain per line. | Yes |
-o, --output |
Path to the output file (optional). Defaults to the input file name with _resolved suffix. |
No |
-t, --time |
Expiration time in days for previous results. Defaults to 30 day. Specifiy 0 to force new analysis. | No |
-v, --verbose |
Enable verbose mode to display detailed processing information in the console. | No |
Running the Script
Example 1: Basic Usage
python domain_analysis_reporter.py -f website_domains.txt
This processes the domains in website_domains.txt and generates:
website_domains_resolved.mdwebsite_domains_resolved.csv
Example 2: Specify Output File
domain-analysis-reporter -f website_domains.txt -o custom_output
This generates:
custom_output_resolved.mdcustom_output_resolved.csv
Example 3: Verbose Mode
domain-analysis-reporter -f website_domains.txt -v
This displays detailed processing information in the terminal.
Input File Format
The input file should contain one domain per line. Example:
example.com
google.com
invalid_domain
Output
Markdown Report (.md)
A table summarizing the analysis:
| Domain | IP Address | Hostname | Redirected URL |
|---|---|---|---|
| example.com | 93.184.216.34 | example-host.com | https://example.com |
CSV File (.csv)
A structured file containing the same data as the Markdown report.
How It Works
- File Validation:
- Ensures the input file exists and is non-empty.
- Domain Validation:
- Validates domains using a regex pattern.
- Previous Results:
- If a previous
.csvfile exists for the same input, avoids re-processing matching domains.
- If a previous
- Domain Analysis:
- Resolves the domain to an IP address.
- Resolves the IP address to a hostname (if available).
- Captures any redirect URL.
- Report Generation:
- Saves the results in both Markdown and CSV formats.
Error Handling
- Invalid Domains:
- Logs invalid domains in the output.
- Network Issues:
- Skips domains if unable to resolve or retrieve data within the timeout period.
Example Output
Console Output (Verbose Mode)
File: website_domains.txt
Output: website_domains_resolved
Verbose mode enabled!
2025-01-26-12:30:00
* [example.com](https://example.com) https://example.com IP [93.184.216.34] HOST [example-host.com]
Markdown Report
| Domain | IP Address | Hostname | Redirected URL | Timestamp |
|--------------|----------------|----------------------|------------------------|----------------------|
| example.com | 93.184.216.34 | example-host.com | https://example.com | 2025-01-26 22:48:26 |
Development Notes
- Default Input File: If no valid file is provided, the script uses
website_domains.txtas the default. - Dependencies: The script depends on Python libraries:
osresocketrequestsargparsecsvboilerpy3
License
This project is licensed under the Creative Commons License. See the CC License file for details.
Contributions
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open a pull request or file an issue in the repository.
Contact
For questions or support, contact:
- Author: Ben Thomas
- Email: ben@smallercircle.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file domain_analysis_reporter-0.2.0.tar.gz.
File metadata
- Download URL: domain_analysis_reporter-0.2.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f73353e2199bcbd2656ad5cf4e372afd8b1081ed1433405b57bbf6f2df612d4
|
|
| MD5 |
f74fa0f3f46cb82aebf074b8b441a960
|
|
| BLAKE2b-256 |
bef11bca1ff1f9ae7c193888d4fbd497b570a2da1bfcfcd8df55468b8639077e
|
File details
Details for the file domain_analysis_reporter-0.2.0-py3-none-any.whl.
File metadata
- Download URL: domain_analysis_reporter-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce4c882589a99965c9eea92e10d52a2142c1559e1282e84bd0e85c299116eb66
|
|
| MD5 |
b43d95d1205f3ef3a6b264228dbf2169
|
|
| BLAKE2b-256 |
afb55bcc809de23b5006b7467c34e4b0c062b188b7374b23fecd07b7a2723d19
|