scapy.contrib.ospf

OSPF extension for Scapy <http://www.secdev.org/scapy>

This module provides Scapy layers for the Open Shortest Path First routing protocol as defined in RFC 2328 and RFC 5340.

Copyright (c) 2008 Dirk Loss : mail dirk-loss de Copyright (c) 2010 Jochen Bartl : jochen.bartl gmail com

class scapy.contrib.ospf.FieldLenField32Bits(name, default, length_of=None, fmt='H', count_of=None, adjust=<function FieldLenField.<lambda>>, fld=None)

Bases: scapy.fields.FieldLenField

i2repr(pkt, x)
class scapy.contrib.ospf.LLS_Crypto_Auth

Bases: scapy.contrib.ospf.LLS_Generic_TLV

aliastypes
fields_desc
LLS_Crypto_Auth fields

type

ShortField

2

len

FieldLenField

20

sequence

XIntField

0

authdata

StrLenField

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

class scapy.contrib.ospf.LLS_Extended_Options

Bases: scapy.contrib.ospf.LLS_Generic_TLV

aliastypes
fields_desc
LLS_Extended_Options fields

type

ShortField

1

len

FieldLenField

None

options

StrLenField

b''

class scapy.contrib.ospf.LLS_Generic_TLV

Bases: scapy.packet.Packet

aliastypes
fields_desc
LLS_Generic_TLV fields

type

ShortField

0

len

FieldLenField

None

val

StrLenField

b''

guess_payload_class(p)
class scapy.contrib.ospf.OSPFOptionsField(name='options', default=0, size=8, names=None)

Bases: scapy.fields.FlagsField

class scapy.contrib.ospf.OSPF_BaseLSA

Bases: scapy.packet.Packet

An abstract base class for Link State Advertisements

aliastypes
extract_padding(s)
post_build(p, pay)
class scapy.contrib.ospf.OSPF_DBDesc

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPF_DBDesc fields

mtu

ShortField

1500

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

dbdescr

FlagsField (8 bits)

<Flag 0 ()>

ddseq

IntField

1

lsaheaders

PacketListField

[]

guess_payload_class(payload)
class scapy.contrib.ospf.OSPF_External_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPF_External_LSA fields

age

ShortField

1

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

type

ByteField

5

id

IPField

'192.168.0.0'

adrouter

IPField

'2.2.2.2'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

mask

IPField

'255.255.255.0'

ebit

FlagsField (1 bit)

<Flag 0 ()>

reserved

BitField (7 bits)

0

metric

X3BytesField

20

fwdaddr

IPField

'0.0.0.0'

tag

XIntField

0

tos

ByteField (Cond)

0

tosmetric

X3BytesField (Cond)

0

class scapy.contrib.ospf.OSPF_Hdr

Bases: scapy.packet.Packet

aliastypes
answers(other)
fields_desc
OSPF_Hdr fields

version

ByteField

2

type

ByteEnumField

1

len

_NoLLSLenField

None

src

IPField

'1.1.1.1'

area

IPField

'0.0.0.0'

chksum

XShortField

None

authtype

ShortEnumField

0

authdata

XLongField (Cond)

0

reserved

XShortField (Cond)

0

keyid

ByteField (Cond)

1

authdatalen

ByteField (Cond)

0

seq

XIntField (Cond)

0

hashret()
payload_guess

Possible sublayers: OSPF_DBDesc, OSPF_Hello, OSPF_LSAck, OSPF_LSReq, OSPF_LSUpd

post_build(p, pay)
class scapy.contrib.ospf.OSPF_Hello

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPF_Hello fields

mask

IPField

'255.255.255.0'

hellointerval

ShortField

10

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

prio

ByteField

1

deadinterval

IntField

40

router

IPField

'0.0.0.0'

backup

IPField

'0.0.0.0'

neighbors

FieldListField

[]

guess_payload_class(payload)
class scapy.contrib.ospf.OSPF_LLS_Hdr

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPF_LLS_Hdr fields

chksum

XShortField

None

len

FieldLenField32Bits

None

llstlv

PacketListField

[]

post_build(p, pay)
class scapy.contrib.ospf.OSPF_LSA_Hdr

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPF_LSA_Hdr fields

age

ShortField

1

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

type

ByteEnumField

1

id

IPField

'192.168.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

0

len

ShortField

36

class scapy.contrib.ospf.OSPF_LSAck

Bases: scapy.packet.Packet

aliastypes
answers(other)
fields_desc
OSPF_LSAck fields

lsaheaders

PacketListField

[]

class scapy.contrib.ospf.OSPF_LSReq

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPF_LSReq fields

requests

PacketListField

[]

class scapy.contrib.ospf.OSPF_LSReq_Item

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPF_LSReq_Item fields

type

IntEnumField

1

