scapy.contrib.vtp

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(_pkt, /, *, ver=2, code=1, followers=1, seq=1, reserved=0, domnamelen=None, domname=b'manbearpig', rev=0, uid='192.168.0.1', timestamp=b'930301000000', md5=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', vlaninfo=[], startvalue=0)[源代码]

基类:Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      VER      |      CODE     |   FOLLOWERS   |      SEQ      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    RESERVED   |   DOMNAMELEN  |            DOMNAME            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |              REV              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |              UID              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |           TIMESTAMP           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
|                                                               |
+                                                               +
|                                                               |
+                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |              MD5              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |            VLANINFO           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           STARTVALUE          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                             Fig. VTP                             
VTP fields

ver

ByteField

2

code

ByteEnumField

1

followers

ByteField (Cond)

1

seq

ByteField (Cond)

1

reserved

ByteField (Cond)

0

domnamelen

ByteField

None

domname

StrFixedLenField

b'manbearpig'

rev

SignedIntField (Cond)

0

uid

IPField (Cond)

'192.168.0.1'

timestamp

VTPTimeStampField (Cond)

b'930301000000'

md5

StrFixedLenField (Cond)

b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

vlaninfo

PacketListField (Cond)

[]

startvalue

ShortField (Cond)

0

post_build(p, pay)[源代码]
class scapy.contrib.vtp.VTPTimeStampField(name, default)[源代码]

基类:StrFixedLenField

i2repr(pkt, x)[源代码]
class scapy.contrib.vtp.VTPVlanInfo(_pkt, /, *, len=None, status=0, type=1, vlannamelen=None, vlanid=1, mtu=1500, dot10index=None, vlanname=b'default', tlvlist=[])[源代码]

基类:Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      LEN      |     STATUS    |      TYPE     |  VLANNAMELEN  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             VLANID            |              MTU              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           DOT10INDEX                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            VLANNAME           |            TLVLIST            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. VTPVlanInfo                         
VTPVlanInfo fields

len

ByteField

None

status

ByteEnumField

0

type

ByteEnumField

1

vlannamelen

FieldLenField

None

vlanid

ShortField

1

mtu

ShortField

1500

dot10index

XIntField

None

vlanname

StrLenField

b'default'

tlvlist

PacketListField (Cond)

[]

guess_payload_class(p)[源代码]
post_build(p, pay)[源代码]
class scapy.contrib.vtp.VTPVlanInfoTlv(_pkt, /, *, type=0, length=0, value=None)[源代码]

基类:Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      TYPE     |     LENGTH    |             VALUE             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                       Fig. VTPVlanInfoTlv                        
VTPVlanInfoTlv fields

type

ByteEnumField

0

length

ByteField

0

value

StrLenField

None

guess_payload_class(p)[源代码]