Skip to main content

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.


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:
    • requests
    • boilerpy3 - 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
-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.md
  • website_domains_resolved.csv

Example 2: Specify Output File

domain-analysis-reporter -f website_domains.txt -o custom_output

This generates:

  • custom_output_resolved.md
  • custom_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

  1. File Validation:
    • Ensures the input file exists and is non-empty.
  2. Domain Validation:
    • Validates domains using a regex pattern.
  3. Previous Results:
    • If a previous .csv file exists for the same input, avoids re-processing matching domains.
  4. Domain Analysis:
    • Resolves the domain to an IP address.
    • Resolves the IP address to a hostname (if available).
    • Captures any redirect URL.
  5. 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         |
|--------------|----------------|----------------------|------------------------|
| example.com  | 93.184.216.34  | example-host.com     | https://example.com    |

Development Notes

  • Default Input File: If no valid file is provided, the script uses website_domains.txt as the default.
  • Dependencies: The script depends on Python libraries:
    • os
    • re
    • socket
    • requests
    • argparse
    • csv
    • boilerpy3

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:

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

domain_analysis_reporter-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

domain_analysis_reporter-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file domain_analysis_reporter-0.1.0.tar.gz.

File metadata

  • Download URL: domain_analysis_reporter-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.15

File hashes

Hashes for domain_analysis_reporter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e1ace3da6e89cdd0e40ab9c867772b46336750663d83aef710b25a35fefc79aa
MD5 6e750d6a47c7f8410eef93f696c18cb8
BLAKE2b-256 070ffb2b90d8ba7572ad6cf039c9224e3c9f8c55e3e393345148208b0868dcdd

See more details on using hashes here.

File details

Details for the file domain_analysis_reporter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for domain_analysis_reporter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d5280dfb47e69b92ab4aa65c4cc4cc7383d93ee668b7e2acb83b19a909d710f
MD5 fb2ef122bb51c26f5b26444ed0133a54
BLAKE2b-256 049061e25159135d421ceb6be4a3ab4da0e3dffc204a552feec236bfb9992911

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page