id

IPField

'1.1.1.1'

adrouter

IPField

'1.1.1.1'

class scapy.contrib.ospf.OSPF_LSUpd

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPF_LSUpd fields

lsacount

FieldLenField

None

lsalist

PacketListField

[]

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPF_Link fields

id

IPField

'192.168.0.0'

data

IPField

'255.255.255.0'

type

ByteEnumField

3

toscount

ByteField

0

metric

ShortField

10

tos

ByteField (Cond)

0

reserved

ByteField (Cond)

0

tosmetric

ShortField (Cond)

0

class scapy.contrib.ospf.OSPF_NSSA_External_LSA

Bases: scapy.contrib.ospf.OSPF_External_LSA

aliastypes
fields_desc
OSPF_NSSA_External_LSA fields

age

ShortField

1

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

type

ByteField

7

id

IPField

'192.168.0.0'

adrouter

IPField

'2.2.2.2'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

mask

IPField

'255.255.255.0'

ebit

FlagsField (1 bit)

<Flag 0 ()>

reserved

BitField (7 bits)

0

metric

X3BytesField

20

fwdaddr

IPField

'0.0.0.0'

tag

XIntField

0

tos

ByteField (Cond)

0

tosmetric

X3BytesField (Cond)

0

class scapy.contrib.ospf.OSPF_Network_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPF_Network_LSA fields

age

ShortField

1

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

type

ByteField

2

id

IPField

'192.168.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

mask

IPField

'255.255.255.0'

routerlist

FieldListField

[]

class scapy.contrib.ospf.OSPF_Router_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPF_Router_LSA fields

age

ShortField

1

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

type

ByteField

1

id

IPField

'1.1.1.1'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

flags

FlagsField (8 bits)

<Flag 0 ()>

reserved

ByteField

0

linkcount

FieldLenField

None

linklist

PacketListField

[]

class scapy.contrib.ospf.OSPF_SummaryASBR_LSA

Bases: scapy.contrib.ospf.OSPF_SummaryIP_LSA

aliastypes
fields_desc
OSPF_SummaryASBR_LSA fields

age

ShortField

1

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

type

ByteField

4

id

IPField

'2.2.2.2'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

mask

IPField

'0.0.0.0'

reserved

ByteField

0

metric

X3BytesField

20

tos

ByteField (Cond)

0

tosmetric

X3BytesField (Cond)

0

class scapy.contrib.ospf.OSPF_SummaryIP_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPF_SummaryIP_LSA fields

age

ShortField

1

options

OSPFOptionsField (8 bits)

<Flag 0 ()>

type

ByteField

3

id

IPField

'192.168.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

mask

IPField

'255.255.255.0'

reserved

ByteField

0

metric

X3BytesField

10

tos

ByteField (Cond)

0

tosmetric

X3BytesField (Cond)

0

class scapy.contrib.ospf.OSPFv3OptionsField(name='options', default=0, size=24, names=None)

Bases: scapy.fields.FlagsField

class scapy.contrib.ospf.OSPFv3PrefixOptionsField(name='prefixoptions', default=0, size=8, names=None)

Bases: scapy.fields.FlagsField

class scapy.contrib.ospf.OSPFv3_AS_External_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPFv3_AS_External_LSA fields

age

ShortField

1

type

ShortEnumField

16389

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

flags

FlagsField (8 bits)

<Flag 0 ()>

metric

X3BytesField

20

prefixlen

FieldLenField

None

prefixoptions

OSPFv3PrefixOptionsField (8 bits)

<Flag 0 ()>

reflstype

ShortEnumField

0

prefix

IP6PrefixField

('2001:db8:0:42::', 64)

fwaddr

IP6Field (Cond)

'::'

tag

IntField (Cond)

0

reflsid

IPField (Cond)

0

class scapy.contrib.ospf.OSPFv3_DBDesc

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_DBDesc fields

reserved

ByteField

0

options

OSPFv3OptionsField (24 bits)

<Flag 0 ()>

mtu

ShortField

1500

reserved2

ByteField

0

dbdescr

FlagsField (8 bits)

<Flag 0 ()>

ddseq

IntField

1

lsaheaders

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_Hdr

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_Hdr fields

version

ByteField

3

type

ByteEnumField

1

len

ShortField

None

src

IPField

'1.1.1.1'

area

IPField

'0.0.0.0'

chksum

XShortField

None

instance

ByteField

0

reserved

ByteField

0

payload_guess

Possible sublayers: OSPFv3_DBDesc, OSPFv3_Hello, OSPFv3_LSAck, OSPFv3_LSReq, OSPFv3_LSUpd

post_build(p, pay)
class scapy.contrib.ospf.OSPFv3_Hello

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_Hello fields

intid

IntField

0

prio

ByteField

1

options

