import socket
from socket import *
conn = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(3))
I'm facing this error:
AttributeError: type object 'socket' has no attribute 'socket'
You've imported socket and then imported * from socket.
As socket has a socket function in it python is likely getting confused and using the socket inside socket when you're calling socket.socket.
I would drop the from socket import * and work from there.
from socket import thismodule"If you import all library don't need to name library before method:"
Option 1 - import library:
import socket
conn = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
Option 2 - from library import all:
from socket import *
conn = socket( AF_INET, SOCK_STREAM )