#!/usr/bin/python
import subprocess
import os
with open(os.devnull, "wb") as limbo:
for n in xrange(1, 10):
ip="192.168.18.{0}".format(n)
result=subprocess.Popen(["ping", "-c", "1", "-n", "-W", "2", ip],
stdout=limbo, stderr=limbo).wait()
if result:
print ip, "inactive"
else:
log = open("active_hosts", "a")
print >>log, ip
print >>log, ip
When running my script you will receive the following output
root@kali:/home/cyclonis/scripts/python# ./laserbeak.py
192.168.18.1 active
192.168.18.2 inactive
192.168.18.3 inactive
192.168.18.4 inactive
192.168.18.5 inactive
192.168.18.6 inactive
192.168.18.7 inactive
192.168.18.8 inactive
192.168.18.9 active
Well i hope whoever reads this blog post gets something from it. I really enjoy sharing information with others so if you like it please feel free to use it.
Well i hope whoever reads this blog post gets something from it. I really enjoy sharing information with others so if you like it please feel free to use it.
No comments:
Post a Comment