Question: What s the Big Idea? Use Python to find out more about a domain name entered by the user. You ll take a domain name,

Whats the Big Idea? Use Python to find out more about a domain name entered by the user. Youll take a domain name, convert it into an IP address, and query an API to get information about the server that hosts that website. Create a New Project Create a new directory named domain_explorer inside your local root folder for this course. All files for this project should reside in this directory. Follow the steps provided in the workbook to establish a local Git repository. Create a Python File This project will be in a single Python file. Create a new file named index.py in your domain_explorer directory. Accept a Command Line Argument Using the argparse module, create a required command line argument: --domain (or -d) This will require the user to input a domain name, such as purdue.edu, when running your program. Create a Function to get the IP Address Write a function that accepts a domain name as an argument and uses the socket.gethostbyname() function to obtain the IP address of the domain. If the domain can be resolved, return the IP address. Otherwise, return None. Create a Function to Get the Details of the IP Address Write a function that accepts an IP address as an argument and uses the requests module get() function to query the Shodan API about that IP. If the API request can be successfully completed, return the results of the query as JSON. Otherwise, return None. Write the Logic of your Program in main() In your main() method, read the value of the domain passed in by the user. Then obtain the IP address for the domain. Finally, obtain the data about the domain from the Shodan API. Once you have the details of the domain, print the information about the CPEs and the hostnames to the screen. If your program encounters an error either in resolving the domain or obtaining information from the API, write a simple error message to the screen and end the program. Commit and Branch! Once you have tested your index.py script, do the following: 1. Add and commit your files using Git 2. Remember to add the standard Python .gitignore file! 3.(Optional) Push all your branches to GitHub.com with the command git push origin all Complete instructions can be found in the CIT 30900 workbook. Grading Process When I grade your submissions, I will do the following: python index.py -d purdue.edu python index.py -d blah The first command should bring back information about the CPEs on the Purdue website and the (long) list of hostnames associated with that domain. The second command should fail gracefully, as there is no domain named blah. You MUST ensure that these commands work prior to submitting your code! Projects submitted that do not run will be returned ungraded.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!