Can scapy errors be removed in exe created by pyinstaller?

22 Views Asked by At

I have a python scapy code and its running fine. I created the exe using pyinstaller and tried running from a 2nd pc in which python or scapy is not installed.

The tool runs fine on 2nd pc, but at the beginning, I get this error

ERROR: Loading module scapy.layers.dcerpc
Traceback (most recent call last):
  File "scapy\main.py", line 191, in _load
  File "importlib\__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "scapy\layers\dcerpc.py", line 30, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "scapy\layers\dns.py", line 1262, in <module>
  File "scapy\arch\windows\__init__.py", line 1035, in read_nameservers
AttributeError: 'NetworkInterface' object has no attribute 'nameservers'

Can these errors be removed without installing scapy on 2nd pc?

1

There are 1 best solutions below

0
Sadra Sabouri On

Use --path [PYTHON_SITE_PACKAGES_PATH] flag while using pyinstaller to include your libraries. I highly recommend you to check this post for more information.