ValentinBELYN / icmplib

Easily forge ICMP packets and make your own ping and traceroute.
GNU Lesser General Public License v3.0
266 stars 46 forks source link

Privileged Mode failing on MacOS #51

Closed fbellom closed 2 years ago

fbellom commented 2 years ago

Hi, First of all, thank you for the library. I have been testing PING and Multiping, but it seems the privileged attribute is not working on macOS 11.6.5 with python 3.9.7

I'm calling the function as this

hosts = multiping( devices, count=3,interval=0.5,privileged=False)

if I used python as regular user, then I got

PermissionError: [Errno 1] Operation not permitted

no matter if I set ptivileged True or False.

If I try to use sudo python (to elevate privilege) then I got this error

request = ICMPRequest(TypeError: __init__() got an unexpected keyword argument 'privileged

again it doesn't matter if I passed True or False to the argument.

The same behavior is with ping function. With this sentence

host = ping('10.74.200.1', privileged=False) an error is raised,

icmplib.exceptions.SocketPermissionError: Root privileges are required to create the socket

and also ther is no effect on change the privileged argument to True or False.

this are the version installed

icmplib==3.0.3
icmplibv2==1.0.6

Thanks again for any hints to this situation

ValentinBELYN commented 2 years ago

Hi @fbellom 👋

I also use macOS Big Sur and Python 3.9 without seeing your problem.

The error message request = ICMPRequest(TypeError: __init__() got an unexpected keyword argument 'privileged' suggests that you are using an older version of icmplib (the privileged parameter was introduced in v2 and was therefore not available in v1).

Since you are using the latest version available (3.0.3), I think there is a problem in your imports. Indeed, you mention icmplibv2 which is a fork of my library in version 1 and which is not maintained by myself (by the way, I think it is not even maintained at all).

If that doesn't solve the problem and for further analysis, can you post your code (including imports) and the full exception?

Thanks!