如何将scapy对象转换为字符串

问题描述 投票:0回答:1

我有一个用例,其中我将在远程服务器上创建一个scapy数据包(出于自动化的目的,并且需要将该scapy数据包传递到我需要触发实际流量的相应设备。

For eg:
        ip_layer = IP(src='x.x.x.x', dst='y.y.y.y')
        icmp_layer = ICMP(type=3, code=1)
        my_pkt = ip_layer/icmp_layer

我如何通过创建的这个漏斗对象(my_pkt)将其用于在其他设备上发送有没有一种方法可以将整个scapy对象转换为string,并仅在rmeote服务器上使用send(scapy_str)。从Scapy文档中,我看到存在export_objects,import_objects。但是export_objects只是打印它而不返回值。任何帮助,不胜感激

python scapy
1个回答
0
投票
bytes(my_pkt)

字节字符串是网络中使用的字符串

© www.soinside.com 2019 - 2024. All rights reserved.