How can you find the process issuing ping to localhost? While it is not script, where the ping command can be simply grep from process table.
I have used wireshark, but it is of no help to find out which process actually causing the ping.
Many thanks for any hint.
The command
sudo lsof -n |grep "st=07"
seem to work.To test it, I ran
ping
as shown below on one terminal to generate ICMP packetsOn another terminal, I ran
lsof
as shown below. You can see the output shows the process and the pid that is the source of ICMP packets.source: https://stackoverflow.com/questions/23327689/identify-the-pid-of-process-which-is-transmitting-icmp-packets
You can do it with systemtap, which can monitor all the subsystems, so you don't need to check system state for specific moment - you can log events:
https://sourceware.org/systemtap/SystemTap_Beginners_Guide/useful-systemtap-scripts.html
Sending ICMP Echo Request packets needs root privileges. So you have 2 options:
Example commands:
Then check all results of the second command, if the particular binary has SUID bit:
As you can see from permissions list, 3rd and 4th programs have SUID bit, while 1st and 2nd don't.