I'm trying to create raw socket in python on OS : windows. It doesn't work and I saw it might be due to premissions. Anyone know how can I check if I have premissions or how to get them? Thank you!
This is the error message after writing 3 lines:
import socket
import sys
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)
You need to be a member of the Administrators group.
See TCP/IP Raw Sockets in the MSDN:
Raw sockets offer the capability to manipulate the underlying transport, so they can be used for malicious purposes that pose a security threat. Therefore, only members of the Administrators group can create sockets of type
SOCK_RAW
on Windows 2000 and later.
and
Note To use a socket of type
SOCK_RAW
requires administrative privileges. Users running Winsock applications that use raw sockets must be a member of the Administrators group on the local computer, otherwise raw socket calls will fail with an error code ofWSAEACCES
. On Windows Vista and later, access for raw sockets is enforced at socket creation. In earlier versions of Windows, access for raw sockets is enforced during other socket operations.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.