• Diniz Martins

Python | Subnet Ping

This script will ping and display status of all hosts in a subnet we provide.

import subprocess
import ipaddress
from subprocess import Popen, PIPE
subnet = input("Please enter the network: ")
network = ipaddress.ip_network(subnet)
for i in network.hosts():
    toping = subprocess.Popen(['ping', '-c', '3', i], stdout=PIPE)
    output = toping.communicate()[0]
    hostalive = toping.returncode
    if hostalive == 0:
        print(i,'is ' + '\033[92m' + 'reachable' + '\033[0m')
        print(i,'is ' + '\033[91m' + 'unreachable' + '\033[0m')

That's what the script works:

drm@STENGE % python3 ping-subnet.py
Please enter the network: is reachable is unreachable is reachable is reachable is reachable is reachable
drm@STENGE % 


Recent Posts

See All


Sublist3r is a python tool designed to enumerate subdomains of websites using OSINT. It helps penetration testers and bug hunters collect and gather subdomains for the domain they are targeting. Enume

Ansible | Some issues

In this post I want to share with you some problems that I was facing and that I managed to fix by searching on Google, making debugs and talking with friends. #1) Problem to connect to devices using

Random MAC Generator

Use this online random MAC generator to generate a list of random MAC addresses in the format 0e:f6:5a:fb:7a:26. By default 10 random MAC addresses are generate, you can change this number below.