Open joveice opened 6 years ago
Turns out, I get the IP but I can't send it again unless I do w.send(packet, False) and when I do that the packet doesn't get sendt / ends up somewhere else.
More info. It seems to be different from time to time, sometimes I can print the IP and send it, sometimes I can't print and send it.
I got the same bug
This seems to be due to changes in WinDivert 1.4: https://reqrypt.org/windivert-changelog.txt. The PyPI wheel bundles 1.3, so not sure how you are getting that. Are you installing from source?
Installed from pip and it's including 1.3 not 1.4. I noticed if you access both src and dst address it works 10 of 10 times.
I found if I call some other function, that could set the LastError. and w.send() calls checksum helper function, which checks it. I tryed windll.kernel32.SetLastError(0) before w.send(). it helped.
I had this problem in this code:
for itm in psutil.net_connections():
if itm.laddr.port == lport: # and itm.laddr.ip == lip:
pname = psutil.Process(itm.pid).name()
print("pkt from process {}".format(pname))
windll.kernel32.SetLastError(0) # this helped
wd.send(pkt)
Error:
Whats this? Why can't I get the IP?