Write a script to help confirm that an IPv4 address is a private address. If the IP address is a private IPv4, the following message is printed to the screen:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

For every task below:

  1. write your code which performs the task and run it. Display the code and the result on your screen; 
  2. use a snipping (Windows snipping tool) or "print screen" tool to take one or two screenshots that contain the code and the result, and paste the illustration or picture into the document you created in 1. Your goal is to allow me to assess your code and its result.
  1. Add a comment for every line of code.

 

 Objectives:

  • Review if condition and loops
  • Create a project
  • Create custom modules and import them into a project
  • Create a virtual environment and import external packages

 

Task 1:

Write a script to help confirm that an IPv4 address is a private address. If the IP address is a private IPv4, the following message is printed to the screen: 

  • "addr is a private IPv4 address!" where "addr" is the IPv4 address entered.

However, is the input not a private IPv4 address, the printed messages will be: 

  • "Sorry, this is not a private IP address; Try again or enter -1 to quit." In this case, the user is allowed to try again for a total of 3 times; then the program will stop if the user keeps entering non-private IP addresses.

 

The script (module) must have two functions and the "if "__name__ == "__main__:" statement.

One function will accept the address and verify the validity, and the other will do the printing; name the functions and the module as you want.

The script can be called from a Windows Terminal.

 

Hint: You can use the Python built-in module "ipaddress". This is an example of how it is used (do some more research on the ipaddress module): 

ipaddress.ip_address('10.1.1.1').is_private will return "True"

 

Task 2:

 

In this task, you will build a project, install packages, and use them in the project.

  • Create a main2.py file in the folder
  • Create and activate a virtual environment called "venv" in the folder
  • In the "venv" virtual environment, install the "netmiko" and "requests" packages
  • In the "main2.py" file, write a short function that will verify whether an equipment brand is supported by Netmiko. (hint: "dir(netmiko)" will return a list that contain all supported equipment types.
  • One should be able to call the function from the command line terminal. The program will ask for an equipment brand name. When a name is entered, either "... is Supported" or "... is Not Supported" is received as a response.

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education