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
#4
(Jul-23-2022, 07:39 PM)snippsat Wrote:
(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!

Thanks for sharing this but what you have shared is completely the opposite of what i wanted done. For instance if I check this IP
118.31.106.59 is down!

It says that it's down but the fact that this is not down when you check using a specific port which in this case is 9200.
The search should be like this
curl -X GET "http://118.31.106.59:9200/_cat/indices"
Result I get
green open .geoip_databases vtWge-U1SLefV6CuavYxCQ 1 0 40 40 37.7mb 37.7mb

Now I want to safe the scan result like this in a different file scan_output.txt
118.31.106.59
green open .geoip_databases vtWge-U1SLefV6CuavYxCQ 1 0 40 40 37.7mb 37.7mb
Reply


Messages In This Thread
RE: A lot of confusion and I can't seem to solve this issue - by Calli - Jul-24-2022, 12:15 AM

Forum Jump:

User Panel Messages

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