import ipaddress
import subprocess

ip_addrs = []
for n in range(5):
    # ip = ipaddress.ip_address(f'192.168.0.{n}')
    ip = f'192.168.0.{n}'
    ip_addrs.append(ip)

for ip in ip_addrs:
    with subprocess.Popen(["ping", "-c1", ip]) as result:
        if result:
            print(ip, "inactive")
        else:
            print(ip, "active")

4a0829e8afb5038a61411b25ad689514d5d0e40c
<mask token>

<mask token>
for n in range(5):
    ip = f'192.168.0.{n}'
    ip_addrs.append(ip)
for ip in ip_addrs:
    with subprocess.Popen(['ping', '-c1', ip]) as result:
        if result:
            print(ip, 'inactive')
        else:
            print(ip, 'active')

<mask token>
ip_addrs = []
for n in range(5):
    ip = f'192.168.0.{n}'
    ip_addrs.append(ip)
for ip in ip_addrs:
    with subprocess.Popen(['ping', '-c1', ip]) as result:
        if result:
            print(ip, 'inactive')
        else:
            print(ip, 'active')

import ipaddress
import subprocess
ip_addrs = []
for n in range(5):
    ip = f'192.168.0.{n}'
    ip_addrs.append(ip)
for ip in ip_addrs:
    with subprocess.Popen(['ping', '-c1', ip]) as result:
        if result:
            print(ip, 'inactive')
        else:
            print(ip, 'active')

import ipaddress
import subprocess

ip_addrs = []
for n in range(5):
    # ip = ipaddress.ip_address(f'192.168.0.{n}')
    ip = f'192.168.0.{n}'
    ip_addrs.append(ip)

for ip in ip_addrs:
    with subprocess.Popen(["ping", "-c1", ip]) as result:
        if result:
            print(ip, "inactive")
        else:
            print(ip, "active")
