Posts: 4,648
Threads: 1,495
Joined: Sep 2016
many
unix or
unix-like systems handle their support for pinging
IPv6 and
IPv4 differently. some have
/bin/ping
do
IPv4 and
/bin/ping6
do
IPv6. others might have
/bin/ping4
and
/bin/ping6
. still, other might have
/bin/ping
do both. in more subtle cases, they might have
/bin/ping4
and
/bin/ping6
while also having
/bin/ping
figuring out which of those first two to run and run it (in this case, the answer for both would be
/bin/ping
.
what i would like is code that figures out
which to run. a function like
which46ping() that returns a tuple of the 2 paths would be nice
import which46ping
ping4cmd, ping6cmd = which46ping.which46ping()
such code may require knowledge about many systems. or it may do tests with some assumptions about options and/or arguments. maybe it can even include support for
windows.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,648
Threads: 1,495
Joined: Sep 2016
(May-10-2018, 09:02 AM)wavic Wrote: ping -4 uses IPv4
ping -6 uses IPv6
ping alone should work with both
I've not used anything else. Isn't it just one ping command?
not in all systems. some can figure out what to do given the IP address; some cannot. some have different executables.
Output:
lt1/forums /home/forums 1> sha384sum /bin/ping*
104ae729b7f1ee8f28b79f9ad5c82ae8f330b3ac91fd3f6a3f6f483a2114217ea32f99a6963f4dfd8ab49cb45a04a0e2 /bin/ping
803f76b3ab987e77885c3313347bf50d084d3d3ed568267066a08e978ede1a46c2d6cbf567c0162ce47c2bd04851f547 /bin/ping6
lt1/forums /home/forums 2> ls -dl /bin/ping*
-rwsr-xr-x 1 root root 44168 May 7 2014 /bin/ping
-rwsr-xr-x 1 root root 44680 May 7 2014 /bin/ping6
lt1/forums /home/forums 3>
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,648
Threads: 1,495
Joined: Sep 2016
yes, pretty much all systems have some form of ping at least for IPv4. that makes half of my need easy. i suppose someone could build a custom system for an IPv6 only world. the question is which command for a given address family. that's what i need a program to figure out instead of guessing. maybe doing a limited finite ping to some addresses across all suspected ping commands might work. but the system might have weird commands with potentially matchable names like "pingwithtcp" or such. and some systems could have a very customized set of commands. i'm curious how others might have sorted this out.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,648
Threads: 1,495
Joined: Sep 2016
yes, this certainly appears to be a complex problem. i knew it would be. so i wondered if anyone has come up with a decent solution. i guess not. that or no one around here has seen one. so i will have to come up with the best i can. if "ping6" exist then use it for IPv6, else "ping" if it exists, else None. if "ping4" exist then use it for IPv4, else "ping" if it exists, else None.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,648
Threads: 1,495
Joined: Sep 2016
(May-14-2018, 04:45 AM)wavic Wrote: Just scan the bin directories for ping related program names. It's simple and should work because of we people have this habit to name the program after what it is doing. If it will send just a ping it has to be called ping or ping?/ping*
i thought about doing this. then i remember seeing programs that did different kinds of pings with "ping" in the name. also, i have seen "ping" in "/usr/bin". it would not surprise me if it ever shows up in "/sbin" or "/usr/sbin".
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.