Skip to content

Instantly share code, notes, and snippets.

@Will-Beninger
Created June 12, 2021 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Will-Beninger/5cc91f3086ae620aa185ad0776af4f4a to your computer and use it in GitHub Desktop.
Save Will-Beninger/5cc91f3086ae620aa185ad0776af4f4a to your computer and use it in GitHub Desktop.
Python3 /24 CIDR scanner using system ping
#! /usr/bin/python3
import subprocess
import re
cmd = ['ping','-c1','-w1']
for i in range (1,255):
address="10.11.1."+str(i)
runcmd=cmd+[address]
result = subprocess.Popen(runcmd,stdout=subprocess.PIPE)
output = str(result.stdout.read())
m = re.search('bytes from (.+?):',output)
if (m):
print(m.group(1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment