Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import os
- import re
- import subprocess
- print('[+] Choice : ')
- print('1 - Scan Network')
- host = []
- choice = int(input())
- ip= '192.168.1.'
- x= 0
- if choice == 1:
- while x<=100:
- p= subprocess.Popen('ping ' +ip+str(x) +" -n 1" ,stdout=subprocess.PIPE, shell =True)
- out, error = p.communicate()
- out = str(out)
- find = re.search("Destination host unreachable",out)
- if find is None:
- host.append(ip+str(x))
- print("[*] Host found")
- x = x +1
- print ('+------------------------------------+')
- print('| HOST |')
- print('+-------------------------------------+')
- for host in host:
- try:
- name, a ,b = socket.gethostbyaddr(host)
- except:
- name = "Not found "
- print('| '+ host + " | " + name)
Add Comment
Please, Sign In to add comment