I am using pcap4j for reading packets in Java. I want to generate an alert on receiving a packet with abort. For now I am unable to apply a filter for abort. I have attached code below.
PcapHandle handle;
Pcap pcap;
handle =
Pcaps.openOffline("D://nm_postpaid_testing.pcap",TimestampPrecision.NANO);
//handle.setFilter("tcap.reason == 11", BpfCompileMode.OPTIMIZE);
System.out.println("Starting output: ");
PcapPacket packet = null;
String filter = "pcap abort 11";
handle.setFilter(filter, BpfCompileMode.OPTIMIZE);
PacketListener listener = new PacketListener() {
@Override
public void gotPacket(PcapPacket pp) {
System.out.println("/////////////START////////////////");
System.out.println(Arrays.toString(pp.getRawData()));
SctpDecoder sctpDecoder = new SctpDecoder();
//sctpDecoder.decode(pp.getRawData(), "IP", "*", true, "DECODE:TCAP");
System.out.println("///////////////END//////////////\n");
}
};
handle.loop(4, listener);