Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #IP Scanner
- import socket, subprocess
- ip=socket.gethostbyname(socket.gethostname())
- ipmain=ip[0:11]
- print('Your IP Range: ',ip[0:11],'*')
- iprang=input('Is this correct? y/n ')
- if iprang == 'y':
- print('Awesome.\n')
- elif iprang == 'n':
- newip=input('What is your IP range?: ')
- print('Your new IP range: ', newip[0:11], '*')
- x=int(input('Starting IP? '))
- y=int(input('Ending IP? '))
- for ping in range(x,y):
- address = ipmain + str(ping)
- res = subprocess.call(['ping.exe', '-n', '1', '-w', '2' , address])
- if res == 0:
- print(address, '-Active', res)
- elif res == 2:
- print (address, '-Not Active', res)
- else:
- print(address, '-Inactive', res)
Add Comment
Please, Sign In to add comment