Clone of ping (GNU inetutils 2.0)
Note
You can get any version here
demo.mp4
Warning
This repo use submodules, make sure you fetch those all
bash:~$ git clone [email protected]:Pixailz/ft_ping --recurse-submodules
bash:~$ cd ft_ping
bash:~/ft_ping$ make bonus
[...]
bash:~/ft_ping$ ./ft_ping --help
Usage: ft_ping [OPTION...] HOST ...
Send ICMP ECHO_REQUEST packets to network hosts.
Options valid for all request types:
-c, --count=NUMBER stop after sending NUMBER packets
-i, --interval=FLOAT wait, FLOAT * 1, second between sending each packet
-n, --numeric do not resolve host addresses
--ttl=N specify N as time-to-live
-T, --tos=NUM set type of service (TOS) to NUM
-v, --verbose verbose output
-w, --timeout=N stop after N seconds
-W, --linger=N number of seconds to wait for response
Options valid for --echo requests:
-f, --flood flood ping (root only)
-l, --preload=NUMBER send NUMBER packets as fast as possible before
falling into normal mode of behavior (root only)
-p, --pattern=PATTERN fill ICMP packet with given pattern (hex)
-q, --quiet quiet output
-s, --size=NUMBER send NUMBER data octets
-?, --help give this help list
--usage give a short usage message
-V, --version print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
Options marked with (root only) are available only to superuser.
Report bugs to <[email protected]>.
bash$ sudo ./ft_ping 42angouleme.fr -c1
to make stats about our ping
sudo ./rsc/ping -f 127.0.0.1 & sleep 5s; sudo kill -s SIGINT $!
Caution
This will flood icmp packet as soon as the process received the reply
sudo bash -c "./ft_ping 127.0.0.1 DEBUG_FD>exec.log"
Note
This command output DEBUG_FD to a log file with sudo privileges
- ALL
sudo bash -c "valgrind \ --leak-check=full \ --show-leak-kinds=all \ --track-origins=yes \ --trace-children=yes \ --track-fds=yes \ ./ft_ping 127.0.0.1 127.0.0.2 127.0.0.3 DEBUG_FD>exec.log"
- print_packet -> get_packet_str