Small changes to PR #37 preventing infinite loops; bump version
Closes #37
This commit is contained in:
parent
b8e911a40a
commit
8b5675913d
|
@ -538,8 +538,6 @@ class V9ExportPacket:
|
||||||
elif isinstance(matched_template, V9OptionsTemplateRecord):
|
elif isinstance(matched_template, V9OptionsTemplateRecord):
|
||||||
odfs = V9OptionsDataFlowset(data[offset:], matched_template)
|
odfs = V9OptionsDataFlowset(data[offset:], matched_template)
|
||||||
self._options += odfs.option_data_records
|
self._options += odfs.option_data_records
|
||||||
if odfs.length == 0:
|
|
||||||
break
|
|
||||||
if odfs.length == 0:
|
if odfs.length == 0:
|
||||||
break
|
break
|
||||||
offset += odfs.length
|
offset += odfs.length
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='netflow',
|
name='netflow',
|
||||||
version='0.11.0',
|
version='0.11.1',
|
||||||
description='NetFlow v1, v5, v9 and IPFIX tool suite implemented in Python 3',
|
description='NetFlow v1, v5, v9 and IPFIX tool suite implemented in Python 3',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|
|
@ -188,7 +188,7 @@ PACKETS_V9 = [
|
||||||
"0000059c000000140000000000000000e8200050061b0400",
|
"0000059c000000140000000000000000e8200050061b0400",
|
||||||
]
|
]
|
||||||
|
|
||||||
PACKET_V9_WITH_PL = (
|
PACKET_V9_WITH_ZEROS = (
|
||||||
"000900057b72e830620b717d78cf34e30102000001040048000000000000006e0000000101000000"
|
"000900057b72e830620b717d78cf34e30102000001040048000000000000006e0000000101000000"
|
||||||
"000a20076a06065c0800000d6b15c80000000b7b72e4487b72e448080000000000000438bf6401c7"
|
"000a20076a06065c0800000d6b15c80000000b7b72e4487b72e448080000000000000438bf6401c7"
|
||||||
"65ad1e0d6b15c8000000000001040048000000000000006700000001110000c951ac180b0306065c"
|
"65ad1e0d6b15c8000000000001040048000000000000006700000001110000c951ac180b0306065c"
|
||||||
|
|
|
@ -13,7 +13,7 @@ import random
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from tests.lib import send_recv_packets, NUM_PACKETS, \
|
from tests.lib import send_recv_packets, NUM_PACKETS, \
|
||||||
PACKET_INVALID, PACKET_V1, PACKET_V5, PACKET_V9_WITH_PL, \
|
PACKET_INVALID, PACKET_V1, PACKET_V5, PACKET_V9_WITH_ZEROS, \
|
||||||
PACKET_V9_TEMPLATE, PACKET_V9_TEMPLATE_MIXED, PACKETS_V9
|
PACKET_V9_TEMPLATE, PACKET_V9_TEMPLATE_MIXED, PACKETS_V9
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class TestFlowExportNetflow(unittest.TestCase):
|
||||||
self.assertEqual(len(pkts), 0) # no export is parsed due to missing template
|
self.assertEqual(len(pkts), 0) # no export is parsed due to missing template
|
||||||
|
|
||||||
# send an invalid packet with zero bytes, must fail to parse
|
# send an invalid packet with zero bytes, must fail to parse
|
||||||
pkts, _, _ = send_recv_packets([PACKET_V9_WITH_PL])
|
pkts, _, _ = send_recv_packets([PACKET_V9_WITH_ZEROS])
|
||||||
self.assertEqual(len(pkts), 0) # no export is parsed due to missing template
|
self.assertEqual(len(pkts), 0) # no export is parsed due to missing template
|
||||||
|
|
||||||
# send packet with two templates and eight flows, should parse correctly since the templates are known
|
# send packet with two templates and eight flows, should parse correctly since the templates are known
|
||||||
|
|
Loading…
Reference in a new issue