Code: Alles auswählen
#!/usr/bin/python
# -*- coding: latin-1 -*-
import socket
def PacketSniffer():
HOST = socket.gethostbyname(socket.gethostname())
try:
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
except:
print("acess denied")
return
s.bind((HOST, 0))
s.setsockopt(socket.IPPROTO_IP, 3, 1)
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
while 1:
print s.recvfrom(65565)
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)
PacketSniffer()
Der Packetverlauf ist ohne das "Receive all" aber dementsprechend eingeschränkt und ich komme nicht an alle packets.
Gibt es eine Alternative zu socket.ioctl() die auch unter Python 2.2 funktioniert oder ist die Suche das komplett via Python zu machen hoffnungslos?
MfG DaRealFreak