jpcap , jNetPcap are pcap shell projects in Java.
Kraken is a similar project, well documented with many examples.
simple example from the Kraken website:
public static void main(String[] args) throws Exception { File f = new File("sample.pcap"); EthernetDecoder eth = new EthernetDecoder(); IpDecoder ip = new IpDecoder(); TcpDecoder tcp = new TcpDecoder(new TcpPortProtocolMapper()); UdpDecoder udp = new UdpDecoder(new UdpPortProtocolMapper()); eth.register(EthernetType.IPV4, ip); ip.register(InternetProtocol.TCP, tcp); ip.register(InternetProtocol.UDP, udp); PcapInputStream is = new PcapFileInputStream(f); while (true) {
Byungjoon lee
source share