daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import socket
  2. import os
  3. import re
  4. import subprocess
  5.  
  6. print('[+] Choice : ')
  7. print('1 - Scan Network')
  8.  
  9. host = []  
  10. choice = int(input())
  11. ip= '192.168.1.'
  12. x= 0
  13. if choice == 1:
  14.     while x<=100:
  15.         p= subprocess.Popen('ping ' +ip+str(x) +" -n 1" ,stdout=subprocess.PIPE, shell =True)
  16.         out, error = p.communicate()
  17.         out = str(out)
  18.         find = re.search("Destination host unreachable",out)
  19.         if find is None:
  20.            host.append(ip+str(x))
  21.            print("[*] Host found")
  22.         x = x +1
  23. print ('+------------------------------------+')
  24. print('|       HOST                          |')
  25. print('+-------------------------------------+')
  26. for host in host:
  27.     try:
  28.          name, a ,b = socket.gethostbyaddr(host)
  29.     except:
  30.          name = "Not found "
  31.     print('| '+ host + " | " + name)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top