Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/usr/bin/python
  2. import os
  3. global lis
  4. print("Scanning the Subnet : ")
  5. subnet_input = '192.168.1.0'
  6. subnet_input = subnet_input.split('.')
  7. for x in range(0,255):
  8. subnet_input[3] = x
  9. str(subnet_input)
  10. new_sub = str(subnet_input[0])+'.'+str(subnet_input[1])+'.'+str(subnet_input[2])+'.'+str(subnet_input[3])
  11. res = os.system("ping -c 4 {}".format(new_sub))
  12. if res==0:
  13. print("{} is Alive".format(new_sub))
  14. str(new_sub)
  15. lis = lis + " " + new_sub
  16. else:
  17. continue
  18. print("[*] ALL ALIVE HOSTS ARE : ")
  19. for i in lis:
  20. print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement