Skip to content

Ping Sweep_ Python Method

TheGetch edited this page Jan 5, 2021 · 1 revision

Ping Sweep: Python Method

Ping Sweep: Python Method

The following python script can be used to perform a ping scan.

#!/usr/bin/env python3
import ipaddress
from subprocess import Popen, DEVNULL

for ping in range(1, 254):
        address = "x.x.x.%d" % ping
        response = Popen(["ping", "-c1", address], stdout=DEVNULL)
        output = response.communicate()[0]
        val1 = response.returncode
        if val1 == 0:
                print(address)

This script is specifically used for a /24 network. Modification required for other network types.

_Sidebar

1. Recon

Ping Sweep

CIDR to IP

2. Enumeration

Services

05. HTTP (80,443,8080,8443,etc.)

3. Exploitation

4. Post Exploiation

5. High Value Information

Hashes

6. Reporting

7. Random Notes/Useful Tidbits

Clone this wiki locally