Scapy 在嗅探数据包后显示数据包内容 - UnicodeEncodeError
我想每次收到它们时都会嗅探伪像连接消息并打印以安装邮件。因此,我使用了Scapy 嗅探
方法。每次收到连接
frame时,都会显示以下错误。 连接
-message的格式正确,在Wireshark中可见。每次收到这样的框架时,嗅探方法都会流产。如果我用Wireshark导出框架,并使用SCAPY读取.pcap-file,则框架将正确显示。你有什么建议吗?我目前正在使用Python 3.8.10和Scapy版本2.4.5rc1.dev205。谢谢!
UnicodeCodeError:“ Latin-1”编解码器无法编码字符'\ u0797'位置595:不在范围内(256)
def update_connect_load(pkt):
pkt.show2()
def stopFilter(x):
return False
sniff(
filter=f"ether src {mac_address}",
store=0,
count=-1,
prn=update_connect_load,
iface=iface,
stop_filter=stopFilter,
)`
尝试编码PRN功能中的Paket,但这无效。还尝试使用DCERPC()解析数据包,但这也无效。
I want to sniff ProfiNet Connect Messages and print them to console every time i receive them. Herefore i used the Scapy sniff
method. Every time a Connect
-Frame is received the following error is displayed. The Connect
-Message is in correct format and is visible in Wireshark. The sniff-method aborts every time such a frame is received. If i export the frame with wireshark and read the .pcap-file with scapy the frame is correctly displayed. Do you have any suggestions? I'm currently using Python 3.8.10 and scapy version 2.4.5rc1.dev205. Thanks!
UnicodeEncodeError: 'latin-1' codec can't encode character '\u0797' in position 595: ordinal not in range(256)
def update_connect_load(pkt):
pkt.show2()
def stopFilter(x):
return False
sniff(
filter=f"ether src {mac_address}",
store=0,
count=-1,
prn=update_connect_load,
iface=iface,
stop_filter=stopFilter,
)`
Tried encoding the paket in the prn-function, but that didn't work. Also tried parsing the packet with DceRpc() but that also didn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将 Python 版本更新到 3.9 即可一切正常!
Just update the Python Version to 3.9 and everything works!