Jul-23-2022, 07:39 PM
(Jul-23-2022, 05:50 PM)Calli Wrote: I'll be willing to give anyone some btc if he can do this for me.If want to pay post in Jobs Thread not here.
Thank you
Here some help and don't need curl for this.
icmplib is great for this task.
Example with multiping
Get the list for a file can bee done like this.
ip_lst.txt
Output:python-forum.io
10.0.0.5
127.0.0.1
::1
I set down count/time it will use to check count=1, interval=0.2, timeout=1
,so it will be fast be can be less accurate so short count/times .Can set parameters to what you want.
from icmplib import multiping def read_ip() -> list: with open('ip_lst.txt') as f: return [i.strip() for i in f] def check_ip(ip_lst : list): hosts = multiping(ip_lst, count=1, interval=0.2, timeout=1) for host in hosts: if host.is_alive: print(f'{host.address} is up!') else: print(f'{host.address} is down!') if __name__ == '__main__': ip_lst = read_ip() check_ip(ip_lst)
Output:172.67.168.227 is up!
10.0.0.5 is down!
127.0.0.1 is up!
::1 is up!