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
Install:
pip install requests
- Obtain API Credentials:
- Sign up for a free or premium account on WhoisXMLAPI.
- Generate API credentials (username and password) from your account dashboard.
- Set Up the Script:
- Copy the script provided in this repository.
- Configure API Credentials:
- Replace the
your_username
andyour_password
variables with your WhoisXMLAPI username and password.
- Input Domain Names:
- Create a text file (
in.txt
) containing one domain name per line.
- Run the Script:
- Execute the script using the following command:
python whois.py
- 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).
- 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
.
- 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
in_file_path = 'in.txt'
your_username = 'your_username'
your_password = 'your_password'
process_domains_from_file(in_file_path, your_username, your_password)
- 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.
-
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()
andget_credentials()
manage the retrieval and storage of API key and credentials.
- Introduced
-
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.
-
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.
- Updated
-
Concurrency for Bulk Processing:
- Introduced the
ThreadPoolExecutor
for concurrent processing of multiple domains inprocess_domains_from_file()
.
- Introduced the
-
Improved Input Handling in Main Loop:
- Enhanced user input handling in the main loop (
main()
) to support bulk processing, individual domain lookup, and exit.
- Enhanced user input handling in the main loop (
-
Modularized Code:
- Broke down the code into functions for better modularity and readability.
- Introduced a
process_single_domain()
function to handle individual domain requests.
-
Time of Lookup Update:
- Introduced the
time_of_lookup
parameter in the domain information, indicating when the information was retrieved.
- Introduced the
-
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.
-
Improved File Path Handling:
- Enhanced file path handling in
process_domains_from_file()
to check for file existence and prompt for a valid path.
- Enhanced file path handling in
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
- 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.