Question: : Use Python Script to explore your network The following Python script pings each host on a given network twice, modify the script to output

: Use Python Script to explore your network

The following Python script pings each host on a given network twice, modify the script to output only those hosts that are active.

# Script to ping all IP addresses in a /24 subnet

import os

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

print(network)

# Iterate over all usable IPs in this subnet

for host in range (1, 254):

print("Pinging " + network + "." + str(host))

os.system("ping -c 2 " + network + "." + str(host))

Writ another Python script to list all of the ports that are open on a given host. Test your script and paste both the script and the output in the space below:

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!