scapy.layers.inet6

IPv6 (Internet Protocol v6).

class scapy.layers.inet6.AS_resolver6(server=None, port=43, options=None)

Bases: scapy.as_resolvers.AS_resolver_riswhois

class scapy.layers.inet6.DomainNameListField(name, default, fld=None, length_from=None, padded=False)

Bases: scapy.fields.StrLenField

i2len(pkt, x)
i2m(pkt, x)
islist = 1
m2i(pkt, x)
padded
padded_unit = 8
class scapy.layers.inet6.HAO

Bases: scapy.packet.Packet

aliastypes
alignment_delta(curpos)
extract_padding(p)
fields_desc
HAO fields

otype

_OTypeField

201

optlen

ByteField

16

hoa

IP6Field

'::'

class scapy.layers.inet6.HBHOptUnknown

Bases: scapy.packet.Packet

aliastypes
alignment_delta(curpos)

As specified in section 4.2 of RFC 2460, every options has an alignment requirement usually expressed xn+y, meaning the Option Type must appear at an integer multiple of x octest from the start of the header, plus y octet.

That function is provided the current position from the start of the header and returns required padding length.

classmethod dispatch_hook(_pkt=None, *args, **kargs)
extract_padding(p)
fields_desc
HBHOptUnknown fields

otype

_OTypeField

1

optlen

FieldLenField

None

optdata

StrLenField

b''

class scapy.layers.inet6.ICMPv6DestUnreach

Bases: scapy.layers.inet6._ICMPv6Error

aliastypes
fields_desc
ICMPv6DestUnreach fields

type

ByteEnumField

1

code

ByteEnumField

0

cksum

XShortField

None

length

ByteField

0

unused

X3BytesField

0

post_dissection(pkt)
class scapy.layers.inet6.ICMPv6EchoReply

Bases: scapy.layers.inet6.ICMPv6EchoRequest

aliastypes
answers(other)
fields_desc
ICMPv6EchoReply fields

type

ByteEnumField

129

code

ByteField

0

cksum

XShortField

None

id

XShortField

0

seq

XShortField

0

data

StrField

b''

class scapy.layers.inet6.ICMPv6EchoRequest

Bases: scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6EchoRequest fields

type

ByteEnumField

128

code

ByteField

0

cksum

XShortField

None

id

XShortField

0

seq

XShortField

0

data

StrField

b''

hashret()
mysummary()
class scapy.layers.inet6.ICMPv6HAADReply

Bases: scapy.layers.inet6._ICMPv6

aliastypes
answers(other)
fields_desc
ICMPv6HAADReply fields

type

ByteEnumField

145

code

ByteField

0

cksum

XShortField

None

id

XShortField

None

R

BitEnumField (1 bit)

1

res

XBitField (15 bits)

0

addresses

IP6ListField

[]

hashret()
class scapy.layers.inet6.ICMPv6HAADRequest

Bases: scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6HAADRequest fields

type

ByteEnumField

144

code

ByteField

0

cksum

XShortField

None

id

XShortField

None

R

BitEnumField (1 bit)

1

res

XBitField (15 bits)

0

hashret()
class scapy.layers.inet6.ICMPv6MLDMultAddrRec

Bases: scapy.packet.Packet

aliastypes
default_payload_class(packet)

Multicast Address Record followed by another one

fields_desc
ICMPv6MLDMultAddrRec fields

rtype

ByteField

4

auxdata_len

FieldLenField

None

sources_number

FieldLenField

None

dst

IP6Field

'::'

sources

IP6ListField

[]

auxdata

StrLenField

b''

class scapy.layers.inet6.ICMPv6MLDone

Bases: scapy.layers.inet6._ICMPv6ML

aliastypes
fields_desc
ICMPv6MLDone fields

type

ByteEnumField

132

code

ByteField

0

cksum

XShortField

None

mrd

ShortField

0

reserved

ShortField

0

mladdr

IP6Field

'::'

class scapy.layers.inet6.ICMPv6MLQuery

Bases: scapy.layers.inet6._ICMPv6ML

aliastypes
fields_desc
ICMPv6MLQuery fields

type

ByteEnumField

130

code

ByteField

0

cksum

XShortField

None

mrd

ShortField

10000

reserved

ShortField

0

mladdr

IP6Field

'::'

class scapy.layers.inet6.ICMPv6MLQuery2

Bases: scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6MLQuery2 fields

type

ByteEnumField

130

code

ByteField

0

cksum

XShortField

None

mrd

ShortField

10000

reserved

ShortField

0

mladdr

IP6Field

'::'

Resv

BitField (4 bits)

0

S

BitField (1 bit)

0

QRV

BitField (3 bits)

0

QQIC

ByteField

0

sources_number

ShortField

None

sources

IP6ListField

[]

post_build(packet, payload)

Compute the ‘sources_number’ field when needed

class scapy.layers.inet6.ICMPv6MLReport

Bases: scapy.layers.inet6._ICMPv6ML

aliastypes
answers(query)

Check the query type

fields_desc
ICMPv6MLReport fields

type

ByteEnumField

131

code

ByteField

0

cksum

XShortField

None

mrd

ShortField

0

reserved

ShortField

0

mladdr

IP6Field

'::'

class scapy.layers.inet6.ICMPv6MLReport2

Bases: scapy.layers.inet6._ICMPv6

aliastypes
answers(query)

Check the query type

fields_desc
ICMPv6MLReport2 fields

type

ByteEnumField

143

res

ByteField

0

cksum

XShortField

None

reserved

ShortField

0

records_number

ShortField

None

records

PacketListField

[]

post_build(packet, payload)

Compute the ‘records_number’ field when needed

class scapy.layers.inet6.ICMPv6MPAdv

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.layers.inet6._ICMPv6

aliastypes
answers(other)
fields_desc
ICMPv6MPAdv fields

type

ByteEnumField

147

code

ByteField

0

cksum

XShortField

None

id

XShortField

None

flags

BitEnumField (2 bits)

2

res

XBitField (14 bits)

0

hashret()
class scapy.layers.inet6.ICMPv6MPSol

Bases: scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6MPSol fields

type

ByteEnumField

146

code

ByteField

0

cksum

XShortField

None

id

XShortField

None

res

XShortField

0

class scapy.layers.inet6.ICMPv6MRD_Advertisement

