ffalcinelli / pydivert

A Python binding for WinDivert driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't run given example code

RaktimRay opened this issue · comments

I'm trying the given example code and I'm getting an error when I run it.
The Code:

import pydivert

w = pydivert.WinDivert("tcp.DstPort == 80 and tcp.PayloadLength > 0")
w.open()

The error:

Traceback (most recent call last):
  File "C:/Python 3.7 projects/Blocker/test.py", line 4, in <module>
    w.open()
  File "C:\Python 3.7 projects\Blocker\venv\lib\site-packages\pydivert\windivert.py", line 146, in open
    self._flags)
  File "C:\Python 3.7 projects\Blocker\venv\lib\site-packages\pydivert\windivert_dll\__init__.py", line 117, in prox
    return getattr(_module, funcname)(*args, **kwargs)
  File "C:\Python 3.7 projects\Blocker\venv\lib\site-packages\pydivert\windivert_dll\__init__.py", line 54, in wrapper
    raise err
PermissionError: [WinError 5] Access is denied.

Process finished with exit code 1

Please suggest me how to fix this

Use an elevated command prompt to run the .py file. WinDivert requires Administrator Privileges to start capturing packets.