@@ -0,0 +1,1229 @@
+package Capture;%0A%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.jnetpcap.Pcap;%0Aimport org.jnetpcap.PcapIf;%0A%0Apublic class Main %7B%0A%0A%09public static void main(String%5B%5D args) throws IOException %7B%0A%09%09List%3CPcapIf%3E alldevs = new ArrayList%3CPcapIf%3E(); // Will be filled with NICs%0A%09%09StringBuilder errbuf = new StringBuilder(); // For any error msgs%0A%0A%09%09/***************************************************************************%0A%09%09 * First get a list of devices on this system%0A%09%09 **************************************************************************/%0A%09%09int r = Pcap.findAllDevs(alldevs, errbuf);%0A%09%09if (r != Pcap.OK %7C%7C alldevs.isEmpty()) %7B%0A%09%09%09System.err.printf(%22Can't read list of devices, error is %25s%22, errbuf.toString());%0A%09%09%09return;%0A%09%09%7D%0A%0A%09%09System.out.println(%22Network devices found:%22);%0A%0A%09%09int i = 0;%0A%09%09for (PcapIf device : alldevs) %7B%0A%0A%09%09%09System.out.println((i++) + %22%5Ct%22 + device.getName());%0A%09%09%7D%0A%0A%09%09Pcap pcap = Pcap.openLive(alldevs.get(0).getName(), 64*1024, Pcap.MODE_PROMISCUOUS, 10*1000, errbuf);%0A%0A%09%09if (pcap == null) %7B%0A%09%09%09System.err.printf(%22Error while opening device for capture: %22 + errbuf.toString());%0A%09%09%09return;%0A%09%09%7D%0A%09%09pcap.loop(-1, new PacketInspector(), %22 %22);%0A%0A%09%09pcap.close();%0A%09%7D%0A%7D%0A

Create Main.java