Giter Site home page Giter Site logo

42-ft_ping's Introduction

42-ft_ping

ft_ping is one of the projects in 42 cursus.

課題概要

実行環境について

  • VM で動かせるようにする必要がある。
    • OS: Debian 7.0 stable
      • Linux Kernel > 3.14
    • 必要なソフトウェアやパッケージはインストール済みであること

Allowed functions

  • gettimeofday.
  • exit.
  • inet_ntop. / inet_pton.
    • IPv4/IPv6アドレスの文字列とバイナリ表現の変換
  • ntohs / htons.
    • ネットワークバイトオーダーとホストバイトオーダーの変換
  • signal / alarm / usleep.
  • socket / setsockopt / close.
  • sendto / recvmsg.
  • getpid / getuid.
  • getaddrinfo / getnameinfo / freeaddrinfo.
  • strerror / gai_strerror.
  • printf and its family
  • Your libft functions
  • You are allowed to use other functions to complete the bonus part as long as their use is justified during your defense. Be smart.
  • ATTENTION: Usage of fcntl, poll, epoll is strictly forbidden.

Mandatory Part

Bonus Part

  • 以下のフラグを受け付ける必要がある。
  • -f
    • Flood ping. Outputs packets as fast as they come back or one hundred times per second, whichever is more. For every ECHO_REQUEST sent a period ``.'' is printed, while for every ECHO_REPLY received a backspace is printed. This provides a rapid display of how many packets are being dropped. Only the super-user may use this option. This can be very hard on a network and should be used with caution.
  • -l preload
    • If preload is specified, ping sends that many packets as fast as possible before falling into its normal mode of behavior.
  • -n
    • Numeric output only. No attempt will be made to lookup symbolic names for host addresses.
  • -w deadline
    • Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. In this case ping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network.
  • -W timeout
    • Time to wait for a response, in seconds. The option affects only timeout in absense of any responses, otherwise ping waits for two RTTs.
  • -p pattern
    • You may specify up to 16 ''pad'' bytes to fill out the packet you send. This is useful for diagnosing data-dependent problems in a network. For example, -p ff will cause the sent packet to be filled with all ones.
  • -r
    • Bypass the normal routing tables and send directly to a host on an attached interface. If the host is not on a directly-attached network, an error is returned. This option can be used to ping a local host through an interface that has no route through it provided the option -I is also used.
  • -s packetsize
    • Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.
  • -T timestamp option
    • Set special IP timestamp options. timestamp option may be either tsonly (only timestamps), tsandaddr (timestamps and addresses) or tsprespec host1 [host2 [host3 [host4]]] (timestamp prespecified hops).
  • --ttl ttl
    • Set the IP Time to Live.
  • --ip-timestamp
    • -T timestamp option と同じ。

メモ

ping コマンドってなんだ

ICMP echo request/reply を使って

ping 127.0.0.1ping google.com のようにして実行

作業環境

送信されたパケット情報の見方

Wireshark

適当にインストールして使えばおk

tcpdump

ping 127.0.0.1 を実行し、受信したパケットを hex と ACII で表示する。

sudo tcpdump -i lo0 -X -vvv

参考資料

ping の仕様

ネットワーク関連

Linux コマンド

42-ft_ping's People

Contributors

junnetworks avatar

Stargazers

averak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.