scapy.contrib.vtp module

VTP Scapy Extension

version:

2009-02-15

copyright:

2009 by Jochen Bartl

e-mail:

lobo@c3a.de / jochen.bartl@gmail.com

license:

GPL v2

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

TODO:
  • Join messages

  • RE MD5 hash calculation

  • Have a closer look at 8 byte padding in summary adv:

    “debug sw-vlan vtp packets” says the TLV length is invalid, when I change the values:

    b'\x00\x00\x00\x01\x06\x01\x00\x02'

    • x00x00 ?
    • x00x01 tlvtype?
    • x06 length?
    • x00x02 value?
  • h2i function for VTPTimeStampField

References:
class scapy.contrib.vtp.VTP

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.vtp.VTP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (VTP).ver>, <Field (VTP).code>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (VTP).domnamelen>, <Field (VTP).domname>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <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.vtp.VTPTimeStampField(name, default)

Bases: scapy.fields.StrFixedLenField

i2repr(pkt, x)

Convert internal value to a nice representation

class scapy.contrib.vtp.VTPVlanInfo

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.vtp.VTPVlanInfo'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (VTPVlanInfo).len>, <Field (VTPVlanInfo).status>, <Field (VTPVlanInfo).type>, <Field (VTPVlanInfo).vlannamelen>, <Field (VTPVlanInfo).vlanid>, <Field (VTPVlanInfo).mtu>, <Field (VTPVlanInfo).dot10index>, <Field (VTPVlanInfo).vlanname>, <scapy.fields.ConditionalField object>]
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
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.vtp.VTPVlanInfoTlv

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.vtp.VTPVlanInfoTlv'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (VTPVlanInfoTlv).type>, <Field (VTPVlanInfoTlv).length>, <Field (VTPVlanInfoTlv).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