当前位置: 首页>>代码示例>>Python>>正文


Python SuperSocket.send方法代码示例

本文整理汇总了Python中scapy.supersocket.SuperSocket.send方法的典型用法代码示例。如果您正苦于以下问题:Python SuperSocket.send方法的具体用法?Python SuperSocket.send怎么用?Python SuperSocket.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scapy.supersocket.SuperSocket的用法示例。


在下文中一共展示了SuperSocket.send方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: send

# 需要导入模块: from scapy.supersocket import SuperSocket [as 别名]
# 或者: from scapy.supersocket.SuperSocket import send [as 别名]
 def send(self, x):
 
     pkt_src_mac_field,pkt_src_mac_val = x.getfield_and_val('src')
     if self.__use_iface and pkt_src_mac_val is None:
         iff = self.iface
         if iff:
             try:
                 src_mac = scapy.arch.get_if_hwaddr(iff)
             except:
                 pass
         if src_mac is None:
             src_mac = "00:00:00:00:00:00"
         x.src = scapy.fields.MACField.i2h(pkt_src_mac_field, x, src_mac)
     
     if x.haslayer('IP') :
         pkt_src_ip_field,pkt_src_ip_val = x['IP'].getfield_and_val('src')
         if isinstance(pkt_src_ip_field,scapy.fields.Emph):
             pkt_src_ip_field = pkt_src_ip_field.fld
         if self.__use_iface and pkt_src_ip_val is None:
             iff = self.iface
             if iff:
                 try:
                     src_ip = scapy.arch.get_if_addr(iff)
                 except:
                     pass
             x['IP'].src = scapy.fields.SourceIPField.i2h(pkt_src_ip_field, x, src_ip)
         
     SuperSocket.send(self, x)
开发者ID:ogreworld,项目名称:ScapyExtension,代码行数:30,代码来源:pcapdnet.py

示例2: send

# 需要导入模块: from scapy.supersocket import SuperSocket [as 别名]
# 或者: from scapy.supersocket.SuperSocket import send [as 别名]
 def send(self, x):
     try:
         return SuperSocket.send(self, x)
     except socket.error as msg:
         if msg[0] == 22 and len(x) < conf.min_pkt_size:
             padding = b"\x00" * (conf.min_pkt_size - len(x))
             if isinstance(x, Packet):
                 return SuperSocket.send(self, x / Padding(load=padding))
             else:
                 return SuperSocket.send(self, raw(x) + padding)
         raise
开发者ID:plorinquer,项目名称:scapy,代码行数:13,代码来源:linux.py

示例3: send

# 需要导入模块: from scapy.supersocket import SuperSocket [as 别名]
# 或者: from scapy.supersocket.SuperSocket import send [as 别名]
    def send(self, x):
        try:
            if hasattr(x, "sent_time"):
                x.sent_time = time.time()

            # need to change the byteoder of the first four bytes,
            # required by the underlying Linux SocketCAN frame format
            bs = bytes(x)
            bs = bs + b'\x00' * (CAN_FRAME_SIZE - len(bs))
            bs = struct.pack("<I12s", *struct.unpack(">I12s", bs))
            return SuperSocket.send(self, bs)
        except socket.error as msg:
            raise msg
开发者ID:segment-routing,项目名称:scapy,代码行数:15,代码来源:cansocket_native.py


注:本文中的scapy.supersocket.SuperSocket.send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。