Bases: scapy.layers.inet6._ICMPv6

aliastypes
extract_padding(s)
fields_desc
ICMPv6MRD_Advertisement fields

type

ByteEnumField

151

advinter

ByteField

20

cksum

XShortField

None

queryint

ShortField

0

robustness

ShortField

0

class scapy.layers.inet6.ICMPv6MRD_Solicitation

Bases: scapy.layers.inet6._ICMPv6

aliastypes
extract_padding(s)
fields_desc
ICMPv6MRD_Solicitation fields

type

ByteEnumField

152

res

ByteField

0

cksum

XShortField

None

class scapy.layers.inet6.ICMPv6MRD_Termination

Bases: scapy.layers.inet6._ICMPv6

aliastypes
extract_padding(s)
fields_desc
ICMPv6MRD_Termination fields

type

ByteEnumField

153

res

ByteField

0

cksum

XShortField

None

class scapy.layers.inet6.ICMPv6NDOptAdvInterval

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptAdvInterval fields

type

ByteField

7

len

ByteField

1

res

ShortField

0

advint

IntField

0

mysummary()
class scapy.layers.inet6.ICMPv6NDOptDNSSL

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptDNSSL fields

type

ByteField

31

len

FieldLenField

None

res

ShortField

None

lifetime

IntField

4294967295

searchlist

DomainNameListField

[]

mysummary()
class scapy.layers.inet6.ICMPv6NDOptDstLLAddr

Bases: scapy.layers.inet6.ICMPv6NDOptSrcLLAddr

aliastypes
fields_desc
ICMPv6NDOptDstLLAddr fields

type

ByteField

2

len

ByteField

1

lladdr

MACField

'00:00:00:00:00:00'

class scapy.layers.inet6.ICMPv6NDOptEFA

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptEFA fields

type

ByteField

26

len

ByteField

1

res

BitField (48 bits)

0

class scapy.layers.inet6.ICMPv6NDOptHAInfo

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptHAInfo fields

type

ByteField

8

len

ByteField

1

res

ShortField

0

pref

ShortField

0

lifetime

ShortField

1

mysummary()
class scapy.layers.inet6.ICMPv6NDOptIPAddr

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptIPAddr fields

type

ByteField

17

len

ByteField

3

optcode

ByteEnumField

1

plen

ByteField

64

res

IntField

0

addr

IP6Field

'::'

class scapy.layers.inet6.ICMPv6NDOptLLA

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptLLA fields

type

ByteField

19

len

ByteField

1

optcode

ByteEnumField

0

lla

MACField

'00:00:00:00:00:00'

class scapy.layers.inet6.ICMPv6NDOptMAP

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptMAP fields

type

ByteField

23

len

ByteField

3

dist

BitField (4 bits)

1

pref

BitField (4 bits)

15

R

BitField (1 bit)

1

res

BitField (7 bits)

0

validlifetime

IntField

4294967295

addr

IP6Field

'::'

class scapy.layers.inet6.ICMPv6NDOptMTU

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptMTU fields

type

ByteField

5

len

ByteField

1

res

XShortField

0

mtu

IntField

1280

mysummary()
class scapy.layers.inet6.ICMPv6NDOptNewRtrPrefix

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptNewRtrPrefix fields

type

ByteField

18

len

ByteField

3

optcode

ByteField

0

plen

ByteField

64

res

IntField

0

prefix

IP6Field

'::'

class scapy.layers.inet6.ICMPv6NDOptPrefixInfo

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptPrefixInfo fields

type

ByteField

3

len

ByteField

4

prefixlen

ByteField

None

L

BitField (1 bit)

1

A

BitField (1 bit)

1

R

BitField (1 bit)

0

res1

BitField (5 bits)

0

validlifetime

XIntField

4294967295

preferredlifetime

XIntField

4294967295

res2

XIntField

0

prefix

IP6Field

'::'

mysummary()
class scapy.layers.inet6.ICMPv6NDOptRDNSS

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptRDNSS fields

type

ByteField

25

len

FieldLenField

None

res

ShortField

None

lifetime

IntField

4294967295

dns

IP6ListField

[]

mysummary()
class scapy.layers.inet6.ICMPv6NDOptRedirectedHdr

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptRedirectedHdr fields

type

ByteField

4

len

FieldLenField

None

res

StrFixedLenField

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

pkt

TruncPktLenField

b''

class scapy.layers.inet6.ICMPv6NDOptRouteInfo

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptRouteInfo fields

type

ByteField

24

len

FieldLenField

None

plen

ByteField

None

res1

BitField (3 bits)

0

prf

BitEnumField (2 bits)

0

res2

BitField (3 bits)

0

rtlifetime

IntField

4294967295

prefix

_IP6PrefixField

None

mysummary()
class scapy.layers.inet6.ICMPv6NDOptShortcutLimit

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptShortcutLimit fields

type

ByteField

6

len

ByteField

1

shortcutlim

ByteField

40

res1

ByteField

0

res2

IntField

0

class scapy.layers.inet6.ICMPv6NDOptSrcAddrList

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptSrcAddrList fields

type

ByteField

9

len

FieldLenField

None

res

StrFixedLenField

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

addrlist

IP6ListField

[]

class scapy.layers.inet6.ICMPv6NDOptSrcLLAddr

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptSrcLLAddr fields

type

ByteField

1

len

ByteField

1

lladdr

MACField

'00:00:00:00:00:00'

mysummary()
class scapy.layers.inet6.ICMPv6NDOptTgtAddrList

Bases: scapy.layers.inet6.ICMPv6NDOptSrcAddrList

aliastypes
fields_desc
ICMPv6NDOptTgtAddrList fields

type

ByteField

10

len

FieldLenField

None

res

StrFixedLenField

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

addrlist

IP6ListField

[]

class scapy.layers.inet6.ICMPv6NDOptUnknown

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6NDOptUnknown fields

type

ByteField

None

len

FieldLenField

None

data

StrLenField

b''

class scapy.layers.inet6.ICMPv6ND_INDAdv

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6ND_INDAdv fields

type

ByteEnumField

142

code

ByteField

0

cksum

XShortField

None

reserved

XIntField

0

class scapy.layers.inet6.ICMPv6ND_INDSol

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6ND_INDSol fields

type

ByteEnumField

141

code

ByteField

0

cksum

XShortField

None

