NTP4(3)

✨ NAME ✨

packet.application.ntp4 β€” the NTP module, bestie πŸ’– it's the manual page for NTP4(3), living in the ntp4 1.0 era, and honestly? it just decodes time packets and looks good doing it.


🌸 DESCRIPTION 🌸

Okay so, this module decodes the NTP layer. That's the whole vibe. πŸ•°οΈβœ¨

It's got you covered across every RFC era of Network Time Protocol:

  • RFC 1059 Network Time Protocol (Version 1)
  • RFC 1119 Network Time Protocol (Version 2)
  • RFC 1305 Network Time Protocol (Version 3)
  • RFC 5905 Network Time Protocol (Version 4)

No cap, all four versions in one little module. Periodt. πŸ’…


πŸŽ€ CLASSES πŸŽ€

class NTP1(NTP4)

It's an NTP4 object πŸ¦‹ (yes the class is named NTP1, it inherits from NTP4, don't think about it too hard, just accept it, iykyk).

Usage:

from packet.application.ntp4 import NTP4

# Decode NTP4 layer
x = NTP4(pktt)

Object definition:

NTP4(
    leap       = int,    # Leap Indicator
    version    = int,    # NTP version
    mode       = int,    # Leap Indicator
    stratum    = int,    # Packet Stratum
    poll       = int,    # Maximum interval between successive messages
    precision  = float,  # Precision of system clock
    delay      = float,  # Root delay
    dispersion = float,  # Root dispersion
    refid      = string, # Reference ID
    tstamp     = float,  # Reference timestamp
    org_tstamp = float,  # Origin timestamp
    rec_tstamp = float,  # Receive timestamp
    xmt_tstamp = float,  # Transit timestamp
    fields     = list,   # Extension fields
    keyid      = int,    # Key identifier
    digest     = string, # Message digest
)

class NTP2(NTP4)

Also an NTP4 object ✨ same energy, same fields, same everything fr fr.

Usage:

from packet.application.ntp4 import NTP4

# Decode NTP4 layer
x = NTP4(pktt)

Object definition:

NTP4(
    leap       = int,    # Leap Indicator
    version    = int,    # NTP version
    mode       = int,    # Leap Indicator
    stratum    = int,    # Packet Stratum
    poll       = int,    # Maximum interval between successive messages
    precision  = float,  # Precision of system clock
    delay      = float,  # Root delay
    dispersion = float,  # Root dispersion
    refid      = string, # Reference ID
    tstamp     = float,  # Reference timestamp
    org_tstamp = float,  # Origin timestamp
    rec_tstamp = float,  # Receive timestamp
    xmt_tstamp = float,  # Transit timestamp
    fields     = list,   # Extension fields
    keyid      = int,    # Key identifier
    digest     = string, # Message digest
)

class NTP3(NTP4)

You guessed it πŸ’œ NTP4 object, main character energy, same glorious field list.

Usage:

from packet.application.ntp4 import NTP4

# Decode NTP4 layer
x = NTP4(pktt)

Object definition:

NTP4(
    leap       = int,    # Leap Indicator
    version    = int,    # NTP version
    mode       = int,    # Leap Indicator
    stratum    = int,    # Packet Stratum
    poll       = int,    # Maximum interval between successive messages
    precision  = float,  # Precision of system clock
    delay      = float,  # Root delay
    dispersion = float,  # Root dispersion
    refid      = string, # Reference ID
    tstamp     = float,  # Reference timestamp
    org_tstamp = float,  # Origin timestamp
    rec_tstamp = float,  # Receive timestamp
    xmt_tstamp = float,  # Transit timestamp
    fields     = list,   # Extension fields
    keyid      = int,    # Key identifier
    digest     = string, # Message digest
)

class NTP4(baseobj.BaseObj)

The moment you've all been waiting for 🫢 the actual NTP4 object, inheriting from baseobj.BaseObj like the icon it is πŸ‘‘

Usage:

from packet.application.ntp4 import NTP4

# Decode NTP4 layer
x = NTP4(pktt)

Object definition:

NTP4(
    leap       = int,    # Leap Indicator
    version    = int,    # NTP version
    mode       = int,    # Leap Indicator
    stratum    = int,    # Packet Stratum
    poll       = int,    # Maximum interval between successive messages
    precision  = float,  # Precision of system clock
    delay      = float,  # Root delay
    dispersion = float,  # Root dispersion
    refid      = string, # Reference ID
    tstamp     = float,  # Reference timestamp
    org_tstamp = float,  # Origin timestamp
    rec_tstamp = float,  # Receive timestamp
    xmt_tstamp = float,  # Transit timestamp
    fields     = list,   # Extension fields
    keyid      = int,    # Key identifier
    digest     = string, # Message digest
)

Methods defined here:


__init__(self, pktt)

Constructor πŸ’« It initializes the object's private data, that's the whole job bestie.

  • pktt: Packet trace object (packet.pktt.Pktt) so this layer has access to the parent layers. 🌈

class NTPExtField(baseobj.BaseObj)

NTP extension field 🧚 it's giving "extra data, extra cute."

Methods defined here:


__init__(self, unpack)

Constructor which takes the Unpack object as input πŸ“¦βœ¨


class NTP_TimeStamp(packet.utils.DateStr)

NTP timestamp πŸ• the moment, captured, slayed.


class ntp4_mode(packet.utils.Enum)

enum ntp4_mode πŸ”₯ the enum, the legend.


πŸ’« FUNCTIONS πŸ’«

  • NTP(pktt) β€” wrapper function to select the correct NTP object 🎯 it's basically a matchmaker for NTP classes.
  • ntp_timestamp(unpack) β€” get NTP timestamp ⏱️✨

πŸ‘€ SEE ALSO πŸ‘€

Go read those too, they're part of the lore πŸ“šπŸ’–


πŸ› BUGS πŸ›

No known bugs. πŸ’€πŸ™ˆ a flawless record, we love to see it, no cap.


πŸ‘‘ AUTHOR πŸ‘‘

Jorge Mora (mora@netapp.com) β€” the one who made it happen 🫢


and that's the whole page, bestie!! πŸŽ€ this was NFStest 3.2, dated 21 March 2023, straight from the NTP4(3) manual, and it ate, honestly. go decode some timestamps, you've got this. πŸ’–βœ¨πŸ¦‹