hieulw / cicflowmeter

MIT License
20 stars 3 forks source link

Decimal error when convert pcap to csv #5

Open MuMuuuu opened 1 week ago

MuMuuuu commented 1 week ago

Error : message

Garbage Collection Finished. Flows = 4
Garbage Collection Began. Flows = 4
Exception in thread AsyncSniffer:
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/scapy/sendrecv.py", line 1275, in _run
    self.results = session.toPacketList()
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/cicflowmeter-0.1.6-py3.11.egg/cicflowmeter/flow_session.py", line 35, in toPacketList
  File "/usr/local/lib/python3.11/dist-packages/cicflowmeter-0.1.6-py3.11.egg/cicflowmeter/flow_session.py", line 116, in garbage_collect
  File "/usr/local/lib/python3.11/dist-packages/cicflowmeter-0.1.6-py3.11.egg/cicflowmeter/flow.py", line 84, in get_data
  File "/usr/local/lib/python3.11/dist-packages/cicflowmeter-0.1.6-py3.11.egg/cicflowmeter/utils.py", line 29, in get_statistics
  File "/home/kali/.local/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 3504, in mean
    return _methods._mean(a, axis=axis, dtype=dtype,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/.local/lib/python3.11/site-packages/numpy/core/_methods.py", line 131, in _mean
    ret = ret / rcount
          ~~~~^~~~~~~~
  File "/usr/lib/python3/dist-packages/scapy/utils.py", line 131, in __truediv__
    return EDecimal(Decimal.__truediv__(self, Decimal(other)))
                                              ^^^^^^^^^^^^^^
TypeError: conversion from numpy.int64 to Decimal is not supported

OS : Kali GNU/Linux Rolling Python version : Python 3.11.6

scipy==1.14.0
scapy==2.5.0
numpy==1.26.3

Also translate pcap to csv with no error but result in empty csv. image

hieulw commented 4 days ago

how do you install this tool ? It looks like you're using the old version You can this way: https://github.com/hieulw/cicflowmeter?tab=readme-ov-file#installation Or

pip install -U cicflowmeter