Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

improve script. This is supposed to ping each host twice in a subnet and only print those that are active. import os network =

improve script. This is supposed to ping each host twice in a subnet and only print those that are active.

 

import os

network = input ("Enter first 3 numbers of IP network, e.g. 1.2.3: ")
print(network)


hosts_scanned = 0
for host in range (1, 255):
   response = os.popen("ping -n 2 " + network + "." + str(host))
   if "TTL" in response.readlines():
       print("Host " + network + "." + str(host) + " reachable. ")
       hosts_scanned += 1
print("Total hosts scanned: ", hosts_scanned)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer To improve the script several changes can be made to make it more efficient and robust Use th... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Entrepreneurship

Authors: Andrew Zacharakis, William D Bygrave

5th Edition

1119563097, 9781119563099

More Books

Students also viewed these Operating System questions

Question

List three benefits of using a to-do list.

Answered: 1 week ago

Question

What does surplus energy mean to civilizations?

Answered: 1 week ago