Open upa opened 6 years ago
I think using scapy will be good solution. But a bit difficult than ping and libpcap must included on system
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
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.
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.
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
.
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?