scapy.contrib.ospf

Scapy的OSPF扩展< http://www.secdev.org/scapy >

此模块为RFC 2328和RFC 5340中定义的开放式最短路径优先路由协议提供Scapy层.

版权所有(c)2008 Dirk Loss:邮件dirk-loss版权所有(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字段

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字段

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字段

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

链接状态广告的抽象基类

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

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPF_DBDesc字段

mtu

ShortField

1500

options

OSPFOptionsField (8位)

<Flag 0 ()>

dbdescr

FlagsField (8位)

<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字段

age

ShortField

1

options

OSPFOptionsField (8位)

<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位)

<Flag 0 ()>

reserved

BitField (7位)

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字段

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

可能的子层: OSPF_DBDescOSPF_HelloOSPF_LSAckOSPF_LSReqOSPF_LSUpd

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

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPF_Hello字段

mask

IPField

'255.255.255.0'

hellointerval

ShortField

10

options

OSPFOptionsField (8位)

<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字段

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字段

age

ShortField

1

options

OSPFOptionsField (8位)

<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字段

lsaheaders

PacketListField

[]

class scapy.contrib.ospf.OSPF_LSReq

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPF_LSReq字段

requests

PacketListField

[]

class scapy.contrib.ospf.OSPF_LSReq_Item

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPF_LSReq_Item字段

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字段

lsacount

FieldLenField

None

lsalist

PacketListField

[]

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPF_Link字段

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字段

age

ShortField

1

options

OSPFOptionsField (8位)

<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位)

<Flag 0 ()>

reserved

BitField (7位)

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字段

age

ShortField

1

options

OSPFOptionsField (8位)

<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字段

age

ShortField

1

options

OSPFOptionsField (8位)

<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位)

<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字段

age

ShortField

1

options

OSPFOptionsField (8位)

<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字段

age

ShortField

1

options

OSPFOptionsField (8位)

<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字段

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位)

<Flag 0 ()>

metric

X3BytesField

20

prefixlen

FieldLenField

None

prefixoptions

OSPFv3PrefixOptionsField (8位)

<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字段

reserved

ByteField

0

options

OSPFv3OptionsField (24位)

<Flag 0 ()>

mtu

ShortField

1500

reserved2

ByteField

0

dbdescr

FlagsField (8位)

<Flag 0 ()>

ddseq

IntField

1

lsaheaders

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_Hdr

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_Hdr字段

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

可能的子层: OSPFv3_DBDescOSPFv3_HelloOSPFv3_LSAckOSPFv3_LSReqOSPFv3_LSUpd

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

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_Hello字段

intid

IntField

0

prio

ByteField

1

options

OSPFv3OptionsField (24位)

<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字段

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字段

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位)

<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字段

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字段

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字段

lsaheaders

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_LSReq

Bases: scapy.packet.Packet

aliastypes
fields_desc
OSPFv3_LSReq字段

requests

PacketListField

[]

class scapy.contrib.ospf.OSPFv3_LSReq_Item

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPFv3_LSReq_Item字段

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字段

lsacount

FieldLenField

None

lsalist

PacketListField

[]

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPFv3_Link字段

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字段

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位)

<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字段

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位)

<Flag 0 ()>

routerlist

FieldListField

[]

class scapy.contrib.ospf.OSPFv3_Prefix_Item

Bases: scapy.packet.Packet

aliastypes
extract_padding(s)
fields_desc
OSPFv3_Prefix_Item字段

prefixlen

FieldLenField

None

prefixoptions

OSPFv3PrefixOptionsField (8位)

<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字段

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位)

<Flag 0 ()>

options

OSPFv3OptionsField (24位)

<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字段

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位)

<Flag 0 ()>

metric

X3BytesField

20

prefixlen

FieldLenField

None

prefixoptions

OSPFv3PrefixOptionsField (8位)

<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)