deadman icon indicating copy to clipboard operation
deadman copied to clipboard

Use OS-independent ping

Open upa opened this issue 6 years ago • 5 comments

The current implementation uses ping commands on OSes. However, their options are different and sometimes changed (e.g., on ubuntu 18.04). So, we need to use OS-independent ping.

Which is a better way for achieving it?

upa avatar Jul 14 '18 05:07 upa

I think using scapy will be good solution. But a bit difficult than ping and libpcap must included on system

Lapshin avatar Jul 18 '18 10:07 Lapshin

I don't know how much seriously it is maintained, but there is a guy who implemented ping using Python. https://github.com/satoshi03/pings

keiichishima avatar Jul 18 '18 10:07 keiichishima

Implementing ping uing python is a reasonable way. I will try to integrate it or impelement ping when I have time :-)

btw, I tried to use scapy when I started to write deadman. Unfortunately, scapy-based ping involved 'long time' to build, send, and receive icmp packets. It spoils accuracy of RTT, so I gave up on using scapy.

upa avatar Oct 09 '18 02:10 upa

Traceback (most recent call last):
  File "./deadman", line 727, in <module>
    curses.wrapper(main, args.configfile)
  File "/usr/lib/python3.8/curses/__init__.py", line 105, in wrapper
    return func(stdscr, *args, **kwds)
  File "./deadman", line 702, in main
    deadman.main()
  File "./deadman", line 601, in main
    target.send()
  File "./deadman", line 109, in send
    res = self.ping.send()
  File "./deadman", line 239, in send
    r = subprocess.check_output(cmd, stderr = subprocess.DEVNULL,
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ping6'

I'm using Arch Linux and got this error message after running deadman. After searching, it turns out ping command on Arch Linux also has IPv6 function. So, there's no ping6 on Arch Linux. I just create a soft link in ~/.local/bin/ping6 with /usr/bin/ping to solve the problem with: ln -s /usr/bin/ping ~/.local/bin/ping6

Definitely related to this issue. Just want to let you know and who might encounter the same problem as me.

BTW, This is a great project. Thanks for you guys.

fkztw avatar Apr 22 '20 18:04 fkztw

I found that problem ping6 had been merge into ping. ref: ping: merge ping6 command into ping

Maybe we had to check ping6 command isn't existed, than change to use ping -6. Ether change to use ping -6 replace ping6.

Superbil avatar Apr 29 '20 22:04 Superbil