OSPFv3OptionsField (24 bits)

<Flag 0 ()>

hellointerval

ShortField

10

deadinterval

ShortField

40

router

IPField

'0.0.0.0'

backup

IPField

'0.0.0.0'

neighbors

FieldListField

[]

class scapy.contrib.ospf.OSPFv3_Inter_Area_Prefix_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPFv3_Inter_Area_Prefix_LSA fields

age

ShortField

1

type

ShortEnumField

8195

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

reserved

ByteField

0

metric

X3BytesField

10

prefixlen

FieldLenField

None

prefixoptions

OSPFv3PrefixOptionsField (8 bits)

<Flag 0 ()>

reserved2

ShortField

0

prefix

IP6PrefixField

('2001:db8:0:42::', 64)

class scapy.contrib.ospf.OSPFv3_Inter_Area_Router_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPFv3_Inter_Area_Router_LSA fields

age

ShortField

1

type

ShortEnumField

8196

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

reserved

ByteField

0

options

OSPFv3OptionsField (24 bits)

<Flag 0 ()>

reserved2

ByteField

0

metric

X3BytesField

1

router

IPField

'2.2.2.2'

class scapy.contrib.ospf.OSPFv3_Intra_Area_Prefix_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPFv3_Intra_Area_Prefix_LSA fields

age

ShortField

1

type

ShortEnumField

8201

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

prefixes

FieldLenField

None

reflstype

ShortEnumField

0

reflsid

IPField

'0.0.0.0'

refadrouter

IPField

'0.0.0.0'

prefixlist

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_LSA_Hdr

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPFv3_LSA_Hdr fields

age

ShortField

1

type

ShortEnumField

8193

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

0

len

ShortField

36

class scapy.contrib.ospf.OSPFv3_LSAck

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_LSAck fields

lsaheaders

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_LSReq

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_LSReq fields

requests

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_LSReq_Item

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPFv3_LSReq_Item fields

reserved

ShortField

0

type

ShortEnumField

8193

id

IPField

'1.1.1.1'

adrouter

IPField

'1.1.1.1'

class scapy.contrib.ospf.OSPFv3_LSUpd

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_LSUpd fields

lsacount

FieldLenField

None

lsalist

PacketListField

[]

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPFv3_Link fields

type

ByteEnumField

1

reserved

ByteField

0

metric

ShortField

10

intid

IntField

0

neighintid

IntField

0

neighbor

IPField

'2.2.2.2'

Bases: scapy.contrib.ospf.OSPF_BaseLSA

OSPFv3_Link_LSA fields

age

ShortField

1

type

ShortEnumField

8

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

prio

ByteField

1

options

OSPFv3OptionsField (24 bits)

<Flag 0 ()>

lladdr

IP6Field

'fe80::'

prefixes

FieldLenField

None

prefixlist

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_Network_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPFv3_Network_LSA fields

age

ShortField

1

type

ShortEnumField

8194

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

reserved

ByteField

0

options

OSPFv3OptionsField (24 bits)

<Flag 0 ()>

routerlist

FieldListField

[]

class scapy.contrib.ospf.OSPFv3_Prefix_Item

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPFv3_Prefix_Item fields

prefixlen

FieldLenField

None

prefixoptions

OSPFv3PrefixOptionsField (8 bits)

<Flag 0 ()>

metric

ShortField

10

prefix

IP6PrefixField

('2001:db8:0:42::', 64)

class scapy.contrib.ospf.OSPFv3_Router_LSA

Bases: scapy.contrib.ospf.OSPF_BaseLSA

aliastypes
fields_desc
OSPFv3_Router_LSA fields

age

ShortField

1

type

ShortEnumField

8193

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

flags

FlagsField (8 bits)

<Flag 0 ()>

options

OSPFv3OptionsField (24 bits)

<Flag 0 ()>

linklist

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_Type_7_LSA

Bases: scapy.contrib.ospf.OSPFv3_AS_External_LSA

aliastypes
fields_desc
OSPFv3_Type_7_LSA fields

age

ShortField

1

type

ShortEnumField

8199

id

IPField

'0.0.0.0'

adrouter

IPField

'1.1.1.1'

seq

XIntField

2147483649

chksum

XShortField

None

len

ShortField

None

flags

FlagsField (8 bits)

<Flag 0 ()>

metric

X3BytesField

20

prefixlen

FieldLenField

None

prefixoptions

OSPFv3PrefixOptionsField (8 bits)

<Flag 0 ()>

reflstype

ShortEnumField

0

prefix

IP6PrefixField

('2001:db8:0:42::', 64)

fwaddr

IP6Field (Cond)

'::'

tag

IntField (Cond)

0

reflsid

IPField (Cond)

0

scapy.contrib.ospf.ospf_lsa_checksum(lsa)