Guest User

Untitled

a guest
Nov 16th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. #IP Scanner
  2. import socket, subprocess
  3. ip=socket.gethostbyname(socket.gethostname())
  4. ipmain=ip[0:11]
  5.  
  6. print('Your IP Range: ',ip[0:11],'*')
  7. iprang=input('Is this correct? y/n ')
  8. if iprang == 'y':
  9.     print('Awesome.\n')
  10. elif iprang == 'n':
  11.     newip=input('What is your IP range?: ')
  12.     print('Your new IP range: ', newip[0:11], '*')
  13.  
  14. x=int(input('Starting IP? '))
  15. y=int(input('Ending IP? '))
  16.  
  17.  
  18. for ping in range(x,y):
  19.     address = ipmain + str(ping)
  20.     res = subprocess.call(['ping.exe', '-n', '1', '-w', '2' , address])
  21.     if res == 0:
  22.         print(address, '-Active', res)
  23.  
  24.     elif res == 2:
  25.         print (address, '-Not Active', res)
  26.  
  27.     else:
  28.         print(address, '-Inactive', res)
Add Comment
Please, Sign In to add comment