Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- from pythonping import ping
- import threading
- import socket
- import time
- def getMyIp():
- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- s.connect(("8.8.8.8", 80))
- ip = s.getsockname()[0]
- s.close()
- return ip
- def scan_Ip(ip):
- address = str(net) + str(ip)
- p = ping(address).rtt_avg_ms
- if p != 2000:
- print("address: " + address + " ping: " + str(p))
- net = getMyIp()
- print('You IP :',net)
- net_split = net.split('.')
- a = '.'
- net = net_split[0] + a + net_split[1] + a + net_split[2] + a
- start_point = 1
- end_point = 255
- startTime = time.time()
- print("Scanning in Progress:")
- for ip in range(start_point, end_point):
- if ip == int(net_split[3]):
- continue
- potoc = threading.Thread(target=scan_Ip, args=[ip])
- potoc.start()
- potoc.join()
- print("Total time: " + str(time.time() - startTime))
Advertisement
Add Comment
Please, Sign In to add comment