scapy.layers.ntp module

NTP (Network Time Protocol). References : RFC 5905, RC 1305, ntpd source code

class scapy.layers.ntp.NTP

Bases: scapy.packet.Packet

Base class that allows easier instantiation of a NTP packet from binary data.

aliastypes = [<class 'scapy.layers.ntp.NTP'>, <class 'scapy.packet.Packet'>]
classmethod dispatch_hook(_pkt=None, *args, **kargs)

Returns the right class for the given data.

getlayer(cls, nb=1, _track=None, _subclass=True, **flt)

Return the nb^th layer that is an instance of cls, matching flt values.

haslayer(cls)

Specific: NTPHeader().haslayer(NTP) should return True.

mysummary()

DEV: can be overloaded to return a string that summarizes the layer. Only one mysummary() is used in a whole packet summary: the one of the upper layer, # noqa: E501 except if a mysummary() also returns (as a couple) a list of layers whose # noqa: E501 mysummary() must be called if they are present.

pre_dissect(s)

Check that the payload is long enough to build a NTP packet.

class scapy.layers.ntp.NTPAuthenticator

Bases: scapy.packet.Packet

Packet handling the “authenticator” part of a NTP packet, as defined in RFC 5905.

aliastypes = [<class 'scapy.layers.ntp.NTPAuthenticator'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (NTPAuthenticator).padding>, <Field (NTPAuthenticator).key_id>, <Field (NTPAuthenticator).dgst>]
class scapy.layers.ntp.NTPClockStatusPacket

Bases: scapy.packet.Packet

Packet handling the clock status fields.

aliastypes = [<class 'scapy.layers.ntp.NTPClockStatusPacket'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (NTPClockStatusPacket).clock_status>, <Field (NTPClockStatusPacket).code>]
class scapy.layers.ntp.NTPConfPeer

Bases: scapy.packet.Packet

Structure for passing peer configuration information.

aliastypes = [<class 'scapy.layers.ntp.NTPConfPeer'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPConfPeer).peeraddr>, <Field (NTPConfPeer).hmode>, <Field (NTPConfPeer).version>, <Field (NTPConfPeer).minpoll>, <Field (NTPConfPeer).maxpoll>, <Field (NTPConfPeer).flags>, <Field (NTPConfPeer).ttl>, <Field (NTPConfPeer).unused1>, <Field (NTPConfPeer).keyid>, <Field (NTPConfPeer).keystr>, <Field (NTPConfPeer).v6_flag>, <Field (NTPConfPeer).unused2>, <Field (NTPConfPeer).peeraddr6>]
class scapy.layers.ntp.NTPConfRestrict

Bases: scapy.packet.Packet

Structure used for specifying restrict entries.

aliastypes = [<class 'scapy.layers.ntp.NTPConfRestrict'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPConfRestrict).addr>, <Field (NTPConfRestrict).mask>, <Field (NTPConfRestrict).flags>, <Field (NTPConfRestrict).m_flags>, <Field (NTPConfRestrict).v6_flag>, <Field (NTPConfRestrict).addr6>, <Field (NTPConfRestrict).mask6>]
class scapy.layers.ntp.NTPConfTrap

Bases: scapy.packet.Packet

Structure used to pass add/clear trap information to the client

aliastypes = [<class 'scapy.layers.ntp.NTPConfTrap'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPConfTrap).local_address>, <Field (NTPConfTrap).trap_address>, <Field (NTPConfTrap).trap_port>, <Field (NTPConfTrap).unused>, <Field (NTPConfTrap).v6_flag>, <Field (NTPConfTrap).local_address6>, <Field (NTPConfTrap).trap_address6>]
class scapy.layers.ntp.NTPConfUnpeer

Bases: scapy.packet.Packet

Structure for passing peer deletion information.

aliastypes = [<class 'scapy.layers.ntp.NTPConfUnpeer'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPConfUnpeer).peeraddr>, <Field (NTPConfUnpeer).v6_flag>, <Field (NTPConfUnpeer).peeraddr6>]
class scapy.layers.ntp.NTPControl

