本文整理汇总了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()