本文整理匯總了Python中scapy.supersocket.SuperSocket.close方法的典型用法代碼示例。如果您正苦於以下問題:Python SuperSocket.close方法的具體用法?Python SuperSocket.close怎麽用?Python SuperSocket.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scapy.supersocket.SuperSocket
的用法示例。
在下文中一共展示了SuperSocket.close方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_if_list
# 需要導入模塊: from scapy.supersocket import SuperSocket [as 別名]
# 或者: from scapy.supersocket.SuperSocket import close [as 別名]
def get_if_list():
try:
f = open("/proc/net/dev", "rb")
except IOError:
try:
f.close()
except Exception:
pass
warning("Can't open /proc/net/dev !")
return []
lst = []
f.readline()
f.readline()
for line in f:
line = plain_str(line)
lst.append(line.split(":")[0].strip())
f.close()
return lst
示例2: in6_getifaddr
# 需要導入模塊: from scapy.supersocket import SuperSocket [as 別名]
# 或者: from scapy.supersocket.SuperSocket import close [as 別名]
def in6_getifaddr():
"""
Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'ifcace'.
This is the list of all addresses of all interfaces available on
the system.
"""
ret = []
try:
f = open("/proc/net/if_inet6","rb")
except IOError as err:
return ret
l = f.readlines()
for i in l:
# addr, index, plen, scope, flags, ifname
tmp = i.split()
addr = struct.unpack('4s4s4s4s4s4s4s4s', tmp[0])
addr = scapy.utils6.in6_ptop(b':'.join(addr).decode('ascii'))
ret.append((addr, int(tmp[3], 16), tmp[5].decode('ascii'))) # (addr, scope, iface)
f.close()
return ret
示例3: get_if
# 需要導入模塊: from scapy.supersocket import SuperSocket [as 別名]
# 或者: from scapy.supersocket.SuperSocket import close [as 別名]
def get_if(iff,cmd):
s=socket.socket()
ifreq = ioctl(s, cmd, struct.pack("16s16x",iff))
s.close()
return ifreq
示例4: close
# 需要導入模塊: from scapy.supersocket import SuperSocket [as 別名]
# 或者: from scapy.supersocket.SuperSocket import close [as 別名]
def close(self):
if self.closed:
return
self.closed=1
if self.promisc:
for i in self.iff:
set_promisc(self.ins, i, 0)
SuperSocket.close(self)
示例5: close
# 需要導入模塊: from scapy.supersocket import SuperSocket [as 別名]
# 或者: from scapy.supersocket.SuperSocket import close [as 別名]
def close(self):
SuperSocket.close(self)
self.usbpcap_proc.kill()
示例6: in6_getifaddr
# 需要導入模塊: from scapy.supersocket import SuperSocket [as 別名]
# 或者: from scapy.supersocket.SuperSocket import close [as 別名]
def in6_getifaddr():
"""
Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'iface'.
This is the list of all addresses of all interfaces available on
the system.
"""
ret = []
try:
fdesc = open("/proc/net/if_inet6", "rb")
except IOError:
return ret
for line in fdesc:
# addr, index, plen, scope, flags, ifname
tmp = plain_str(line).split()
addr = scapy.utils6.in6_ptop(
b':'.join(
struct.unpack('4s4s4s4s4s4s4s4s', tmp[0].encode())
).decode()
)
# (addr, scope, iface)
ret.append((addr, int(tmp[3], 16), tmp[5]))
fdesc.close()
return ret
示例7: close
# 需要導入模塊: from scapy.supersocket import SuperSocket [as 別名]
# 或者: from scapy.supersocket.SuperSocket import close [as 別名]
def close(self):
if not self.closed:
self.impl.close()
self.outs = None
self.ins = None
SuperSocket.close(self)
示例8: __del__
# 需要導入模塊: from scapy.supersocket import SuperSocket [as 別名]
# 或者: from scapy.supersocket.SuperSocket import close [as 別名]
def __del__(self):
self.close()