0

I recently downloaded the JEthereal.jar file to capture packet traffic on my internet connection through JEthereal and also to study it. It reads the packets from a .pcap file just fine but on trying to capture packets it gave me a message that:

"No device found. This probably means that you installed JPcap but not libpcap / WinPcap.Please follow the instructions on the website to install it. It takes about 15 seconds and is well worth it."

So I downloaded its source code and opened it in Eclipse since I had already installed WinPcap.

On going through the code I came to the part where network devices are supposed to be discovered. The static method getDeviceList() from the JpcapCaptor class in the jpcap package which should return an array of network devices of type NetworkInterface. The following is its declaration given on the internet:

public static NetworkInterface[] getDeviceList()

However, in the source code that I have downloaded the method is left without a body and its been declared native i.e.

public static native NetworkInterface[] getDeviceList();

What should I do now to identify my devices? On searching on the net and on this portal I came to know that a jpcap.dll file should be present in my system32 folder (I am using Windows7) and I should install WinPcap for that. I had already installed WinPcap and there is no jpcap.dll file in the system32 folder. Also, i suppose i should add system32 to my PATH variable, i haven't done that yet since there is no jpcap.dll there.

Thanx in advance!!

Surender Thakran
  • 3,958
  • 11
  • 47
  • 81

2 Answers2

0

If "On searching on the net and on this portal I came to know that a jpcap.dll file should be present in my system32 folder (I am using Windows7) and I should install WinPcap for that.", then, as the saying goes, someone is wrong on the Internet.

jpcap.dll is not part of WinPcap, and you do not install WinPcap to get it. You need to install Keita Fujii's Jpcap (he no longer seems to be working on it, and the site the JEthereal site links for it no longer exists, but the JEthereal site has some local download links, and some people have created their own forks of it).

Have you installed any version of Jpcap? If so, where did you get it from? It may be a version that doesn't work with JEthereal.

  • yes, i have downloaded and installed jpcap as well. I got it from http://yuba.stanford.edu/JEthereal/applet/ the same link where i got the JEthereal setup. I have separately downloaded the local dll file provided there and added it in both my PATH and CLASSPATH for good measure but still I am getting the same error. – Surender Thakran Mar 02 '13 at 07:54
  • my PATH and CLASSPATH are lib and bin folders in my jdk installatio in Program Files. – Surender Thakran Mar 02 '13 at 08:23
  • If you've downloaded jpcap and you don't have a `jpcap.dll`, either jpcap doesn't have a `jpcap.dll` or you didn't install it correctly. You'll have to talk to [contact the author of Jethereal](http://yuba.stanford.edu/JEthereal/contact.php) for help. CLASSPATH is irrelevant to native code such as the code in a .dll. –  Mar 02 '13 at 09:23
  • the JpCap that I installed put a jpcap.dll in the bin of my jre installation instead of jdk. Is it relevant? – Surender Thakran Mar 02 '13 at 09:46
  • Try making sure PATH includes the directory containing wpcap.dll and the directory containing jpcap.dll. –  Mar 02 '13 at 18:24
  • Both `jpcap.dll` and `wpcap.dll` are in `System32` which i have included in PATH. But the date of creation of `wpcap.dll` is 25-Jun-10, although i have installed `wpcap` only a couple of days ago. Should i reinstall `wpcap`? – Surender Thakran Mar 03 '13 at 08:01
  • WinPcap 4.1.2 [was released 2-Jul-2010](http://www.winpcap.org/news.htm), and 4.1.1 was released 20-Oct-2009, so you probably have the latest WinPcap. You should contact the JEthereal developers about this problem, as it's happening even after you've installed both JPcap and WinPcap. –  Mar 03 '13 at 19:56
0

Why is getDeviceList() method in jpcap.JpcapCaptor class native in JEthereal?

Because getDeviceList() is implemented as native (C/C++) code.

on trying to capture packets it gave me a message that says: "No device found..."

I am using Windows7

Touchè. Starting with Windows Vista (which is the first Windows that implement root-like pretensions), you need to run jpcap as an administrator. This has to be done at least the first time that you run jpcap after the system has been restarted (so that the winpcap library is authorized to access network resources).

From jpcap FAQ

Q: I cannot obtain the list of network interfaces or cannot capture any packets. Why?

It may be because you don't have administrative privileges, which are required to run Jpcap-based applications.

On Windows 2000/XP, your account should be in the Administrator group.

On Windows Vista, even if your account is in the administrator group, you still need to use "run as administrator" option. To use the option, right-click the application icon, and choose "run as administrator". If your application is command-line based, you need to open Command Prompt by using "run as administrator" option, and run your application within that Command Prompt.

Community
  • 1
  • 1
Javier
  • 12,100
  • 5
  • 46
  • 57
  • ...and then complain to the JPcap developers that their error message is misleading. If it can possibly determine whether libpcap or WinPcap is installed, it should do so *before* suggesting that "you installed JPcap but not libpcap / WinPcap". –  Mar 19 '13 at 05:15
  • My understanding is that jpcap reports "no interfaces" and JEthereal assumes that jpcap may not be installed. – Javier Mar 19 '13 at 07:17
  • Then the complaint should be directed towards the JEthereal developers. –  Mar 20 '13 at 18:47