I am new to Scapy. I am trying to parse Modbus packets in a pcap file using scapy.contrib.modbus. I am however successful. I want to at least identify request and response packets based on the library. Below is the link for the pcap file:
https://github.com/tjcruz-dei/ICS_PCAPS/releases/download/MODBUSTCP%231/captures1.zip
Below is the sample code (doesn't work by the way):
from scapy.all import *
import scapy.contrib.modbus as mb
for pkt in PcapReader("captures1/clean/eth2dump-clean-0,5h_1.pcap"):
if pkt['TCP'].sport == 502:
pkt = mb.ModbusADUResponse(pkt)
print(type(pkt))
Kindly assist. Thank you.