Monday, April 21, 2025

Get Fully Qualified Domain Name - Python FQDN

import os, socket

os.system('cls')
print('FQDN Extractor: v 0.1')
print('-' * 79)

target = input('Enter Domain to Check: ')
print('FQDN: ', socket.getfqdn(target))

This code is a Python script that takes a user input domain and returns the fully qualified domain name (FQDN) of the target domain.

Let's go through the code line by line:

  1. import os, socket - This line imports the os and socket modules for use in the script.

  2. os.system('cls') - This line clears the console screen, so that the user input prompt and output are more visible.

  3. print('FQDN Extractor: v 0.1') - This line prints a title for the script.

  4. print('-' * 79) - This line prints a separator to visually separate the title from the rest of the output.

  5. target = input('Enter Domain to Check: ') - This line prompts the user to enter a domain to check and assigns the input to the variable target.

  6. print('FQDN: ', socket.getfqdn(target)) - This line gets the FQDN of the target domain using the socket.getfqdn() function and prints it to the console.

This code is fairly straightforward and serves its purpose.

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...