Bases: scapy.layers.ntp.NTP

Packet handling NTP mode 6 / “Control” messages.

aliastypes = [<class 'scapy.layers.ntp.NTPControl'>, <class 'scapy.layers.ntp.NTP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPControl).zeros>, <Field (NTPControl).version>, <Field (NTPControl).mode>, <Field (NTPControl).response>, <Field (NTPControl).err>, <Field (NTPControl).more>, <Field (NTPControl).op_code>, <Field (NTPControl).sequence>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (NTPControl).association_id>, <Field (NTPControl).offset>, <Field (NTPControl).count>, <Field (NTPControl).data>, <Field (NTPControl).authenticator>]
post_build(p, pay)

DEV: called right after the current layer is build.

Parameters:
  • pkt (str) – the current packet (build by self_buil function)
  • pay (str) – the packet payload (build by do_build_payload function)
Returns:

a string of the packet with the payload

class scapy.layers.ntp.NTPControlDataPacketLenField(name, default, cls, length_from=None)

Bases: scapy.fields.PacketLenField

PacketField handling the “data” field of NTP control messages.

getfield(pkt, s)

Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second the extracted field itself in internal representation.

m2i(pkt, m)

Convert machine value to internal value

class scapy.layers.ntp.NTPControlStatusField(name, default, cls, remain=0)

Bases: scapy.fields.PacketField

This field provides better readability for the “status” field.

m2i(pkt, m)

Convert machine value to internal value

class scapy.layers.ntp.NTPErrorStatusPacket

Bases: scapy.packet.Packet

Packet handling the error status fields.

aliastypes = [<class 'scapy.layers.ntp.NTPErrorStatusPacket'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (NTPErrorStatusPacket).error_code>, <Field (NTPErrorStatusPacket).reserved>]
class scapy.layers.ntp.NTPExtPacketListField(name, default, cls=None, count_from=None, length_from=None, next_cls_cb=None)

Bases: scapy.fields.PacketListField

PacketListField handling NTPv4 extensions (NTPExtension list).

getfield(pkt, s)

Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second the extracted field itself in internal representation.

m2i(pkt, m)

Convert machine value to internal value

class scapy.layers.ntp.NTPExtension

Bases: scapy.packet.Packet

Packet handling a NTPv4 extension.

aliastypes = [<class 'scapy.layers.ntp.NTPExtension'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPExtension).type>, <Field (NTPExtension).len>, <scapy.fields.PadField object>]
class scapy.layers.ntp.NTPExtensions

Bases: scapy.packet.Packet

Packet handling the NTPv4 extensions and the “MAC part” of the packet.

aliastypes = [<class 'scapy.layers.ntp.NTPExtensions'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPExtensions).extensions>, <Field (NTPExtensions).mac>]
class scapy.layers.ntp.NTPHeader

Bases: scapy.layers.ntp.NTP

Packet handling the RFC 5905 NTP packet.

