From b39d11d737ce4545874dc968573783fb46e6f9bd Mon Sep 17 00:00:00 2001 From: Omar Santos Date: Tue, 17 Jan 2023 15:26:38 -0500 Subject: [PATCH] Create basic_ping_sweep.py --- .../recon_scripts/basic_ping_sweep.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 programming_and_scripting_for_cybersecurity/recon_scripts/basic_ping_sweep.py diff --git a/programming_and_scripting_for_cybersecurity/recon_scripts/basic_ping_sweep.py b/programming_and_scripting_for_cybersecurity/recon_scripts/basic_ping_sweep.py new file mode 100644 index 0000000..eb25ded --- /dev/null +++ b/programming_and_scripting_for_cybersecurity/recon_scripts/basic_ping_sweep.py @@ -0,0 +1,22 @@ +# A simple script to perform a ping sweep of the +# Websploit (websploit.org) containers in the +# 10.6.6.0/24 network. + +import subprocess + +# Define the network to scan +network = "10.6.6.0/24" + +# Use the 'ping' command to scan the network +for i in range(1, 255): + ip = "10.6.6." + str(i) + result = subprocess.run(["ping", "-c", "1", "-W", "1", ip], stdout=subprocess.PIPE) + if result.returncode == 0: + print(ip + " is up") + else: + print(ip + " is down") + +# This script uses a for loop to iterate through all possible IP addresses in the network +# (from 10.6.6.1 to 10.6.6.254) and uses the ping command to check if the host is up or down. +# The -c option specifies the number of pings to send, +# and the -W option specifies the timeout in seconds.