scapy.layers.netflow

Cisco NetFlow protocol v1, v5, v9 and v10 (IPFix)

HowTo dissect NetflowV9/10 (IPFix) packets

# From a pcap / list of packets

Using sniff and sessions:

>>> sniff(offline=open("my_great_pcap.pcap", "rb"), session=NetflowSession)

Using the netflowv9_defragment/ipfix_defragment commands:

  • get a list of packets containing NetflowV9/10 packets

  • call netflowv9_defragment(plist) to defragment the list

(ipfix_defragment is an alias for netflowv9_defragment)

# Live / on-the-flow / other: use NetflowSession:

>>> sniff(session=NetflowSession, prn=[...])
scapy.layers.netflow.GetNetflowRecordV9(flowset, templateID=None)[源代码]

Get a NetflowRecordV9/10 for a specific NetflowFlowsetV9/10.

Have a look at the online doc for examples.

class scapy.layers.netflow.N9SecondsIntField(name, default, *args, **kargs)[源代码]

基类:SecondsIntField, _AdjustableNetflowField

Defines dateTimeSeconds (without EPOCH: just seconds)

class scapy.layers.netflow.N9UTCTimeField(name, default, *args, **kargs)[源代码]

基类:UTCTimeField, _AdjustableNetflowField

Defines dateTimeSeconds (EPOCH)

class scapy.layers.netflow.NetflowDataflowsetV9(_pkt, /, *, templateID=255, length=None, records=[])[源代码]

基类:Packet

aliastypes
classmethod dispatch_hook(_pkt=None, *args, **kargs)[源代码]
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           TEMPLATEID          |             LENGTH            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            RECORDS            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                    Fig. NetflowDataflowsetV9                     
NetflowDataflowsetV9 fields

templateID

ShortField

255

length

ShortField

None

records

PacketListField

[]

payload_guess

Possible sublayers: NetflowDataflowsetV9

post_build(pkt, pay)[源代码]
class scapy.layers.netflow.NetflowFlowsetV9(_pkt, /, *, flowSetID=0, length=None, templates=[])[源代码]

基类: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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           FLOWSETID           |             LENGTH            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           TEMPLATES           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                      Fig. NetflowFlowsetV9                       
NetflowFlowsetV9 fields

flowSetID

ShortField

0

length

FieldLenField

None

templates

PacketListField

[]

payload_guess

Possible sublayers: NetflowDataflowsetV9

class scapy.layers.netflow.NetflowHeader(_pkt, /, *, version=1)[源代码]

基类: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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            VERSION            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. NetflowHeader                        
NetflowHeader fields

version

ShortField

1

payload_guess

Possible sublayers: NetflowHeaderV10, NetflowHeaderV1, NetflowHeaderV5, NetflowHeaderV9

