Как получить категории «Кому» и «От» из SMTP-пакета, выделенного из потока.
import pyshark fileBuffer = pyshark.FileCapture(pcapDirectory) samplePacket = fileBuffer[SMTP_Packet_Location] # Get to and from fields
Я нашел следующее решение:
fileBuffer = pyshark.FileCapture(pcapDirectory) samplePacket = fileBuffer[SMTP_Packet_Location] print(samplePacket.smtp.get_field_value("req_parameter"))
Вывод:
TO: <exampleEmail@provider.com>