Question
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Entrepreneurship
Authors: Andrew Zacharakis, William D Bygrave
5th Edition
1119563097, 9781119563099
Students also viewed these Operating System questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App