karpierz / pcap-ct

Python wrapper for the pcap library.
BSD 3-Clause "New" or "Revised" License
19 stars 4 forks source link

pcap-ct 1.2.3b6 missing dependency on pkg_about and missing metadata #7

Closed larsch closed 3 years ago

larsch commented 3 years ago
C:\>python
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Tools\Python39\lib\site-packages\pcap\__init__.py", line 5, in <module>
    from .__about__ import * ; del __about__  # noqa
  File "C:\Tools\Python39\lib\site-packages\pcap\__about__.py", line 5, in <module>
    __import__("pkg_about").about()
ModuleNotFoundError: No module named 'pkg_about'
>>> exit()

C:\> pip install pkg_about
Collecting pkg_about
  Using cached pkg_about-1.0.2-py3-none-any.whl (4.8 kB)
Requirement already satisfied: importlib-resources>=5.2.0 in c:\tools\python39\lib\site-packages (from pkg_about) (5.2.2)
Requirement already satisfied: importlib-metadata>=4.6.1 in c:\tools\python39\lib\site-packages (from pkg_about) (4.6.4)
Requirement already satisfied: packaging>=21.0.0 in c:\tools\python39\lib\site-packages (from pkg_about) (21.0)
Requirement already satisfied: setuptools>=42.0.2 in c:\tools\python39\lib\site-packages (from pkg_about) (56.0.0)
Requirement already satisfied: zipp>=0.5 in c:\tools\python39\lib\site-packages (from importlib-metadata>=4.6.1->pkg_about) (3.5.0)
Requirement already satisfied: pyparsing>=2.0.2 in c:\tools\python39\lib\site-packages (from packaging>=21.0.0->pkg_about) (2.4.7)
Installing collected packages: pkg-about
Successfully installed pkg-about-1.0.2
WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.
You should consider upgrading via the 'c:\tools\python39\python.exe -m pip install --upgrade pip' command.

C:\> python
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Tools\Python39\lib\site-packages\pcap\__init__.py", line 5, in <module>
    from .__about__ import * ; del __about__  # noqa
  File "C:\Tools\Python39\lib\site-packages\pcap\__about__.py", line 5, in <module>
    __import__("pkg_about").about()
  File "C:\Tools\Python39\lib\site-packages\pkg_about\_about.py", line 17, in about
    metadata = get_metadata(package)
  File "C:\Tools\Python39\lib\site-packages\importlib_metadata\__init__.py", line 947, in metadata
    return Distribution.from_name(distribution_name).metadata
  File "C:\Tools\Python39\lib\site-packages\importlib_metadata\__init__.py", line 524, in from_name
    raise PackageNotFoundError(name)
importlib_metadata.PackageNotFoundError: No package metadata was found for pcap
>>>
karpierz commented 3 years ago

Fixed. Thanks for the report.

D-LucasAraujo commented 2 years ago

How? I have the same problem

karpierz commented 2 years ago

Please try the latest release: pcap-ct 1.2.3b12

D-LucasAraujo commented 2 years ago

I'm a really really newbie, sorry. I was forgotten to execute the file setup.py ... This make all work !!! Thank you very much for the ansewr and sorry for my poor english, i'm a brazillian and my final project for my university is a network monitoring tool using libpcap. Professionals usually don't pay much attention to newbies.

karpierz commented 2 years ago

@D-LucasAraujo np :) Good luck with your studies! PS: Belevie me. My "English" is much worse than yours ;)

Best way to install libpcap is: python -m pip install -U pcap-ct It exist as package on the official pypi: Take a look at https://pypi.org/project/pcap-ct/

D-LucasAraujo commented 2 years ago

Hi @karpierz, good day. Can you give me a tip ?? I'm trying get a ip source address source of a packet. Is there a function for this in the library ?

D-LucasAraujo commented 2 years ago

Good night @karpierz, i noticed while studying your capture example that in the 'countme' function there are 2 parameters, pkd ​​and hdr. Could you give me a hint if it is possible to use these parameters to get the source ip of the package?