reserved

XIntField

0

class scapy.layers.inet6.ICMPv6ND_NA

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.layers.inet6._ICMPv6, scapy.packet.Packet

aliastypes
answers(other)
fields_desc
ICMPv6ND_NA fields

type

ByteEnumField

136

code

ByteField

0

cksum

XShortField

None

R

BitField (1 bit)

1

S

BitField (1 bit)

0

O

BitField (1 bit)

1

res

XBitField (29 bits)

0

tgt

IP6Field

'::'

hashret()
mysummary()
class scapy.layers.inet6.ICMPv6ND_NS

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.layers.inet6._ICMPv6, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6ND_NS fields

type

ByteEnumField

135

code

ByteField

0

cksum

XShortField

None

res

IntField

0

tgt

IP6Field

'::'

hashret()
mysummary()
class scapy.layers.inet6.ICMPv6ND_RA

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.layers.inet6._ICMPv6

aliastypes
answers(other)
fields_desc
ICMPv6ND_RA fields

type

ByteEnumField

134

code

ByteField

0

cksum

XShortField

None

chlim

ByteField

0

M

BitField (1 bit)

0

O

BitField (1 bit)

0

H

BitField (1 bit)

0

prf

BitEnumField (2 bits)

1

P

BitField (1 bit)

0

res

BitField (2 bits)

0

routerlifetime

ShortField

1800

reachabletime

IntField

0

retranstimer

IntField

0

mysummary()
class scapy.layers.inet6.ICMPv6ND_RS

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6ND_RS fields

type

ByteEnumField

133

code

ByteField

0

cksum

XShortField

None

res

IntField

0

class scapy.layers.inet6.ICMPv6ND_Redirect

Bases: scapy.layers.inet6._ICMPv6NDGuessPayload, scapy.layers.inet6._ICMPv6, scapy.packet.Packet

aliastypes
fields_desc
ICMPv6ND_Redirect fields

type

ByteEnumField

137

code

ByteField

0

cksum

XShortField

None

res

XIntField

0

tgt

IP6Field

'::'

dst

IP6Field

'::'

class scapy.layers.inet6.ICMPv6NIQueryIPv4

Bases: scapy.layers.inet6.ICMPv6NIQueryNOOP

aliastypes
fields_desc
ICMPv6NIQueryIPv4 fields

type

ByteEnumField

139

code

NIQueryCodeField

None

cksum

XShortField

None

qtype

ShortEnumField

4

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIQueryDataField

(1, b'\x00\x00\x00')

class scapy.layers.inet6.ICMPv6NIQueryIPv6

Bases: scapy.layers.inet6.ICMPv6NIQueryNOOP

aliastypes
fields_desc
ICMPv6NIQueryIPv6 fields

type

ByteEnumField

139

code

NIQueryCodeField

None

cksum

XShortField

None

qtype

ShortEnumField

3

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

62

nonce

NonceField

<RandBin>

data

NIQueryDataField

(1, b'\x00\x00\x00')

class scapy.layers.inet6.ICMPv6NIQueryNOOP

Bases: scapy.layers.inet6._ICMPv6NIHashret, scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6NIQueryNOOP fields

type

ByteEnumField

139

code

NIQueryCodeField

None

cksum

XShortField

None

qtype

ShortEnumField

0

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIQueryDataField

(1, b'\x00\x00\x00')

class scapy.layers.inet6.ICMPv6NIQueryName

Bases: scapy.layers.inet6.ICMPv6NIQueryNOOP

aliastypes
fields_desc
ICMPv6NIQueryName fields

type

ByteEnumField

139

code

NIQueryCodeField

None

cksum

XShortField

None

qtype

ShortEnumField

2

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIQueryDataField

(1, b'\x00\x00\x00')

class scapy.layers.inet6.ICMPv6NIReplyIPv4

Bases: scapy.layers.inet6.ICMPv6NIReplyNOOP

aliastypes
fields_desc
ICMPv6NIReplyIPv4 fields

type

ByteEnumField

140

code

ByteEnumField

0

cksum

XShortField

None

qtype

ShortEnumField

4

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIReplyDataField

(0, None)

class scapy.layers.inet6.ICMPv6NIReplyIPv6

Bases: scapy.layers.inet6.ICMPv6NIReplyNOOP

aliastypes
fields_desc
ICMPv6NIReplyIPv6 fields

type

ByteEnumField

140

code

ByteEnumField

0

cksum

XShortField

None

qtype

ShortEnumField

3

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIReplyDataField

(0, None)

class scapy.layers.inet6.ICMPv6NIReplyNOOP

Bases: scapy.layers.inet6._ICMPv6NIAnswers, scapy.layers.inet6._ICMPv6NIHashret, scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6NIReplyNOOP fields

type

ByteEnumField

140

code

ByteEnumField

0

cksum

XShortField

None

qtype

ShortEnumField

0

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIReplyDataField

(0, None)

class scapy.layers.inet6.ICMPv6NIReplyName

Bases: scapy.layers.inet6.ICMPv6NIReplyNOOP

aliastypes
fields_desc
ICMPv6NIReplyName fields

type

ByteEnumField

140

code

ByteEnumField

0

cksum

XShortField

None

qtype

ShortEnumField

2

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIReplyDataField

(0, None)

class scapy.layers.inet6.ICMPv6NIReplyRefuse

Bases: scapy.layers.inet6.ICMPv6NIReplyNOOP

aliastypes
fields_desc
ICMPv6NIReplyRefuse fields

type

ByteEnumField

140

code

ByteEnumField

1

cksum

XShortField

None

qtype

ShortEnumField

0

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIReplyDataField

(0, None)

class scapy.layers.inet6.ICMPv6NIReplyUnknown

Bases: scapy.layers.inet6.ICMPv6NIReplyNOOP

aliastypes
fields_desc
ICMPv6NIReplyUnknown fields

type

ByteEnumField

140

code

ByteEnumField

2

cksum

XShortField

None

qtype

ShortEnumField

0

unused

BitField (10 bits)

0

flags

FlagsField (6 bits)

<Flag 0 ()>

nonce

NonceField

<RandBin>

data

NIReplyDataField

(0, None)

class scapy.layers.inet6.ICMPv6PacketTooBig

Bases: scapy.layers.inet6._ICMPv6Error

aliastypes
fields_desc
ICMPv6PacketTooBig fields

type

ByteEnumField

2

code

ByteField

0

cksum

XShortField

None

mtu

IntField

1280

class scapy.layers.inet6.ICMPv6ParamProblem

Bases: scapy.layers.inet6._ICMPv6Error

aliastypes
fields_desc
ICMPv6ParamProblem fields

type

ByteEnumField

4

code

ByteEnumField

0

cksum

XShortField

None

ptr

IntField

6

class scapy.layers.inet6.ICMPv6TimeExceeded

Bases: scapy.layers.inet6._ICMPv6Error

aliastypes
fields_desc
ICMPv6TimeExceeded fields

type

ByteEnumField

3

code

ByteEnumField

0

cksum

XShortField

None

length

ByteField

0

unused

X3BytesField

0

post_dissection(pkt)
class scapy.layers.inet6.ICMPv6Unknown

Bases: scapy.layers.inet6._ICMPv6

aliastypes
fields_desc
ICMPv6Unknown fields

type

ByteEnumField

1

code

ByteField

0

cksum

XShortField

None

msgbody

StrField

b''

class scapy.layers.inet6.IP6ListField(name, default, count_from=None, length_from=None)

Bases: scapy.fields.StrField

count_from
getfield(pkt, s)
i2count(pkt, i)
i2len(pkt, i)
i2m(pkt, x)
i2repr(pkt, x)
islist = 1
length_from
class scapy.layers.inet6.IPerror6

Bases: scapy.layers.inet6.IPv6

aliastypes
answers(other)
fields_desc
IPerror6 fields

version

BitField (4 bits)

6

tc

BitField (8 bits)

0

fl

BitField (20 bits)

0

plen

ShortField

None

nh

ByteEnumField

59

hlim

ByteField

64

src

SourceIP6Field

None

dst

DestIP6Field

None

mysummary()
payload_guess

Possible sublayers: TCPerror, UDPerror

class scapy.layers.inet6.IPv6

Bases: scapy.layers.inet6._IPv6GuessPayload, scapy.packet.Packet, scapy.layers.inet.IPTools

aliastypes
answers(other)
extract_padding(data)

Extract the IPv6 payload

fields_desc
IPv6 fields

version

BitField (4 bits)

6

tc

BitField (8 bits)

0

fl

BitField (20 bits)

0

plen

ShortField

None

nh

ByteEnumField

59

hlim

ByteField

64

src

SourceIP6Field

None

dst

DestIP6Field

None

hashret()
mysummary()
payload_guess

Possible sublayers: EIGRP, MPLS, OSPFv3_Hdr, IP, TCP, UDP, IPv6, AH, ESP, GRE, SCTP, VRRPv3

post_build(p, pay)
route()

Used to select the L2 address

class scapy.layers.inet6.IPv6ExtHdrDestOpt

Bases: scapy.layers.inet6._IPv6ExtHdr

aliastypes
fields_desc
IPv6ExtHdrDestOpt fields

nh

ByteEnumField

59

len

FieldLenField

None

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

class scapy.layers.inet6.IPv6ExtHdrFragment

Bases: scapy.layers.inet6._IPv6ExtHdr

aliastypes
fields_desc
IPv6ExtHdrFragment fields

nh

ByteEnumField

59

res1

BitField (8 bits)

0

offset

BitField (13 bits)

0

res2

BitField (2 bits)

0

m

BitField (1 bit)

0

id

IntField

None

class scapy.layers.inet6.IPv6ExtHdrHopByHop

Bases: scapy.layers.inet6._IPv6ExtHdr

aliastypes
fields_desc
IPv6ExtHdrHopByHop fields

nh

ByteEnumField

59

len

FieldLenField

None

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

class scapy.layers.inet6.IPv6ExtHdrRouting

Bases: scapy.layers.inet6._IPv6ExtHdr

aliastypes
fields_desc
IPv6ExtHdrRouting fields

nh

ByteEnumField

59

len

FieldLenField

None

type

ByteField

0

segleft

ByteField

None

reserved

BitField (32 bits)

0

addresses

IP6ListField

[]

post_build(pkt, pay)
class scapy.layers.inet6.IPv6ExtHdrSegmentRouting

Bases: scapy.layers.inet6._IPv6ExtHdr

aliastypes
fields_desc
IPv6ExtHdrSegmentRouting fields

nh

ByteEnumField

59

len

ByteField

None

type

ByteField

4

segleft

ByteField

None

lastentry

ByteField

None

unused1

BitField (1 bit)

0

protected

BitField (1 bit)

0

oam

BitField (1 bit)

0

alert

BitField (1 bit)

0

hmac

BitField (1 bit)

0

unused2

BitField (3 bits)

0

tag

ShortField

0

addresses

IP6ListField

['::1']

tlv_objects

PacketListField

[]

post_build(pkt, pay)
class scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLV

Bases: scapy.packet.Packet

aliastypes
classmethod dispatch_hook(pkt=None, *args, **kargs)
extract_padding(p)
fields_desc
IPv6ExtHdrSegmentRoutingTLV fields

type

ByteField

0

len

ByteField

0

reserved

ByteField

0

flags

ByteField

0

value

StrLenField

b''

classmethod register_variant()
registered_sr_tlv = {0: <class 'scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLV'>, 1: <class 'scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLVIngressNode'>, 2: <class 'scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLVEgressNode'>, 4: <class 'scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLVPadding'>}
class scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLVEgressNode

Bases: scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLV

aliastypes
fields_desc
IPv6ExtHdrSegmentRoutingTLVEgressNode fields

type

ByteField

2

len

ByteField

18

reserved

ByteField

0

flags

ByteField

0

egress_node

IP6Field

'::1'

class scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLVIngressNode

Bases: scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLV

aliastypes
fields_desc
IPv6ExtHdrSegmentRoutingTLVIngressNode fields

type

ByteField

1

len

ByteField

18

reserved

ByteField

0

flags

ByteField

0

ingress_node

IP6Field

'::1'

class scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLVPadding

Bases: scapy.layers.inet6.IPv6ExtHdrSegmentRoutingTLV

aliastypes
fields_desc
IPv6ExtHdrSegmentRoutingTLVPadding fields

type

ByteField

4

len

FieldLenField

None

padding

StrLenField

b'\x00'

scapy.layers.inet6.IPv6inIP(dst='203.178.135.36', src=None)
class scapy.layers.inet6.Jumbo

