【发布时间】:2021-05-01 20:16:16
【问题描述】:
当我使用来自 pyshark 的 LiveCapture 时,我想将 Python 中的 HEX 输出转换为 ASCII。
我的代码:
capture = pyshark.LiveCapture(interface='en1',
bpf_filter='tcp port 5555 and len > 66',)
colored.OK("Interface bindée sur %s" % socket.gethostbyname(socket.gethostname()))
for packet in capture.sniff_continuously():
if packet.ip.src == socket.gethostbyname(socket.gethostname()):
colored.OK("Send packets")
else:
colored.OK("Receive packets")
print(''.join(packet.data.data.split(":")))
print("")
接收数据包的输出:
66787874798582124495051
我想直接在 python 输出中将此输出转换为 ASCII 字符 有可能吗?
谢谢
【问题讨论】:
标签: python sockets hex ascii pyshark