class scapy.layers.netflow.NetflowHeaderV1(_pkt, /, *, count=None, sysUptime=0, unixSecs=0, unixNanoSeconds=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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             COUNT             |           SYSUPTIME           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |            UNIXSECS           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |        UNIXNANOSECONDS        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                       Fig. NetflowHeaderV1                       
NetflowHeaderV1 fields

count

ShortField

None

sysUptime

IntField

0

unixSecs

UTCTimeField

0

unixNanoSeconds

UTCTimeField

0

payload_guess

Possible sublayers: NetflowRecordV1

post_build(pkt, pay)[源代码]
class scapy.layers.netflow.NetflowHeaderV10(_pkt, /, *, length=None, ExportTime=0, flowSequence=0, ObservationDomainID=0)[源代码]

基类:Packet

IPFix (Netflow V10) Header

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             LENGTH            |           EXPORTTIME          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |          FLOWSEQUENCE         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |      OBSERVATIONDOMAINID      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                      Fig. NetflowHeaderV10                       
NetflowHeaderV10 fields

length

ShortField

None

ExportTime

UTCTimeField

0

flowSequence

IntField

0

ObservationDomainID

IntField

0

payload_guess

Possible sublayers: NetflowDataflowsetV9

post_build(pkt, pay)[源代码]
class scapy.layers.netflow.NetflowHeaderV5(_pkt, /, *, count=None, sysUptime=0, unixSecs=0, unixNanoSeconds=0, flowSequence=0, engineType=0, engineID=0, samplingInterval=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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             COUNT             |           SYSUPTIME           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |            UNIXSECS           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |        UNIXNANOSECONDS        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |          FLOWSEQUENCE         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |   ENGINETYPE  |    ENGINEID   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        SAMPLINGINTERVAL       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                       Fig. NetflowHeaderV5                       
NetflowHeaderV5 fields

count

ShortField

None

sysUptime

IntField

0

unixSecs

UTCTimeField

0

unixNanoSeconds

UTCTimeField

0

flowSequence

IntField

0

engineType

ByteField

0

engineID

ByteField

0

samplingInterval

ShortField

0

payload_guess

Possible sublayers: NetflowRecordV5

post_build(pkt, pay)[源代码]
class scapy.layers.netflow.NetflowHeaderV9(_pkt, /, *, count=None, sysUptime=0, unixSecs=None, packageSequence=0, SourceID=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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             COUNT             |           SYSUPTIME           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |            UNIXSECS           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |        PACKAGESEQUENCE        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |            SOURCEID           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                       Fig. NetflowHeaderV9                       
NetflowHeaderV9 fields

count

ShortField

None

sysUptime

IntField

0

unixSecs

UTCTimeField

None

packageSequence

IntField

0

SourceID

IntField

0

payload_guess

Possible sublayers: NetflowDataflowsetV9

post_build(pkt, pay)[源代码]
class scapy.layers.netflow.NetflowOptionsFlowset10(_pkt, /, *, flowSetID=3, length=None, templateID=255, field_count=None, scope_field_count=None, scopes=[], options=[], pad=None)[源代码]

基类:NetflowOptionsFlowsetV9

Netflow V10 (IPFix) Options Template FlowSet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           FLOWSETID           |             LENGTH            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           TEMPLATEID          |          FIELD COUNT          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       SCOPE FIELD COUNT       |             SCOPES            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            OPTIONS            |              PAD              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                   Fig. NetflowOptionsFlowset10                   
NetflowOptionsFlowset10 fields

flowSetID

ShortField

3

length

ShortField

None

templateID

ShortField

255

field_count

FieldLenField

None

scope_field_count

FieldLenField

None

scopes

PacketListField

[]

options

PacketListField

[]

pad

StrLenField

None

post_build(pkt, pay)[源代码]
class scapy.layers.netflow.NetflowOptionsFlowsetOptionV9(_pkt, /, *, enterpriseBit=0, optionFieldType=None, optionFieldlength=0, enterpriseNumber=0)[源代码]

基类:Packet

aliastypes
default_payload_class(p)[源代码]
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|E|       OPTIONFIELDTYPE       |       OPTIONFIELDLENGTH       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        ENTERPRISENUMBER       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                Fig. NetflowOptionsFlowsetOptionV9                
NetflowOptionsFlowsetOptionV9 fields

enterpriseBit

BitField (1 bit)

0

optionFieldType

BitEnumField

None

optionFieldlength

ShortField

0

enterpriseNumber

ShortField (Cond)

0

class scapy.layers.netflow.NetflowOptionsFlowsetScopeV9(_pkt, /, *, scopeFieldType=None, scopeFieldlength=0)[源代码]

基类:Packet

aliastypes
default_payload_class(p)[源代码]
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         SCOPEFIELDTYPE        |        SCOPEFIELDLENGTH       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                Fig. NetflowOptionsFlowsetScopeV9                 
NetflowOptionsFlowsetScopeV9 fields

scopeFieldType

ShortEnumField

None

scopeFieldlength

ShortField

0

class scapy.layers.netflow.NetflowOptionsFlowsetV9(_pkt, /, *, flowSetID=1, length=None, templateID=255, option_scope_length=None, option_field_length=None, scopes=[], options=[], pad=None)[源代码]

基类:Packet

aliastypes
default_payload_class(p)[源代码]
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           FLOWSETID           |             LENGTH            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           TEMPLATEID          |      OPTION SCOPE LENGTH      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      OPTION FIELD LENGTH      |             SCOPES            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            OPTIONS            |              PAD              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                   Fig. NetflowOptionsFlowsetV9                   
NetflowOptionsFlowsetV9 fields

flowSetID

ShortField

1

length

ShortField

None

templateID

ShortField

255

option_scope_length

FieldLenField

None

option_field_length

FieldLenField

None

scopes

PacketListField

[]

options

PacketListField

[]

pad

StrLenField

None

payload_guess

Possible sublayers: NetflowDataflowsetV9

post_build(pkt, pay)[源代码]
class scapy.layers.netflow.NetflowOptionsRecordOptionV9(_pkt, /, *, fieldValue=b'')[源代码]

基类:NetflowRecordV9

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           FIELDVALUE          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                Fig. NetflowOptionsRecordOptionV9                 
NetflowOptionsRecordOptionV9 fields

fieldValue

StrField

b''

class scapy.layers.netflow.NetflowOptionsRecordScopeV9(_pkt, /, *, fieldValue=b'')[源代码]

基类:NetflowRecordV9

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           FIELDVALUE          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                 Fig. NetflowOptionsRecordScopeV9                 
NetflowOptionsRecordScopeV9 fields

fieldValue

StrField

b''

class scapy.layers.netflow.NetflowRecordV1(_pkt, /, *, ipsrc='0.0.0.0', ipdst='0.0.0.0', nexthop='0.0.0.0', inputIfIndex=0, outpuIfIndex=0, dpkts=0, dbytes=0, starttime=0, endtime=0, srcport=0, dstport=0, padding=0, proto=0, tos=0, padding1=0, padding2=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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             IPSRC                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             IPDST                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            NEXTHOP                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          INPUTIFINDEX         |          OUTPUIFINDEX         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             DPKTS                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             DBYTES                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           STARTTIME                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            ENDTIME                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            SRCPORT            |            DSTPORT            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            PADDING            |     PROTO     |      TOS      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            PADDING1                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            PADDING2                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                       Fig. NetflowRecordV1                       
NetflowRecordV1 fields

ipsrc

IPField

'0.0.0.0'

ipdst

IPField

'0.0.0.0'

nexthop

IPField

'0.0.0.0'

inputIfIndex

ShortField

0

outpuIfIndex

ShortField

0

dpkts

IntField

0

dbytes

IntField

0

starttime

IntField

0

endtime

IntField

0

srcport

ShortField

0

dstport

ShortField

0

padding

ShortField

0

proto

ByteField

0

tos

ByteField

0

padding1

IntField

0

padding2

IntField

0

payload_guess

Possible sublayers: NetflowRecordV1

class scapy.layers.netflow.NetflowRecordV5(_pkt, /, *, src='127.0.0.1', dst='127.0.0.1', nexthop='0.0.0.0', input=0, output=0, dpkts=1, dOctets=60, first=0, last=0, srcport=0, dstport=0, pad1=0, tcpFlags=<Flag 2 (S)>, prot=6, tos=0, src_as=0, dst_as=0, src_mask=0, dst_mask=0, pad2=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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              SRC                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              DST                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            NEXTHOP                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             INPUT             |             OUTPUT            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             DPKTS                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            DOCTETS                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             FIRST                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              LAST                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            SRCPORT            |            DSTPORT            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      PAD1     |    TCPFLAGS   |      PROT     |      TOS      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             SRC AS            |             DST AS            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    SRC MASK   |    DST MASK   |              PAD2             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                       Fig. NetflowRecordV5                       
NetflowRecordV5 fields

src

IPField

'127.0.0.1'

dst

IPField

'127.0.0.1'

nexthop

IPField

'0.0.0.0'

input

ShortField

0

output

ShortField

0

dpkts

IntField

1

dOctets

IntField

60

first

IntField

0

last

IntField

0

srcport

ShortField

0

dstport

ShortField

0

pad1

ByteField

0

tcpFlags

FlagsField

<Flag 2 (S)>

prot

ByteEnumField

6

tos

ByteField

0

src_as

ShortField

0

dst_as

ShortField

0

src_mask

ByteField

0

dst_mask

ByteField

0

pad2

ShortField

0

payload_guess

Possible sublayers: NetflowRecordV5

class scapy.layers.netflow.NetflowRecordV9(_pkt, /, *, fieldValue=b'')[源代码]

基类:Packet

aliastypes
default_payload_class(p)[源代码]
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           FIELDVALUE          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                       Fig. NetflowRecordV9                       
NetflowRecordV9 fields

fieldValue

StrField

b''

class scapy.layers.netflow.NetflowSession(*args, **kwargs)[源代码]

基类:IPSession

Session used to defragment NetflowV9/10 packets on the flow. See help(scapy.layers.netflow) for more infos.

on_packet_received(pkt)[源代码]
class scapy.layers.netflow.NetflowTemplateFieldV9(_pkt, /, *, enterpriseBit=0, fieldType=None, fieldLength=None, enterpriseNumber=0)[源代码]

基类:Packet

aliastypes
default_payload_class(p)[源代码]
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|E|          FIELDTYPE          |          FIELDLENGTH          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        ENTERPRISENUMBER                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                   Fig. NetflowTemplateFieldV9                    
NetflowTemplateFieldV9 fields

enterpriseBit

BitField (1 bit)

0

fieldType

BitEnumField

None

fieldLength

ShortField

None

enterpriseNumber

IntField (Cond)

0

class scapy.layers.netflow.NetflowTemplateV9(_pkt, /, *, templateID=255, fieldCount=None, template_fields=[])[源代码]

基类:Packet

aliastypes
default_payload_class(p)[源代码]
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           TEMPLATEID          |           FIELDCOUNT          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        TEMPLATE FIELDS        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                      Fig. NetflowTemplateV9                      
NetflowTemplateV9 fields

templateID

ShortField

255

fieldCount

FieldLenField

None

template_fields

PacketListField

[]

class scapy.layers.netflow.ShortOrInt(name: str, default: int | None)[源代码]

基类:IntField

getfield(pkt, x)[源代码]
scapy.layers.netflow.ipfix_defragment(*args, **kwargs)[源代码]

Alias for netflowv9_defragment

scapy.layers.netflow.netflowv9_defragment(plist, verb=1)[源代码]

Process all NetflowV9/10 Packets to match IDs of the DataFlowsets with the Headers

params:
  • plist: the list of mixed NetflowV9/10 packets.

  • verb: verbose print (0/1)