Python Forum
A lot of confusion and I can't seem to solve this issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A lot of confusion and I can't seem to solve this issue
#3
(Jul-23-2022, 05:50 PM)Calli Wrote: I'll be willing to give anyone some btc if he can do this for me.
Thank you
If want to pay post in Jobs Thread not here.

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!
Calli likes this post
Reply


Messages In This Thread
RE: A lot of confusion and I can't seem to solve this issue - by snippsat - Jul-23-2022, 07:39 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020