本文整理汇总了Python中packet.Packet.content方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.content方法的具体用法?Python Packet.content怎么用?Python Packet.content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类packet.Packet
的用法示例。
在下文中一共展示了Packet.content方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import content [as 别名]
bullet_count = 0
for c in packet_string:
if(c == "|"):
bullet_count += 1
if(bullet_count == 1 and c != " " and c != "|"):
pkt_type += c
if(bullet_count == 2 and c != " " and c != "|"):
src_ip += c
if(bullet_count == 3 and c != " " and c != "|"):
dest_ip += c
if(bullet_count == 4 and c != " " and c != "|"):
content += c
packet.pkt_type = pkt_type
packet.src_ip = src_ip
packet.dest_ip = dest_ip
packet.content = content
packet.datetime = datetime.now()
packet_list.append(packet)
log = ""
udp_flag = True
http_flag = True
f = open("Output.txt", "w")
for p in packet_list:
if(p.pkt_type == "udp"):
if udp_flag == True:
p.server = "udp_1"
udp_flag = False
else:
p.server = "udp_2"
udp_flag = True
print("Mensagem: " + p.src_ip + ": " + p.content + "\n")