- fixed pcap supersockets warnings

This commit is contained in:
pbi 2005-05-25 13:05:03 +00:00
parent 6fd7e1a85b
commit 79fa9982eb
1 changed files with 10 additions and 4 deletions

View File

@ -21,6 +21,9 @@
# #
# $Log: scapy.py,v $ # $Log: scapy.py,v $
# Revision 0.9.17.95 2005/05/25 15:05:03 pbi
# - fixed pcap supersockets warnings
#
# Revision 0.9.17.94 2005/05/25 15:01:24 pbi # Revision 0.9.17.94 2005/05/25 15:01:24 pbi
# - fixed/cleaned ISAKMP # - fixed/cleaned ISAKMP
# #
@ -779,7 +782,7 @@
from __future__ import generators from __future__ import generators
RCSID="$Id: scapy.py,v 0.9.17.94 2005/05/25 15:01:24 pbi Exp $" RCSID="$Id: scapy.py,v 0.9.17.95 2005/05/25 15:05:03 pbi Exp $"
VERSION = RCSID.split()[2]+"beta" VERSION = RCSID.split()[2]+"beta"
@ -5609,6 +5612,7 @@ class L3dnetSocket(SuperSocket):
self.ins = pcap.pcapObject() self.ins = pcap.pcapObject()
if iface is None: if iface is None:
iface = conf.iface iface = conf.iface
self.iface = iface
self.ins.open_live(iface, 1600, 0, 100) self.ins.open_live(iface, 1600, 0, 100)
self.ins.setnonblock(1) self.ins.setnonblock(1)
try: try:
@ -5636,7 +5640,7 @@ class L3dnetSocket(SuperSocket):
if LLTypes.has_key(ll): if LLTypes.has_key(ll):
cls = LLTypes[ll] cls = LLTypes[ll]
else: else:
warning("Unable to guess type (interface=%s protocol=%#x family=%i). Using Ethernet" % (sa_ll[0],sa_ll[1],sa_ll[3])) warning("Unable to guess datalink type (interface=%s linktype=%i). Using Ethernet" % (self.iface, ll))
cls = Ether cls = Ether
pkt = None pkt = None
@ -5658,6 +5662,7 @@ class L2dnetSocket(SuperSocket):
def __init__(self, iface = None, type = ETH_P_ALL, filter=None): def __init__(self, iface = None, type = ETH_P_ALL, filter=None):
if iface is None: if iface is None:
iface = conf.iface iface = conf.iface
self.iface = iface
self.ins = pcap.pcapObject() self.ins = pcap.pcapObject()
self.ins.open_live(iface, 1600, 0, 100) self.ins.open_live(iface, 1600, 0, 100)
self.ins.setnonblock(1) self.ins.setnonblock(1)
@ -5679,7 +5684,7 @@ class L2dnetSocket(SuperSocket):
if LLTypes.has_key(ll): if LLTypes.has_key(ll):
cls = LLTypes[ll] cls = LLTypes[ll]
else: else:
warning("Unable to guess type (interface=%s protocol=%#x family=%i). Using Ethernet" % (sa_ll[0],sa_ll[1],sa_ll[3])) warning("Unable to guess datalink type (interface=%s linktype=%i). Using Ethernet" % (self.iface, ll))
cls = Ether cls = Ether
pkt = None pkt = None
@ -5707,6 +5712,7 @@ class L2pcapListenSocket(SuperSocket):
self.type = type self.type = type
self.outs = None self.outs = None
self.ins = pcap.pcapObject() self.ins = pcap.pcapObject()
self.iface = iface
if iface is None: if iface is None:
iface = conf.iface iface = conf.iface
if promisc is None: if promisc is None:
@ -5735,7 +5741,7 @@ class L2pcapListenSocket(SuperSocket):
if LLTypes.has_key(ll): if LLTypes.has_key(ll):
cls = LLTypes[ll] cls = LLTypes[ll]
else: else:
warning("Unable to guess type (interface=%s protocol=%#x family=%i). Using Ethernet" % (sa_ll[0],sa_ll[1],sa_ll[3])) warning("Unable to guess datalink type (interface=%s linktype=%i). Using Ethernet" % (self.iface, ll))
cls = Ether cls = Ether
pkt = None pkt = None