aliastypes = [<class 'scapy.layers.ntp.NTPHeader'>, <class 'scapy.layers.ntp.NTP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPHeader).leap>, <Field (NTPHeader).version>, <Field (NTPHeader).mode>, <Field (NTPHeader).stratum>, <Field (NTPHeader).poll>, <Field (NTPHeader).precision>, <Field (NTPHeader).delay>, <Field (NTPHeader).dispersion>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (NTPHeader).ref>, <Field (NTPHeader).orig>, <Field (NTPHeader).recv>, <Field (NTPHeader).sent>]
guess_payload_class(payload)

Handles NTPv4 extensions and MAC part (when authentication is used.)

class scapy.layers.ntp.NTPInfoAuth

Bases: scapy.packet.Packet

Structure used to return information concerning the authentication module.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoAuth'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoAuth).timereset>, <Field (NTPInfoAuth).numkeys>, <Field (NTPInfoAuth).numfreekeys>, <Field (NTPInfoAuth).keylookups>, <Field (NTPInfoAuth).keynotfound>, <Field (NTPInfoAuth).encryptions>, <Field (NTPInfoAuth).decryptions>, <Field (NTPInfoAuth).expired>, <Field (NTPInfoAuth).keyuncached>]
class scapy.layers.ntp.NTPInfoControl

Bases: scapy.packet.Packet

Structure used to return statistics from the control module.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoControl'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoControl).ctltimereset>, <Field (NTPInfoControl).numctlreq>, <Field (NTPInfoControl).numctlbadpkts>, <Field (NTPInfoControl).numctlresponses>, <Field (NTPInfoControl).numctlfrags>, <Field (NTPInfoControl).numctlerrors>, <Field (NTPInfoControl).numctltooshort>, <Field (NTPInfoControl).numctlinputresp>, <Field (NTPInfoControl).numctlinputfrag>, <Field (NTPInfoControl).numctlinputerr>, <Field (NTPInfoControl).numctlbadoffset>, <Field (NTPInfoControl).numctlbadversion>, <Field (NTPInfoControl).numctldatatooshort>, <Field (NTPInfoControl).numctlbadop>, <Field (NTPInfoControl).numasyncmsgs>]
class scapy.layers.ntp.NTPInfoIOStats

Bases: scapy.packet.Packet

I/O statistics.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoIOStats'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoIOStats).timereset>, <Field (NTPInfoIOStats).totalrecvbufs>, <Field (NTPInfoIOStats).freerecvbufs>, <Field (NTPInfoIOStats).fullrecvbufs>, <Field (NTPInfoIOStats).lowwater>, <Field (NTPInfoIOStats).dropped>, <Field (NTPInfoIOStats).ignored>, <Field (NTPInfoIOStats).received>, <Field (NTPInfoIOStats).sent>, <Field (NTPInfoIOStats).notsent>, <Field (NTPInfoIOStats).interrupts>, <Field (NTPInfoIOStats).int_received>]
class scapy.layers.ntp.NTPInfoIfStatsIPv4

Bases: scapy.packet.Packet

Interface statistics.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoIfStatsIPv4'>, <class 'scapy.packet.Packet'>]
fields_desc = [<scapy.fields.PadField object>, <scapy.fields.PadField object>, <scapy.fields.PadField object>, <Field (NTPInfoIfStatsIPv4).v6_flag>, <Field (NTPInfoIfStatsIPv4).ifname>, <Field (NTPInfoIfStatsIPv4).flags>, <Field (NTPInfoIfStatsIPv4).last_ttl>, <Field (NTPInfoIfStatsIPv4).num_mcast>, <Field (NTPInfoIfStatsIPv4).received>, <Field (NTPInfoIfStatsIPv4).sent>, <Field (NTPInfoIfStatsIPv4).notsent>, <Field (NTPInfoIfStatsIPv4).uptime>, <Field (NTPInfoIfStatsIPv4).scopeid>, <Field (NTPInfoIfStatsIPv4).ifindex>, <Field (NTPInfoIfStatsIPv4).ifnum>, <Field (NTPInfoIfStatsIPv4).peercnt>, <Field (NTPInfoIfStatsIPv4).family>, <Field (NTPInfoIfStatsIPv4).ignore_packets>, <Field (NTPInfoIfStatsIPv4).action>, <Field (NTPInfoIfStatsIPv4)._filler0>]
class scapy.layers.ntp.NTPInfoIfStatsIPv6

Bases: scapy.packet.Packet

Interface statistics.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoIfStatsIPv6'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoIfStatsIPv6).unaddr>, <Field (NTPInfoIfStatsIPv6).unbcast>, <Field (NTPInfoIfStatsIPv6).unmask>, <Field (NTPInfoIfStatsIPv6).v6_flag>, <Field (NTPInfoIfStatsIPv6).ifname>, <Field (NTPInfoIfStatsIPv6).flags>, <Field (NTPInfoIfStatsIPv6).last_ttl>, <Field (NTPInfoIfStatsIPv6).num_mcast>, <Field (NTPInfoIfStatsIPv6).received>, <Field (NTPInfoIfStatsIPv6).sent>, <Field (NTPInfoIfStatsIPv6).notsent>, <Field (NTPInfoIfStatsIPv6).uptime>, <Field (NTPInfoIfStatsIPv6).scopeid>, <Field (NTPInfoIfStatsIPv6).ifindex>, <Field (NTPInfoIfStatsIPv6).ifnum>, <Field (NTPInfoIfStatsIPv6).peercnt>, <Field (NTPInfoIfStatsIPv6).family>, <Field (NTPInfoIfStatsIPv6).ignore_packets>, <Field (NTPInfoIfStatsIPv6).action>, <Field (NTPInfoIfStatsIPv6)._filler0>]
class scapy.layers.ntp.NTPInfoKernel

Bases: scapy.packet.Packet

Structure used for returning kernel pll/PPS information

aliastypes = [<class 'scapy.layers.ntp.NTPInfoKernel'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoKernel).offset>, <Field (NTPInfoKernel).freq>, <Field (NTPInfoKernel).maxerror>, <Field (NTPInfoKernel).esterror>, <Field (NTPInfoKernel).status>, <Field (NTPInfoKernel).shift>, <Field (NTPInfoKernel).constant>, <Field (NTPInfoKernel).precision>, <Field (NTPInfoKernel).tolerance>, <Field (NTPInfoKernel).ppsfreq>, <Field (NTPInfoKernel).jitter>, <Field (NTPInfoKernel).stabil>, <Field (NTPInfoKernel).jitcnt>, <Field (NTPInfoKernel).calcnt>, <Field (NTPInfoKernel).errcnt>, <Field (NTPInfoKernel).stbcnt>]
class scapy.layers.ntp.NTPInfoLoop

Bases: scapy.packet.Packet

Loop filter variables.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoLoop'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoLoop).last_offset>, <Field (NTPInfoLoop).drift_comp>, <Field (NTPInfoLoop).compliance>, <Field (NTPInfoLoop).watchdog_timer>]
class scapy.layers.ntp.NTPInfoMemStats

Bases: scapy.packet.Packet

Peer memory statistics.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoMemStats'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoMemStats).timereset>, <Field (NTPInfoMemStats).totalpeermem>, <Field (NTPInfoMemStats).freepeermem>, <Field (NTPInfoMemStats).findpeer_calls>, <Field (NTPInfoMemStats).allocations>, <Field (NTPInfoMemStats).demobilizations>, <Field (NTPInfoMemStats).hashcount>]
class scapy.layers.ntp.NTPInfoMonitor1

Bases: scapy.packet.Packet

Structure used for returning monitor data.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoMonitor1'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoMonitor1).lasttime>, <Field (NTPInfoMonitor1).firsttime>, <Field (NTPInfoMonitor1).lastdrop>, <Field (NTPInfoMonitor1).count>, <Field (NTPInfoMonitor1).addr>, <Field (NTPInfoMonitor1).daddr>, <Field (NTPInfoMonitor1).flags>, <Field (NTPInfoMonitor1).port>, <Field (NTPInfoMonitor1).mode>, <Field (NTPInfoMonitor1).version>, <Field (NTPInfoMonitor1).v6_flag>, <Field (NTPInfoMonitor1).unused1>, <Field (NTPInfoMonitor1).addr6>, <Field (NTPInfoMonitor1).daddr6>]
class scapy.layers.ntp.NTPInfoPeer

Bases: scapy.packet.Packet

Peer information structure.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoPeer'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoPeer).dstaddr>, <Field (NTPInfoPeer).srcaddr>, <Field (NTPInfoPeer).srcport>, <Field (NTPInfoPeer).flags>, <Field (NTPInfoPeer).leap>, <Field (NTPInfoPeer).hmode>, <Field (NTPInfoPeer).pmode>, <Field (NTPInfoPeer).stratum>, <Field (NTPInfoPeer).ppoll>, <Field (NTPInfoPeer).hpoll>, <Field (NTPInfoPeer).precision>, <Field (NTPInfoPeer).version>, <Field (NTPInfoPeer).unused8>, <Field (NTPInfoPeer).reach>, <Field (NTPInfoPeer).unreach>, <Field (NTPInfoPeer).flash>, <Field (NTPInfoPeer).ttl>, <Field (NTPInfoPeer).flash2>, <Field (NTPInfoPeer).associd>, <Field (NTPInfoPeer).keyid>, <Field (NTPInfoPeer).pkeyid>, <Field (NTPInfoPeer).refid>, <Field (NTPInfoPeer).timer>, <Field (NTPInfoPeer).rootdelay>, <Field (NTPInfoPeer).rootdispersion>, <Field (NTPInfoPeer).reftime>, <Field (NTPInfoPeer).org>, <Field (NTPInfoPeer).rec>, <Field (NTPInfoPeer).xmt>, <Field (NTPInfoPeer).filtdelay>, <Field (NTPInfoPeer).filtoffset>, <Field (NTPInfoPeer).order>, <Field (NTPInfoPeer).delay>, <Field (NTPInfoPeer).dispersion>, <Field (NTPInfoPeer).offset>, <Field (NTPInfoPeer).selectdisp>, <Field (NTPInfoPeer).unused1>, <Field (NTPInfoPeer).unused2>, <Field (NTPInfoPeer).unused3>, <Field (NTPInfoPeer).unused4>, <Field (NTPInfoPeer).unused5>, <Field (NTPInfoPeer).unused6>, <Field (NTPInfoPeer).unused7>, <Field (NTPInfoPeer).estbdelay>, <Field (NTPInfoPeer).v6_flag>, <Field (NTPInfoPeer).unused9>, <Field (NTPInfoPeer).dstaddr6>, <Field (NTPInfoPeer).srcaddr6>]
class scapy.layers.ntp.NTPInfoPeerList

Bases: scapy.packet.Packet

Used to return raw lists of peers.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoPeerList'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoPeerList).addr>, <Field (NTPInfoPeerList).port>, <Field (NTPInfoPeerList).hmode>, <Field (NTPInfoPeerList).flags>, <Field (NTPInfoPeerList).v6_flag>, <Field (NTPInfoPeerList).unused1>, <Field (NTPInfoPeerList).addr6>]
class scapy.layers.ntp.NTPInfoPeerStats

Bases: scapy.packet.Packet

Peer statistics structure.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoPeerStats'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoPeerStats).dstaddr>, <Field (NTPInfoPeerStats).srcaddr>, <Field (NTPInfoPeerStats).srcport>, <Field (NTPInfoPeerStats).flags>, <Field (NTPInfoPeerStats).timereset>, <Field (NTPInfoPeerStats).timereceived>, <Field (NTPInfoPeerStats).timetosend>, <Field (NTPInfoPeerStats).timereachable>, <Field (NTPInfoPeerStats).sent>, <Field (NTPInfoPeerStats).unused1>, <Field (NTPInfoPeerStats).processed>, <Field (NTPInfoPeerStats).unused2>, <Field (NTPInfoPeerStats).badauth>, <Field (NTPInfoPeerStats).bogusorg>, <Field (NTPInfoPeerStats).oldpkt>, <Field (NTPInfoPeerStats).unused3>, <Field (NTPInfoPeerStats).unused4>, <Field (NTPInfoPeerStats).seldisp>, <Field (NTPInfoPeerStats).selbroken>, <Field (NTPInfoPeerStats).unused5>, <Field (NTPInfoPeerStats).candidate>, <Field (NTPInfoPeerStats).unused6>, <Field (NTPInfoPeerStats).unused7>, <Field (NTPInfoPeerStats).unused8>, <Field (NTPInfoPeerStats).v6_flag>, <Field (NTPInfoPeerStats).unused9>, <Field (NTPInfoPeerStats).dstaddr6>, <Field (NTPInfoPeerStats).srcaddr6>]
class scapy.layers.ntp.NTPInfoPeerSummary

Bases: scapy.packet.Packet

Sort of the info that ntpdc returns by default.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoPeerSummary'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoPeerSummary).dstaddr>, <Field (NTPInfoPeerSummary).srcaddr>, <Field (NTPInfoPeerSummary).srcport>, <Field (NTPInfoPeerSummary).stratum>, <Field (NTPInfoPeerSummary).hpoll>, <Field (NTPInfoPeerSummary).ppoll>, <Field (NTPInfoPeerSummary).reach>, <Field (NTPInfoPeerSummary).flags>, <Field (NTPInfoPeerSummary).hmode>, <Field (NTPInfoPeerSummary).delay>, <Field (NTPInfoPeerSummary).offset>, <Field (NTPInfoPeerSummary).dispersion>, <Field (NTPInfoPeerSummary).v6_flag>, <Field (NTPInfoPeerSummary).unused1>, <Field (NTPInfoPeerSummary).dstaddr6>, <Field (NTPInfoPeerSummary).srcaddr6>]
class scapy.layers.ntp.NTPInfoSys

Bases: scapy.packet.Packet

System info. Mostly the sys.* variables, plus a few unique to the implementation.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoSys'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoSys).peer>, <Field (NTPInfoSys).peer_mode>, <Field (NTPInfoSys).leap>, <Field (NTPInfoSys).stratum>, <Field (NTPInfoSys).precision>, <Field (NTPInfoSys).rootdelay>, <Field (NTPInfoSys).rootdispersion>, <Field (NTPInfoSys).refid>, <Field (NTPInfoSys).reftime>, <Field (NTPInfoSys).poll>, <Field (NTPInfoSys).flags>, <Field (NTPInfoSys).unused1>, <Field (NTPInfoSys).unused2>, <Field (NTPInfoSys).unused3>, <Field (NTPInfoSys).bdelay>, <Field (NTPInfoSys).frequency>, <Field (NTPInfoSys).authdelay>, <Field (NTPInfoSys).stability>, <Field (NTPInfoSys).v6_flag>, <Field (NTPInfoSys).unused4>, <Field (NTPInfoSys).peer6>]
class scapy.layers.ntp.NTPInfoSysStats

Bases: scapy.packet.Packet

System stats. These are collected in the protocol module.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoSysStats'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoSysStats).timeup>, <Field (NTPInfoSysStats).timereset>, <Field (NTPInfoSysStats).denied>, <Field (NTPInfoSysStats).oldversionpkt>, <Field (NTPInfoSysStats).newversionpkt>, <Field (NTPInfoSysStats).unknownversion>, <Field (NTPInfoSysStats).badlength>, <Field (NTPInfoSysStats).processed>, <Field (NTPInfoSysStats).badauth>, <Field (NTPInfoSysStats).received>, <Field (NTPInfoSysStats).limitrejected>]
class scapy.layers.ntp.NTPInfoTimerStats

Bases: scapy.packet.Packet

Timer stats.

aliastypes = [<class 'scapy.layers.ntp.NTPInfoTimerStats'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPInfoTimerStats).timereset>, <Field (NTPInfoTimerStats).alarms>, <Field (NTPInfoTimerStats).overflows>, <Field (NTPInfoTimerStats).xmtcalls>]
class scapy.layers.ntp.NTPPeerStatusDataPacket

Bases: scapy.packet.Packet

Packet handling the data field when op_code is CTL_OP_READSTAT and the association_id field is null.

aliastypes = [<class 'scapy.layers.ntp.NTPPeerStatusDataPacket'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPPeerStatusDataPacket).association_id>, <Field (NTPPeerStatusDataPacket).peer_status>]
class scapy.layers.ntp.NTPPeerStatusPacket

Bases: scapy.packet.Packet

Packet handling the peer status fields.

