Write a python script called hoster-toaster.py that is used to gather information about a machine's local hostname resolution file. The details of how it works are below: It requires one argument on...

1 answer below »
Write a python script called hoster-toaster.py that is used to gather information about a machine's local hostname resolution file. The details of how it works are below: It requires one argument on the command line: the absolute path to a file it will write output to. If the script is run with no options it will update create a summary of the data currently in /etc/hosts. For each ip address other than the IPv4 and IPv6 localhost addresses, it will count how many hostnames are associated with that address and write the ip address, and the number of associated hostnames to the file the user provided, overwriting any data that was already there. If the script is run with the option -l it will act similar to the no-option run described above, but instead of overwriting the file, it will add the new data to the end of the existing file. In oder to separate new data from old, it will write a blank line, then the current date and time to the file before writing the new data. If it is run with the option -c it will search the contents of /etc/hosts for the hostname provided as an argument to the -c option and write a message to the provided file indicating what ip address is associated with that hostname (in addition to any other data the script is writing). If the hostname is not found in /etc/hosts, a message stating it was not found will be written instead. Note: Completing this step is optional. A submission that does not include it can be counted as complete, but will receive reduced marks.
Answered 2 days AfterAug 13, 2022

Answer To: Write a python script called hoster-toaster.py that is used to gather information about a machine's...

Ruchi answered on Aug 15 2022
77 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here