Skip to content

davidinfosec/whois-domain-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Domain WHOIS Information Script

Overview

WHOIS Domain Info is a script that fetches WHOIS data like Domain Name, Registrar, Expiration Date, and Days Till Expiry and organizes it in a spreadsheet. (Using the WhoisXMLAPI service) See it in action here!

WindowsTerminal_WqA9wJfLTW.mp4

Dependencies

  • Python (Version 3.6 or higher)
  • Requests library: Used for making HTTP requests.

Install: pip install requests

Getting Started

  1. Obtain API Credentials:
  • Sign up for a free or premium account on WhoisXMLAPI.
  • Generate API credentials (username and password) from your account dashboard.
  1. Set Up the Script:
  • Copy the script provided in this repository.
  1. Configure API Credentials:
  • Replace the your_username and your_password variables with your WhoisXMLAPI username and password.
  1. Input Domain Names:
  • Create a text file (in.txt) containing one domain name per line.
  1. Run the Script:
  • Execute the script using the following command:
    python whois.py
    

Script Details

get_domain_info(domain_name, username, password)

  • Parameters:
  • domain_name (str): The domain name for which information is to be retrieved.
  • username (str): Your WhoisXMLAPI username.
  • password (str): Your WhoisXMLAPI password.
  • Returns:
  • Tuple containing registrar name, expiration date (as a string), and days until expiration (as an integer).

export_all_to_csv(domain_info_list)

  • Parameters:
  • domain_info_list (list): List of domain information retrieved by the script.
  • Action:
  • Exports all domain information to a CSV file named output_info.csv.

process_domains_from_file(file_path, username, password)

  • Parameters:
  • file_path (str): Path to the text file containing domain names.
  • username (str): Your WhoisXMLAPI username.
  • password (str): Your WhoisXMLAPI password.
  • Action:
  • Fetches information for each domain from the input file and prints details to the console.
  • Calls export_all_to_csv to export all data to a CSV file.

Example Usage

# Example usage
in_file_path = 'in.txt'
your_username = 'your_username'
your_password = 'your_password'
process_domains_from_file(in_file_path, your_username, your_password)

Note

  • Ensure that your API account has sufficient credits to perform the desired number of queries.
  • For more information on WhoisXMLAPI and available options, refer to the official documentation.

Changelog - November 24, 2024

  1. Added Config File and Credential Storage:

    • Introduced config.ini file for storing API key.
    • Introduced creds.txt file for storing username and password.
    • Functions get_api_key() and get_credentials() manage the retrieval and storage of API key and credentials.
  2. Refactored API Request and Response Handling:

    • The API key is now included in the API request URL.
    • Improved handling of expiration date and days until expiration.
    • Added a new parameter, time_of_lookup, representing the time the domain information was retrieved.
  3. CSV Export Enhancements:

    • Updated export_all_to_csv() to append data to an existing file if it already contains data.
    • Modified the CSV header to include 'Time of Lookup'.
    • Timestamp is now included in the CSV filename for unique identification.
  4. Concurrency for Bulk Processing:

    • Introduced the ThreadPoolExecutor for concurrent processing of multiple domains in process_domains_from_file().
  5. Improved Input Handling in Main Loop:

    • Enhanced user input handling in the main loop (main()) to support bulk processing, individual domain lookup, and exit.
  6. Modularized Code:

    • Broke down the code into functions for better modularity and readability.
    • Introduced a process_single_domain() function to handle individual domain requests.
  7. Time of Lookup Update:

    • Introduced the time_of_lookup parameter in the domain information, indicating when the information was retrieved.
  8. Dynamic CSV Filename:

    • The CSV filename is now dynamically generated based on the input file name, with a timestamp for uniqueness.
    • If the input file contains 'bulk', it is reflected in the CSV filename for bulk processing.
  9. Improved File Path Handling:

    • Enhanced file path handling in process_domains_from_file() to check for file existence and prompt for a valid path.

Support and Contributions

If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request. Your contributions are highly appreciated.

Feel like this has been useful? Donate toward my latest projects. https://www.poof.io/tip/@davidinfosec

  1. Added Dan.com and Afternic.com Links to CSV Output:
    • Two new columns, "Dan.com Link" and "Afternic Link," have been added to the CSV file to store corresponding links generated using the domain name.

About

A Python Script that fetches WHOIS data like Domain Name, Registrar, Expiration Date, and Days Until Expiry and organizes it in a spreadsheet.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages