scapy.contrib.eigrp module

EIGRP Scapy Extension

version:2009-08-13
copyright:2009 by Jochen Bartl
e-mail:lobo@c3a.de / jochen.bartl@gmail.com
license:GPL v2

:TODO

Known bugs:
Thanks:
  • TLV code derived from the CDP implementation of scapy. (Thanks to Nicolas Bareil and Arnaud Ebalard)
    http://trac.secdev.org/scapy/ticket/18
  • IOS / EIGRP Version Representation FIX by Dirk Loss
class scapy.contrib.eigrp.EIGRP

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.eigrp.EIGRP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRP).ver>, <Field (EIGRP).opcode>, <Field (EIGRP).chksum>, <Field (EIGRP).flags>, <Field (EIGRP).seq>, <Field (EIGRP).ack>, <Field (EIGRP).asn>, <Field (EIGRP).tlvlist>]
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.

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.contrib.eigrp.EIGRPAuthData

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPAuthData'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPAuthData).type>, <Field (EIGRPAuthData).len>, <Field (EIGRPAuthData).authtype>, <Field (EIGRPAuthData).keysize>, <Field (EIGRPAuthData).keyid>, <Field (EIGRPAuthData).nullpad>, <Field (EIGRPAuthData).authdata>]
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.contrib.eigrp.EIGRPExtRoute

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPExtRoute'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPExtRoute).type>, <Field (EIGRPExtRoute).len>, <Field (EIGRPExtRoute).nexthop>, <Field (EIGRPExtRoute).originrouter>, <Field (EIGRPExtRoute).originasn>, <Field (EIGRPExtRoute).tag>, <Field (EIGRPExtRoute).externalmetric>, <Field (EIGRPExtRoute).reserved>, <Field (EIGRPExtRoute).extprotocolid>, <Field (EIGRPExtRoute).flags>, <Field (EIGRPExtRoute).delay>, <Field (EIGRPExtRoute).bandwidth>, <Field (EIGRPExtRoute).mtu>, <Field (EIGRPExtRoute).hopcount>, <Field (EIGRPExtRoute).reliability>, <Field (EIGRPExtRoute).load>, <Field (EIGRPExtRoute).reserved2>, <Field (EIGRPExtRoute).prefixlen>, <Field (EIGRPExtRoute).dst>]
class scapy.contrib.eigrp.EIGRPGeneric

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPGeneric).type>, <Field (EIGRPGeneric).len>, <Field (EIGRPGeneric).value>]
guess_payload_class(p)

DEV: Guesses the next payload class from layer bonds. Can be overloaded to use a different mechanism.

Parameters:payload (str) – the layer’s payload
Returns:the payload class
class scapy.contrib.eigrp.EIGRPIntRoute

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPIntRoute'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPIntRoute).type>, <Field (EIGRPIntRoute).len>, <Field (EIGRPIntRoute).nexthop>, <Field (EIGRPIntRoute).delay>, <Field (EIGRPIntRoute).bandwidth>, <Field (EIGRPIntRoute).mtu>, <Field (EIGRPIntRoute).hopcount>, <Field (EIGRPIntRoute).reliability>, <Field (EIGRPIntRoute).load>, <Field (EIGRPIntRoute).reserved>, <Field (EIGRPIntRoute).prefixlen>, <Field (EIGRPIntRoute).dst>]
class scapy.contrib.eigrp.EIGRPNms

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPNms'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPNms).type>, <Field (EIGRPNms).len>, <Field (EIGRPNms).nms>]
class scapy.contrib.eigrp.EIGRPParam

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPParam'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPParam).type>, <Field (EIGRPParam).len>, <Field (EIGRPParam).k1>, <Field (EIGRPParam).k2>, <Field (EIGRPParam).k3>, <Field (EIGRPParam).k4>, <Field (EIGRPParam).k5>, <Field (EIGRPParam).reserved>, <Field (EIGRPParam).holdtime>]
class scapy.contrib.eigrp.EIGRPSeq

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPSeq'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPSeq).type>, <Field (EIGRPSeq).len>, <Field (EIGRPSeq).addrlen>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]
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.contrib.eigrp.EIGRPStub

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPStub'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPStub).type>, <Field (EIGRPStub).len>, <Field (EIGRPStub).flags>]
class scapy.contrib.eigrp.EIGRPSwVer

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPSwVer'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPSwVer).type>, <Field (EIGRPSwVer).len>, <Field (EIGRPSwVer).ios>, <Field (EIGRPSwVer).eigrp>]
class scapy.contrib.eigrp.EIGRPv6ExtRoute

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPv6ExtRoute'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPv6ExtRoute).type>, <Field (EIGRPv6ExtRoute).len>, <Field (EIGRPv6ExtRoute).nexthop>, <Field (EIGRPv6ExtRoute).originrouter>, <Field (EIGRPv6ExtRoute).originasn>, <Field (EIGRPv6ExtRoute).tag>, <Field (EIGRPv6ExtRoute).externalmetric>, <Field (EIGRPv6ExtRoute).reserved>, <Field (EIGRPv6ExtRoute).extprotocolid>, <Field (EIGRPv6ExtRoute).flags>, <Field (EIGRPv6ExtRoute).delay>, <Field (EIGRPv6ExtRoute).bandwidth>, <Field (EIGRPv6ExtRoute).mtu>, <Field (EIGRPv6ExtRoute).hopcount>, <Field (EIGRPv6ExtRoute).reliability>, <Field (EIGRPv6ExtRoute).load>, <Field (EIGRPv6ExtRoute).reserved2>, <Field (EIGRPv6ExtRoute).prefixlen>, <Field (EIGRPv6ExtRoute).dst>]
class scapy.contrib.eigrp.EIGRPv6IntRoute

Bases: scapy.contrib.eigrp.EIGRPGeneric

aliastypes = [<class 'scapy.contrib.eigrp.EIGRPv6IntRoute'>, <class 'scapy.contrib.eigrp.EIGRPGeneric'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIGRPv6IntRoute).type>, <Field (EIGRPv6IntRoute).len>, <Field (EIGRPv6IntRoute).nexthop>, <Field (EIGRPv6IntRoute).delay>, <Field (EIGRPv6IntRoute).bandwidth>, <Field (EIGRPv6IntRoute).mtu>, <Field (EIGRPv6IntRoute).hopcount>, <Field (EIGRPv6IntRoute).reliability>, <Field (EIGRPv6IntRoute).load>, <Field (EIGRPv6IntRoute).reserved>, <Field (EIGRPv6IntRoute).prefixlen>, <Field (EIGRPv6IntRoute).dst>]
class scapy.contrib.eigrp.EigrpIP6Field(name, default, length=None, length_from=None)

Bases: scapy.fields.StrField, scapy.fields.IP6Field

This is a special field type for handling ip addresses of destination networks in internal and external route updates.

any2i(pkt, x)

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

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.

h2i(pkt, x)

Convert human value to internal value

i2len(pkt, x)

Convert internal value to a length usable by a FieldLenField

i2m(pkt, x)

Convert internal value to machine value

i2repr(pkt, x)

Convert internal value to a nice representation

length_from
m2i(pkt, x)

Convert machine value to internal value

prefixlen_to_bytelen(plen)
randval()

Return a volatile object whose value is both random and suitable for this field

class scapy.contrib.eigrp.EigrpIPField(name, default, length=None, length_from=None)

Bases: scapy.fields.StrField, scapy.fields.IPField

This is a special field type for handling ip addresses of destination networks in internal and external route updates.

EIGRP removes zeros from the host portion of the ip address if the netmask is 8, 16 or 24 bits.

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.

h2i(pkt, x)

Convert human value to internal value

i2len(pkt, x)

Convert internal value to a length usable by a FieldLenField

i2m(pkt, x)

Convert internal value to machine value

length_from
m2i(pkt, x)

Convert machine value to internal value

prefixlen_to_bytelen(tmp_len)
randval()

Return a volatile object whose value is both random and suitable for this field

class scapy.contrib.eigrp.RepeatedTlvListField(name, default, cls)

Bases: scapy.fields.PacketListField

addfield(pkt, s, val)

Add an internal value to a string

Copy the network representation of field val (belonging to layer pkt) to the raw string packet s, and return the new string packet.

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.

class scapy.contrib.eigrp.ShortVersionField(name, default)

Bases: scapy.fields.ShortField

h2i(pkt, x)

The field accepts string values like v12.1, v1.1 or integer values. String values have to start with a “v” folled by a floating point number. Valid numbers are between 0 and 255.

i2repr(pkt, x)

Convert internal value to a nice representation

randval()

Return a volatile object whose value is both random and suitable for this field