Bases: scapy.packet.Packet

aliastypes
alignment_delta(curpos)
extract_padding(p)
fields_desc
Jumbo fields

otype

_OTypeField

194

optlen

ByteField

4

jumboplen

IntField

None

class scapy.layers.inet6.L3RawSocket6(type=34525, filter=None, iface=None, promisc=None, nofilter=0)

Bases: scapy.supersocket.L3RawSocket

class scapy.layers.inet6.LifetimeField(name, default)

Bases: scapy.fields.ShortField

i2repr(pkt, x)
class scapy.layers.inet6.MIP6MH_BA

Bases: scapy.layers.inet6._MobilityHeader

aliastypes
answers(other)
fields_desc
MIP6MH_BA fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

6

res

ByteField

None

cksum

XShortField

None

status

ByteEnumField

0

flags

FlagsField (3 bits)

<Flag 4 (K)>

res2

XBitField (5 bits)

None

seq

XShortField

None

mhtime

XShortField

0

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

hashret()
class scapy.layers.inet6.MIP6MH_BE

Bases: scapy.layers.inet6._MobilityHeader

aliastypes
fields_desc
MIP6MH_BE fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

7

res

ByteField

0

cksum

XShortField

None

status

ByteEnumField

0

reserved

ByteField

0

ha

IP6Field

'::'

options

_OptionsField

[]

class scapy.layers.inet6.MIP6MH_BRR

Bases: scapy.layers.inet6._MobilityHeader

aliastypes
fields_desc
MIP6MH_BRR fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

0

res

ByteField

None

cksum

XShortField

None

res2

ShortField

None

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

hashret()
class scapy.layers.inet6.MIP6MH_BU

Bases: scapy.layers.inet6._MobilityHeader

aliastypes
answers(other)
fields_desc
MIP6MH_BU fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

5

res

ByteField

None

cksum

XShortField

None

seq

XShortField

None

flags

FlagsField (7 bits)

<Flag 104 (KHA)>

reserved

XBitField (9 bits)

0

mhtime

LifetimeField

3

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

hashret()
class scapy.layers.inet6.MIP6MH_CoT

Bases: scapy.layers.inet6.MIP6MH_HoT

aliastypes
answers(other)
fields_desc
MIP6MH_CoT fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

4

res

ByteField

None

cksum

XShortField

None

index

ShortField

None

cookie

StrFixedLenField

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

token

StrFixedLenField

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

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

hashret()
class scapy.layers.inet6.MIP6MH_CoTI

Bases: scapy.layers.inet6.MIP6MH_HoTI

aliastypes
fields_desc
MIP6MH_CoTI fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

2

res

ByteField

None

cksum

XShortField

None

reserved

StrFixedLenField

b'\x00\x00'

cookie

StrFixedLenField

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

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

hashret()
class scapy.layers.inet6.MIP6MH_Generic

Bases: scapy.layers.inet6._MobilityHeader

aliastypes
fields_desc
MIP6MH_Generic fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

None

res

ByteField

None

cksum

XShortField

None

msg

StrLenField

b'\x00\x00'

class scapy.layers.inet6.MIP6MH_HoT

Bases: scapy.layers.inet6._MobilityHeader

aliastypes
answers(other)
fields_desc
MIP6MH_HoT fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

3

res

ByteField

None

cksum

XShortField

None

index

ShortField

None

cookie

StrFixedLenField

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

token

StrFixedLenField

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

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

hashret()
class scapy.layers.inet6.MIP6MH_HoTI

Bases: scapy.layers.inet6._MobilityHeader

aliastypes
fields_desc
MIP6MH_HoTI fields

nh

ByteEnumField

59

len

ByteField

None

mhtype

ByteEnumField

1

res

ByteField

None

cksum

XShortField

None

reserved

StrFixedLenField

b'\x00\x00'

cookie

StrFixedLenField

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

autopad

_PhantomAutoPadField

1

options

_OptionsField

[]

hashret()
class scapy.layers.inet6.MIP6OptAltCoA

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptAltCoA fields

otype

ByteEnumField

3

olen

ByteField

16

acoa

IP6Field

'::'

x = 8
y = 6
class scapy.layers.inet6.MIP6OptBRAdvice

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptBRAdvice fields

otype

ByteEnumField

2

olen

ByteField

2

rinter

ShortField

0

x = 2
y = 0
class scapy.layers.inet6.MIP6OptBindingAuthData

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptBindingAuthData fields

otype

ByteEnumField

5

olen

ByteField

16

authenticator

BitField (96 bits)

0

x = 8
y = 2
class scapy.layers.inet6.MIP6OptCGAParams

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptCGAParams fields

otype

ByteEnumField

12

olen

FieldLenField

None

cgaparams

StrLenField

b''

x = 0
y = 0
class scapy.layers.inet6.MIP6OptCGAParamsReq

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptCGAParamsReq fields

otype

ByteEnumField

11

olen

ByteField

0

x = 0
y = 0
class scapy.layers.inet6.MIP6OptCareOfTest

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptCareOfTest fields

otype

ByteEnumField

16

olen

FieldLenField

None

cokt

StrLenField

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

x = 0
y = 0
class scapy.layers.inet6.MIP6OptCareOfTestInit

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptCareOfTestInit fields

otype

ByteEnumField

15

olen

ByteField

0

x = 0
y = 0
class scapy.layers.inet6.MIP6OptHomeKeygenToken

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptHomeKeygenToken fields

otype

ByteEnumField

14

olen

FieldLenField

None

hkt

StrLenField

b''

x = 0
y = 0
class scapy.layers.inet6.MIP6OptLLAddr

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptLLAddr fields

otype

ByteEnumField

7

olen

ByteField

7

ocode

ByteEnumField

2

pad

ByteField

0

lla

MACField

'00:00:00:00:00:00'

x = 0
y = 0
class scapy.layers.inet6.MIP6OptMNID

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptMNID fields

otype

ByteEnumField

8

olen

FieldLenField

None

subtype

ByteEnumField

1

id

StrLenField

b''

x = 0
y = 0
class scapy.layers.inet6.MIP6OptMobNetPrefix

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptMobNetPrefix fields

otype

ByteEnumField

6

olen

ByteField

18

reserved

ByteField

0

plen

ByteField

64

prefix

IP6Field

'::'

x = 8
y = 4
class scapy.layers.inet6.MIP6OptMsgAuth

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptMsgAuth fields

otype

ByteEnumField

9

olen

FieldLenField

None

subtype

ByteEnumField

1

mspi

IntField

None

authdata

StrLenField

b'AAAAAAAAAAAA'

x = 4
y = 1
class scapy.layers.inet6.MIP6OptNonceIndices

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptNonceIndices fields

otype

ByteEnumField

4

olen

ByteField

16

hni

ShortField

0

coni

ShortField

0

x = 2
y = 0
class scapy.layers.inet6.MIP6OptReplayProtection

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptReplayProtection fields

otype

ByteEnumField

10

olen

ByteField

8

timestamp

NTPTimestampField

0

x = 8
y = 2
class scapy.layers.inet6.MIP6OptSignature

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
fields_desc
MIP6OptSignature fields

otype

ByteEnumField

13

olen

FieldLenField

None

sig

StrLenField

b''

x = 0
y = 0
class scapy.layers.inet6.MIP6OptUnknown

Bases: scapy.layers.inet6._MIP6OptAlign

aliastypes
classmethod dispatch_hook(_pkt=None, *_, **kargs)
fields_desc
MIP6OptUnknown fields

otype

ByteEnumField

6

olen

FieldLenField

None

odata

StrLenField

b''

x = 0
y = 0
scapy.layers.inet6.NDP_Attack_DAD_DoS_via_NA(iface=None, mac_src_filter=None, tgt_filter=None, reply_mac=None)

Perform the DAD DoS attack using NS described in section 4.1.3 of RFC 3756. This is done by listening incoming NS messages sent from the unspecified address and sending a NA reply for the target address, leading the peer to believe that another node is also performing DAD for that address.

By default, the fake NA sent to create the DoS uses:
  • as target address the target address found in received NS.

  • as IPv6 source address: the target address found in received NS.

  • as IPv6 destination address: the link-local solicited-node multicast address derived from the target address in received NS.

  • the mac address of the interface as source (or reply_mac, see below).

  • the multicast mac address derived from the solicited node multicast address used as IPv6 destination address.

  • A Target Link-Layer address option (ICMPv6NDOptDstLLAddr) filled with the mac address used as source of the NA.

Following arguments can be used to change the behavior:

iface: a specific interface (e.g. “eth0”) of the system on which the

DoS should be launched. If None is provided conf.iface is used.

mac_src_filter: a mac address (e.g “00:13:72:8c:b5:69”) to filter on.

Only NS messages received from this source will trigger replies. This allows limiting the effects of the DoS to a single target by filtering on its mac address. The default value is None: the DoS is not limited to a specific mac address.

tgt_filter: Same as previous but for a specific target IPv6 address for

received NS. If the target address in the NS message (not the IPv6 destination address) matches that address, then a fake reply will be sent, i.e. the emitter will be a target of the DoS.

reply_mac: allow specifying a specific source mac address for the reply,

i.e. to prevent the use of the mac address of the interface. This address will also be used in the Target Link-Layer Address option.

scapy.layers.inet6.NDP_Attack_DAD_DoS_via_NS(iface=None, mac_src_filter=None, tgt_filter=None, reply_mac=None)

Perform the DAD DoS attack using NS described in section 4.1.3 of RFC 3756. This is done by listening incoming NS messages sent from the unspecified address and sending a NS reply for the target address, leading the peer to believe that another node is also performing DAD for that address.

By default, the fake NS sent to create the DoS uses:
  • as target address the target address found in received NS.

  • as IPv6 source address: the unspecified address (::).

  • as IPv6 destination address: the link-local solicited-node multicast address derived from the target address in received NS.

  • the mac address of the interface as source (or reply_mac, see below).

  • the multicast mac address derived from the solicited node multicast address used as IPv6 destination address.

Following arguments can be used to change the behavior:

iface: a specific interface (e.g. “eth0”) of the system on which the

DoS should be launched. If None is provided conf.iface is used.

mac_src_filter: a mac address (e.g “00:13:72:8c:b5:69”) to filter on.

Only NS messages received from this source will trigger replies. This allows limiting the effects of the DoS to a single target by filtering on its mac address. The default value is None: the DoS is not limited to a specific mac address.

tgt_filter: Same as previous but for a specific target IPv6 address for

received NS. If the target address in the NS message (not the IPv6 destination address) matches that address, then a fake reply will be sent, i.e. the emitter will be a target of the DoS.

reply_mac: allow specifying a specific source mac address for the reply,

i.e. to prevent the use of the mac address of the interface.

scapy.layers.inet6.NDP_Attack_Fake_Router(ra, iface=None, mac_src_filter=None, ip_src_filter=None)

The purpose of this function is to send provided RA message at layer 2 (i.e. providing a packet starting with IPv6 will not work) in response to received RS messages. In the end, the function is a simple wrapper around sendp() that monitor the link for RS messages.

It is probably better explained with an example:

>>> ra  = Ether()/IPv6()/ICMPv6ND_RA()
>>> ra /= ICMPv6NDOptPrefixInfo(prefix="2001:db8:1::", prefixlen=64)
>>> ra /= ICMPv6NDOptPrefixInfo(prefix="2001:db8:2::", prefixlen=64)
>>> ra /= ICMPv6NDOptSrcLLAddr(lladdr="00:11:22:33:44:55")
>>> NDP_Attack_Fake_Router(ra, iface="eth0")
Fake RA sent in response to RS from fe80::213:58ff:fe8c:b573
Fake RA sent in response to RS from fe80::213:72ff:fe8c:b9ae
...

Following arguments can be used to change the behavior:

ra: the RA message to send in response to received RS message.

iface: a specific interface (e.g. “eth0”) of the system on which the

DoS should be launched. If none is provided, conf.iface is used.

mac_src_filter: a mac address (e.g “00:13:72:8c:b5:69”) to filter on.

Only RS messages received from this source will trigger a reply. Note that no changes to provided RA is done which imply that if you intend to target only the source of the RS using this option, you will have to set the Ethernet destination address to the same value in your RA. The default value for this parameter is None: no filtering on the source of RS is done.

ip_src_filter: an IPv6 address (e.g. fe80::21e:bff:fe4e:3b2) to filter

on. Only RS messages received from this source address will trigger replies. Same comment as for previous argument apply: if you use the option, you will probably want to set a specific Ethernet destination address in the RA.

scapy.layers.inet6.NDP_Attack_Kill_Default_Router(iface=None, mac_src_filter=None, ip_src_filter=None, reply_mac=None, tgt_mac=None)

The purpose of the function is to monitor incoming RA messages sent by default routers (RA with a non-zero Router Lifetime values) and invalidate them by immediately replying with fake RA messages advertising a zero Router Lifetime value.

The result on receivers is that the router is immediately invalidated, i.e. the associated entry is discarded from the default router list and destination cache is updated to reflect the change.

By default, the function considers all RA messages with a non-zero Router Lifetime value but provides configuration knobs to allow filtering RA sent by specific routers (Ethernet source address). With regard to emission, the multicast all-nodes address is used by default but a specific target can be used, in order for the DoS to apply only to a specific host.

More precisely, following arguments can be used to change the behavior:

iface: a specific interface (e.g. “eth0”) of the system on which the

DoS should be launched. If None is provided conf.iface is used.

mac_src_filter: a mac address (e.g “00:13:72:8c:b5:69”) to filter on.

Only RA messages received from this source will trigger replies. If other default routers advertised their presence on the link, their clients will not be impacted by the attack. The default value is None: the DoS is not limited to a specific mac address.

ip_src_filter: an IPv6 address (e.g. fe80::21e:bff:fe4e:3b2) to filter

on. Only RA messages received from this source address will trigger replies. If other default routers advertised their presence on the link, their clients will not be impacted by the attack. The default value is None: the DoS is not limited to a specific IPv6 source address.

reply_mac: allow specifying a specific source mac address for the reply,

i.e. to prevent the use of the mac address of the interface.

tgt_mac: allow limiting the effect of the DoS to a specific host,

by sending the “invalidating RA” only to its mac address.

scapy.layers.inet6.NDP_Attack_NA_Spoofing(iface=None, mac_src_filter=None, tgt_filter=None, reply_mac=None, router=False)

The main purpose of this function is to send fake Neighbor Advertisement messages to a victim. As the emission of unsolicited Neighbor Advertisement is pretty pointless (from an attacker standpoint) because it will not lead to a modification of a victim’s neighbor cache, the function send advertisements in response to received NS (NS sent as part of the DAD, i.e. with an unspecified address as source, are not considered).

By default, the fake NA sent to create the DoS uses:
  • as target address the target address found in received NS.

  • as IPv6 source address: the target address

  • as IPv6 destination address: the source IPv6 address of received NS message.

  • the mac address of the interface as source (or reply_mac, see below).

  • the source mac address of the received NS as destination macs address of the emitted NA.

  • A Target Link-Layer address option (ICMPv6NDOptDstLLAddr) filled with the mac address used as source of the NA.

Following arguments can be used to change the behavior:

iface: a specific interface (e.g. “eth0”) of the system on which the

DoS should be launched. If None is provided conf.iface is used.

mac_src_filter: a mac address (e.g “00:13:72:8c:b5:69”) to filter on.

Only NS messages received from this source will trigger replies. This allows limiting the effects of the DoS to a single target by filtering on its mac address. The default value is None: the DoS is not limited to a specific mac address.

tgt_filter: Same as previous but for a specific target IPv6 address for

received NS. If the target address in the NS message (not the IPv6 destination address) matches that address, then a fake reply will be sent, i.e. the emitter will be a target of the DoS.

reply_mac: allow specifying a specific source mac address for the reply,

i.e. to prevent the use of the mac address of the interface. This address will also be used in the Target Link-Layer Address option.

router: by the default (False) the ‘R’ flag in the NA used for the reply

is not set. If the parameter is set to True, the ‘R’ flag in the NA is set, advertising us as a router.

Please, keep the following in mind when using the function: for obvious reasons (kernel space vs. Python speed), when the target of the address resolution is on the link, the sender of the NS receives 2 NA messages in a row, the valid one and our fake one. The second one will overwrite the information provided by the first one, i.e. the natural latency of Scapy helps here.

In practice, on a common Ethernet link, the emission of the NA from the genuine target (kernel stack) usually occurs in the same millisecond as the receipt of the NS. The NA generated by Scapy6 will usually come after something 20+ ms. On a usual testbed for instance, this difference is sufficient to have the first data packet sent from the victim to the destination before it even receives our fake NA.

scapy.layers.inet6.NDP_Attack_NS_Spoofing(src_lladdr=None, src=None, target='2001:db8::1', dst=None, src_mac=None, dst_mac=None, loop=True, inter=1, iface=None)

The main purpose of this function is to send fake Neighbor Solicitations messages to a victim, in order to either create a new entry in its neighbor cache or update an existing one. In section 7.2.3 of RFC 4861, it is stated that a node SHOULD create the entry or update an existing one (if it is not currently performing DAD for the target of the NS). The entry’s reachability # noqa: E501 state is set to STALE.

The two main parameters of the function are the source link-layer address (carried by the Source Link-Layer Address option in the NS) and the source address of the packet.

Unlike some other NDP_Attack_* function, this one is not based on a stimulus/response model. When called, it sends the same NS packet in loop every second (the default)

Following arguments can be used to change the format of the packets:

src_lladdr: the MAC address used in the Source Link-Layer Address option

included in the NS packet. This is the address that the peer should associate in its neighbor cache with the IPv6 source address of the packet. If None is provided, the mac address of the interface is used.

src: the IPv6 address used as source of the packet. If None is provided,

an address associated with the emitting interface will be used (based on the destination address of the packet).

target: the target address of the NS packet. If no value is provided,

a dummy address (2001:db8::1) is used. The value of the target has a direct impact on the destination address of the packet if it is not overridden. By default, the solicited-node multicast address associated with the target is used as destination address of the packet. Consider specifying a specific destination address if you intend to use a target address different than the one of the victim.

dst: The destination address of the NS. By default, the solicited node

multicast address associated with the target address (see previous parameter) is used if no specific value is provided. The victim is not expected to check the destination address of the packet, so using a multicast address like ff02::1 should work if you want the attack to target all hosts on the link. On the contrary, if you want to be more stealth, you should provide the target address for this parameter in order for the packet to be sent only to the victim.

src_mac: the MAC address used as source of the packet. By default, this

is the address of the interface. If you want to be more stealth, feel free to use something else. Note that this address is not the that the victim will use to populate its neighbor cache.

dst_mac: The MAC address used as destination address of the packet. If

the IPv6 destination address is multicast (all-nodes, solicited node, …), it will be computed. If the destination address is unicast, a neighbor solicitation will be performed to get the associated address. If you want the attack to be stealth, you can provide the MAC address using this parameter.

loop: By default, this parameter is True, indicating that NS packets

will be sent in loop, separated by ‘inter’ seconds (see below). When set to False, a single packet is sent.

inter: When loop parameter is True (the default), this parameter provides

the interval in seconds used for sending NS packets.

iface: to force the sending interface.

class scapy.layers.inet6.NIQueryCodeField(name, default, enum)

Bases: scapy.fields.ByteEnumField

i2m(pkt, x)
class scapy.layers.inet6.NIQueryDataField(name, default)

Bases: scapy.fields.StrField

addfield(pkt, s, val)
getfield(pkt, s)
h2i(pkt, x)
i2h(pkt, x)
i2repr(pkt, x)
class scapy.layers.inet6.NIReplyDataField(name, default, fmt='H', remain=0)

Bases: scapy.fields.StrField

addfield(pkt, s, val)
getfield(pkt, s)
h2i(pkt, x)
i2h(pkt, x)
i2repr(pkt, x)
class scapy.layers.inet6.NTPTimestampField(name, default)

Bases: scapy.fields.LongField

i2repr(pkt, x)
class scapy.layers.inet6.NonceField(name, default=None)

Bases: scapy.fields.StrFixedLenField

class scapy.layers.inet6.Pad1

Bases: scapy.packet.Packet

aliastypes
alignment_delta(curpos)
extract_padding(p)
fields_desc
Pad1 fields

otype

_OTypeField

0

class scapy.layers.inet6.PadN

Bases: scapy.packet.Packet

aliastypes
alignment_delta(curpos)
extract_padding(p)
fields_desc
PadN fields

otype

_OTypeField

1

optlen

FieldLenField

None

optdata

StrLenField

b''

class scapy.layers.inet6.PseudoIPv6

Bases: scapy.packet.Packet

aliastypes
fields_desc
PseudoIPv6 fields

src

IP6Field

'::'

dst

IP6Field

'::'

uplen

ShortField

None

zero

BitField (24 bits)

0

nh

ByteField

0

class scapy.layers.inet6.RouterAlert

Bases: scapy.packet.Packet

aliastypes
alignment_delta(curpos)
extract_padding(p)
fields_desc
RouterAlert fields

otype

_OTypeField

5

optlen

ByteField

2

value

ShortEnumField

None

class scapy.layers.inet6.TracerouteResult6(res=None, name='Traceroute', stats=None)

Bases: scapy.layers.inet.TracerouteResult

get_trace()
graph(ASres=<scapy.layers.inet6.AS_resolver6 object>, **kargs)
show()
class scapy.layers.inet6.TruncPktLenField(name, default, cls, cur_shift, length_from=None, shift=0)

Bases: scapy.fields.PacketLenField

cur_shift
getfield(pkt, s)
i2len(pkt, i)
i2m(pkt, x)
m2i(pkt, m)
scapy.layers.inet6.computeNIGroupAddr(name)

Compute the NI group Address. Can take a FQDN as input parameter

scapy.layers.inet6.defragment6(packets)

Performs defragmentation of a list of IPv6 packets. Packets are reordered. Crap is dropped. What lacks is completed by ‘X’ characters.

scapy.layers.inet6.dnsrepr2names(x)

Take as input a DNS encoded string (possibly compressed) and returns a list of DNS names contained in it. If provided string is already in printable format (does not end with a null character, a one element list is returned). Result is a list.

scapy.layers.inet6.fragment6(pkt, fragSize)

Performs fragmentation of an IPv6 packet. Provided packet (‘pkt’) must already contain an IPv6ExtHdrFragment() class. ‘fragSize’ argument is the expected maximum size of fragments (MTU). The list of packets is returned.

If packet does not contain an IPv6ExtHdrFragment class, it is returned in result list.

scapy.layers.inet6.getmacbyip6(ip6, chainCC=0)

Returns the MAC address corresponding to an IPv6 address

neighborCache.get() method is used on instantiated neighbor cache. Resolution mechanism is described in associated doc string.

(chainCC parameter value ends up being passed to sending function

used to perform the resolution, if needed)

scapy.layers.inet6.in6_chksum(nh, u, p)

As Specified in RFC 2460 - 8.1 Upper-Layer Checksums

Performs IPv6 Upper Layer checksum computation.

This function operates by filling a pseudo header class instance (PseudoIPv6) with: - Next Header value - the address of _final_ destination (if some Routing Header with non segleft field is present in underlayer classes, last address is used.) - the address of _real_ source (basically the source address of an IPv6 class instance available in the underlayer or the source address in HAO option if some Destination Option header found in underlayer includes this option). - the length is the length of provided payload string (‘p’)

Parameters
  • nh – value of upper layer protocol

  • u – upper layer instance (TCP, UDP, ICMPv6*, ). Instance must be provided with all under layers (IPv6 and all extension headers, for example)

  • p – the payload of the upper layer provided as a string

scapy.layers.inet6.inet6_register_l3(l2, l3)
scapy.layers.inet6.names2dnsrepr(x)

Take as input a list of DNS names or a single DNS name and encode it in DNS format (with possible compression) If a string that is already a DNS name in DNS format is passed, it is returned unmodified. Result is a string. !!! At the moment, compression is not implemented !!!

scapy.layers.inet6.neighsol(addr, src, iface, timeout=1, chainCC=0)

Sends and receive an ICMPv6 Neighbor Solicitation message

This function sends an ICMPv6 Neighbor Solicitation message to get the MAC address of the neighbor with specified IPv6 address address.

‘src’ address is used as source of the message. Message is sent on iface. By default, timeout waiting for an answer is 1 second.

If no answer is gathered, None is returned. Else, the answer is returned (ethernet frame).

scapy.layers.inet6.traceroute6(target, dport=80, minttl=1, maxttl=30, sport=<RandShort>, l4=None, timeout=2, verbose=None, **kargs)

Instant TCP traceroute using IPv6 traceroute6(target, [maxttl=30], [dport=80], [sport=80]) -> None