IAmDaze
Junior Member
- Sep 2, 2017
- 162
- 163
I am just learning a Python. I have made IP scraping bot and it saved output as IP
ORT in text time. Now my next step is to check if the scraped IPs are alive or not. I have already done it but its slow since pinging take some time. So I want to make it multi-threaded so that it can check multiple IPs at once.
Code:
import os
readfile = open('test.txt', 'r').read().split('\n')
for ip in readfile :
respose = os.system('ping -n 1 '+ip[0:ip.find(':')])
if respose == 0 :
print(ip + ' is up!')
else :
print(ip + ' is down!')