This script written with Python scans the local network for identifying active devices. Useful for network monitoring to check the unapproved device on your network.
Code Example:
import os
def scan_network(network):
print("Scanning network : " + network)
response = os.popen("ping -c 1 " + network).read()
if response.find('1 packets transmitted, 1 received') >= 0:
print("The network is online-" + network)
else:
print("The network is offline-" + network)
for i in range(1, 255):
scan_network("192.168.1." + str(i));
Use Case: This can be used further in the audit of networks to identify unauthorized devices that may have connected to your system.
Tip: You can modify the script to scan your entire subnet and produce an inventory of devices connected to your network.
Top comments (0)