Python Forum
Need some guidance on a script to ping a list of ip's
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need some guidance on a script to ping a list of ip's
#11
I will try from the command line.. later this evening as the code is at home..

Now a separate question, which ill google today as time permits, but besides spyder is there any other good IDE's to use for writing python that have the ability to run the scripts and see outputs in the console?
Reply
#12
(Aug-10-2023, 01:18 PM)cubangt Wrote: I will try from the command line.. later this evening as the code is at home..
You most remember to always work from a active environment,either from (base) or a own environment that you make.
This is the same for Anaconda or MiniConda.
Example
# I have my own environment that i activate 
G:\div_code\egg
λ G:\miniconda3\Scripts\activate.bat tom_env

# Install
(tom_env) G:\div_code\egg
λ pip install icmplib
Collecting icmplib
  Using cached icmplib-3.0.3-py3-none-any.whl (30 kB)
Installing collected packages: icmplib
Successfully installed icmplib-3.0.3
To make some code of what you try do.
# ip_lst.py
from icmplib import multiping

with open("ip_list.txt") as fp:
    hosts = multiping([ip.strip() for ip in fp], interval=0.4, concurrent_tasks=30)
    for host in hosts:
        if host.is_alive:
            print(f'{host.address} is up!')
        else:
            print(f'{host.address} is down!')
Running code.
(tom_env) G:\div_code\egg
λ python ip_lst.py
127.0.0.1 is up!
104.21.27.41 is up!
104.156.80.0/20 is down!
8.8.8.8 is up!
77.16.58.122 is down! 
(Aug-10-2023, 01:18 PM)cubangt Wrote: Now a separate question, which ill google today as time permits, but besides spyder is there any other good IDE's to use for writing python that have the ability to run the scripts and see outputs in the console?
Spyder is ok,can try PyScripter which i use for quick testing ,my main editor is VS Code.
I do lot from command so cmder is important,cmd/PowerShell is not good at all.
Also use ptpython in cmder.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  non-stop ping script kucingkembar 1 1,472 Aug-23-2022, 06:29 AM
Last Post: menator01
  Win32\ping.exe windows pops up -very annoying... tester_V 9 3,508 Aug-12-2021, 06:54 AM
Last Post: tester_V
  Looking for discord bot to make loop ping for address ip tinkode 0 1,921 Jul-26-2021, 03:51 PM
Last Post: tinkode
  cant use ping, sudo or other commands in remote shell script. throwaway34 7 3,879 May-17-2021, 11:29 AM
Last Post: throwaway34
  Ping command using python 3.6.5 Martin2998 6 17,959 Apr-19-2021, 06:24 PM
Last Post: blazejwiecha
  Your Guidance caslor 1 2,246 Mar-28-2021, 09:34 PM
Last Post: Larz60+
  GPIO high if network IP has good ping duckredbeard 3 2,487 Oct-12-2020, 10:41 PM
Last Post: bowlofred
  Create a program that PING a list of IPs skaailet 7 6,852 Mar-26-2020, 10:46 PM
Last Post: snippsat
  ping with output jacklee26 1 5,152 Nov-28-2019, 01:01 PM
Last Post: Axel_Erfurt
  PING PONG GAME akea 0 5,807 May-08-2019, 04:30 PM
Last Post: akea

Forum Jump:

User Panel Messages

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