aliastypes = [<class 'scapy.layers.ntp.NTPPeerStatusPacket'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (NTPPeerStatusPacket).configured>, <Field (NTPPeerStatusPacket).auth_enabled>, <Field (NTPPeerStatusPacket).authentic>, <Field (NTPPeerStatusPacket).reachability>, <Field (NTPPeerStatusPacket).reserved>, <Field (NTPPeerStatusPacket).peer_sel>, <Field (NTPPeerStatusPacket).peer_event_counter>, <Field (NTPPeerStatusPacket).peer_event_code>]
class scapy.layers.ntp.NTPPrivate

Bases: scapy.layers.ntp.NTP

Packet handling the private (mode 7) messages.

aliastypes = [<class 'scapy.layers.ntp.NTPPrivate'>, <class 'scapy.layers.ntp.NTP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPPrivate).response>, <Field (NTPPrivate).more>, <Field (NTPPrivate).version>, <Field (NTPPrivate).mode>, <Field (NTPPrivate).auth>, <Field (NTPPrivate).seq>, <Field (NTPPrivate).implementation>, <Field (NTPPrivate).request_code>, <Field (NTPPrivate).err>, <Field (NTPPrivate).nb_items>, <Field (NTPPrivate).mbz>, <Field (NTPPrivate).data_item_size>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]
class scapy.layers.ntp.NTPPrivatePktTail

Bases: scapy.packet.Packet

include/ntp_request.h The req_pkt_tail structure is used by ntpd to adjust for different packet sizes that may arrive.

aliastypes = [<class 'scapy.layers.ntp.NTPPrivatePktTail'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPPrivatePktTail).tstamp>, <Field (NTPPrivatePktTail).key_id>, <Field (NTPPrivatePktTail).dgst>]
class scapy.layers.ntp.NTPPrivateReqPacket

Bases: scapy.packet.Packet

Packet handling request data.

aliastypes = [<class 'scapy.layers.ntp.NTPPrivateReqPacket'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (NTPPrivateReqPacket).req_data>]
class scapy.layers.ntp.NTPPrivateReqPacketListField(name, default, cls=None, count_from=None, length_from=None, next_cls_cb=None)

Bases: scapy.fields.PacketListField

Handles specific request packets.

getfield(pkt, s)

Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second the extracted field itself in internal representation.

m2i(pkt, s)

Convert machine value to internal value

class scapy.layers.ntp.NTPPrivateRespPacketListField(name, default, cls=None, count_from=None, length_from=None, next_cls_cb=None)

Bases: scapy.fields.PacketListField

PacketListField handling the response data.

getfield(pkt, s)

Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second the extracted field itself in internal representation.

m2i(pkt, s)

Convert machine value to internal value

class scapy.layers.ntp.NTPStatusPacket

Bases: scapy.packet.Packet

Packet handling a non specific status word.

aliastypes = [<class 'scapy.layers.ntp.NTPStatusPacket'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (NTPStatusPacket).status>]
class scapy.layers.ntp.NTPSystemStatusPacket

Bases: scapy.packet.Packet

Packet handling the system status fields.

aliastypes = [<class 'scapy.layers.ntp.NTPSystemStatusPacket'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (NTPSystemStatusPacket).leap_indicator>, <Field (NTPSystemStatusPacket).clock_source>, <Field (NTPSystemStatusPacket).system_event_counter>, <Field (NTPSystemStatusPacket).system_event_code>]
class scapy.layers.ntp.TimeStampField(name, default)

Bases: scapy.fields.FixedPointField

This field handles the timestamp fields in the NTP header.

any2i(pkt, val)

Try to understand the most input values possible and make an internal value from them

i2m(pkt, val)

Convert internal value to machine value

i2repr(pkt, val)

Convert internal value to a nice representation

class scapy.layers.ntp.XLEShortField(name, default)

Bases: scapy.fields.LEShortField

XShortField which value is encoded in little endian.

i2repr(pkt, x)

Convert internal value to a nice representation