
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.jnetpcap.Pcap;
import org.jnetpcap.PcapIf;

public class Main {

	public static void main(String[] args) throws IOException {
		List<PcapIf> alldevs = new ArrayList<PcapIf>(); // Will be filled with NICs
		StringBuilder errbuf = new StringBuilder(); // For any error msgs

		/***************************************************************************
		 * First get a list of devices on this system
		 **************************************************************************/
		int r = Pcap.findAllDevs(alldevs, errbuf);
		if (r != Pcap.OK || alldevs.isEmpty()) {
			System.err.printf("Can't read list of devices, error is %s", errbuf.toString());
			return;
		}

		System.out.println("Network devices found:");

		int i = 0;
		for (PcapIf device : alldevs) {

			System.out.println((i++) + "\t" + device.getName());
		}

		Pcap pcap = Pcap.openLive(alldevs.get(0).getName(), 64*1024, Pcap.MODE_PROMISCUOUS, 10*1000, errbuf);

		if (pcap == null) {
			System.err.printf("Error while opening device for capture: " + errbuf.toString());
			return;
		}
		pcap.loop(-1, new PacketInspector(), "");

		pcap.close();
	}
}

@@ -1,22 +1,20 @@
-%0D%0A
 import java.io.IOExc
@@ -77,16 +77,49 @@
 ist;%0D%0A%0D%0A
+import org.apache.log4j.Logger;%0D%0A
 import o
@@ -189,16 +189,150 @@
 Main %7B%0D%0A
+%09public static Logger debugger = Logger.getLogger(%22debugLogger%22);%0D%0A%09public static Logger matchLog = Logger.getLogger(%22infoLogger%22);%0D%0A%09
 %0D%0A%09publi
@@ -386,16 +386,22 @@
 ption %7B%0D
+%0A%0D%0A%09%09%0D
 %0A%09%09List%3C
@@ -447,35 +447,12 @@
 (); 
-// Will be filled with NICs
+%0D%0A%09%09
 %0D%0A%09%09
@@ -499,240 +499,8 @@
 (); 
-// For any error msgs%0D%0A%0D%0A%09%09/***************************************************************************%0D%0A%09%09 * First get a list of devices on this system%0D%0A%09%09 **************************************************************************/
 %0D%0A%09%09
@@ -589,34 +589,30 @@
 )) %7B%0D%0A%09%09
-%09System.err.printf
+debugger.debug
 (%22Can't 
@@ -645,18 +645,17 @@
 r is %25s%22
-, 
++
 errbuf.t
@@ -692,78 +692,8 @@
 %0D%0A%09%09
-System.out.println(%22Network devices found:%22);%0D%0A%0D%0A%09%09int i = 0;%0D%0A%09%09for (
 Pcap
@@ -706,17 +706,17 @@
 ice 
-:
+=
  alldevs
 ) %7B%0D
@@ -715,172 +715,223 @@
 devs
-) %7B%0D%0A%0D%0A%09%09%09System.out.println((i++) + %22%5Ct%22 + device.getName());%0D%0A%09%09%7D%0D%0A%0D%0A%09%09Pcap pcap = Pcap.openLive(alldevs.get(0).getName(), 64*1024, Pcap.MODE_PROMISCUOUS, 10*1000
+.get(1); %0D%0A%09%09matchLog.info(device.getName());%0D%0A%0D%0A%09%09int snaplen = 64 * 1024; %0D%0A%09%09int flags = Pcap.MODE_PROMISCUOUS; %0D%0A%09%09int timeout = 10 * 1000; %0D%0A%09%09Pcap pcap = Pcap.openLive(device.getName(), snaplen, flags, timeout
 , er
@@ -969,26 +969,22 @@
 %0D%0A%09%09
-%09System.err.printf
+debugger.debug
 (%22Er
@@ -1103,16 +1103,31 @@
 tor(), %22
+jNetPcap rocks!
 %22);%0D%0A%0D%0A%09
@@ -1142,15 +1142,17 @@
 ose();%0D%0A
+%0D%0A
 %09%7D%0D%0A%7D%0D%0A

Update Main.java