本文整理匯總了Python中scapy.layers.l2.Dot3方法的典型用法代碼示例。如果您正苦於以下問題:Python l2.Dot3方法的具體用法?Python l2.Dot3怎麽用?Python l2.Dot3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scapy.layers.l2
的用法示例。
在下文中一共展示了l2.Dot3方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: constructPAS5211Frames
# 需要導入模塊: from scapy.layers import l2 [as 別名]
# 或者: from scapy.layers.l2 import Dot3 [as 別名]
def constructPAS5211Frames(msg, seq, src_mac, dst_mac, channel_id=-1,
onu_id=-1, onu_session_id=-1):
assert isinstance(msg, PAS5211Msg)
opcode = 0x3000 | msg.opcode
inner_msg = PAS5211MsgHeader(
sequence_number=seq,
opcode=opcode,
channel_id=channel_id,
onu_id=onu_id,
onu_session_id=onu_session_id
) / msg
size = len(inner_msg)
frame_body = PAS5211FrameHeader(size=size) / inner_msg
frame = Dot3(src=src_mac, dst=dst_mac) / frame_body
return frame
示例2: negotiate_trunk
# 需要導入模塊: from scapy.layers import l2 [as 別名]
# 或者: from scapy.layers.l2 import Dot3 [as 別名]
def negotiate_trunk(iface=conf.iface, mymac=str(RandMAC())):
print "Trying to negotiate a trunk on interface %s" % iface
p = Dot3(src=mymac, dst="01:00:0c:cc:cc:cc")/LLC()/SNAP()/DTP(tlvlist=[DTPDomain(),DTPStatus(),DTPType(),DTPNeighbor(neighbor=mymac)])
sendp(p)
示例3: negotiate_trunk
# 需要導入模塊: from scapy.layers import l2 [as 別名]
# 或者: from scapy.layers.l2 import Dot3 [as 別名]
def negotiate_trunk(iface=conf.iface, mymac=str(RandMAC())):
print("Trying to negotiate a trunk on interface %s" % iface)
p = Dot3(src=mymac, dst="01:00:0c:cc:cc:cc") / LLC()
p /= SNAP()
p /= DTP(tlvlist=[DTPDomain(), DTPStatus(), DTPType(), DTPNeighbor(neighbor=mymac)]) # noqa: E501
sendp(p)
示例4: negotiate_trunk
# 需要導入模塊: from scapy.layers import l2 [as 別名]
# 或者: from scapy.layers.l2 import Dot3 [as 別名]
def negotiate_trunk(iface=conf.iface, mymac=str(RandMAC())):
print("Trying to negotiate a trunk on interface %s" % iface)
p = Dot3(src=mymac, dst="01:00:0c:cc:cc:cc")/LLC()/SNAP()/DTP(tlvlist=[DTPDomain(),DTPStatus(),DTPType(),DTPNeighbor(neighbor=mymac)])
sendp(p)