Jes s e Caulfield
Key Bridge LLC
March 29, 2008
In this tutorial I will de scribe how to ins tall JPCap from source code on Linux (Ubunty 7.10 or Debian
4.0).
JPCap is an open - source Java library released u n de r the GNU LGPL and de signed to enable the
capt uring an d sen ding ne twork packet s in Java. JPCap is developed by Keita Fujii an d the Univer sity
of California and Irvine.
The JPCap home page is h t t p: / / n e t research.ics.uci.edu / kf ujii / jpcap / d oc /
JPCap is a Java Native Library Implement ation (JNI) of the po p ular libpcap library an d sho uld therefor
work on any OS which su p por t s libpcap. libpcap is a user - level packet capture library tha t provides a
commo n, sys tem- indepe n de nt API for low- level network mo ni toring. libpcap is also ope n - source
sof tware developed an d maint ained by TCPDump.org.
We will use JPCap and libpcap on the Linux operating sys tem but the both libraries work on Microsof t
Windows (WinPcap), Linux, FreeBSD, an d Mac OS X.
JPCap su p por t s the following types of network da ta:
Layer 2: Ethernet Datagrams
Layer 3: IPv4 & Ipv6 ARP/RARP
TCP, UDP an d ICMPv4.
JPCap recogni zes the packet types enume rated above but can capt ure any type of ne twork t raffic as a
raw packet (i.e., as an ins tance of the Packet clas s) which contains the Packet's whole da t a. This
feature allows Java a p plications to analyze any packet type.
Step 1: Preparing the System
Following are ins t r uctions to ins tall JPCap on a f resh ins tallation of Ubuntu 7.10 of Debian 4.0.
Ins tall the neces sary developme nt sof tware packages to create a u s able developme nt environme nt:
Ins tall the GNU compiler an d basic libraries
% su do a pt - get ins tall build - es sential
Ins tall the linux pca p library
% su do a pt - get ins tall libpcap0.8
Ins tall the Java SDK from Sun
% su do a pt - get ins tall s un - java6 - sdk
Download the JPCap source and ext ract it into your working directory
ht t p: / / n e t research.ics.uci.edu / kfujii / j pcap / j pcap - 0.7.tar.gz
ht tp: / /KeyBridgeGlobal.com Page 1
Key Bridge LLC
Step 2: Building & Installing the JPCap JNI library
In a terminal window, navigate to the [jpcap] / s rc / c directory. For example:
~ / j pcap - 0.7 / s rc / c
[IMPORTANT] Edit the JAVA_DIR Makefile ent ry to point to your version of jni.h
You can find it quickly with the following comma n d:
$ find / u s r - name jni.h
/ u s r / lib / jvm/ j ava - 6 - s un - 1.6.0.03 / include / jni.h
The Makefile sho uld then rea d
JAVA_DIR = / u s r / lib / jvm/ j ava - 6 - su n - 1.6.0.03
In the terminal window u n der the [jpcap] / s rc / c di rectory type make to create the share d library
$ make
This will create the file 'libjpcap.so'.
Copy 'libjpcap.so' your sys tem' s Java JNI library directory
'[Java - di r] / j re / lib / < a rch >' where < a rch > is either 'i386' or 'sparc'.
For my ins tallation, this was / u s r / lib / jvm/ j ava - 6 - su n / j re / lib /i386
Another option is to copy the library to the directory where your ap plication is locate d.
Step 3: Building and Installing the JPCap JAR file
In a terminal window, nagivate to the [jpcap] / s rc / j ava directory. For example:
~ / j pcap - 0.7 / s rc / java
There should be one sub directory name d 'jpcap'
Compile all of the .java files in the 'jpcap' and 'jpcap / p acket' di rectories.
$ find . - name "*.java" - exec javac {} / ;
You may see the following er ror for IPPacket.java - ignore it.
"Note: . /jpcap / p acket /IPPacket.java uses u nchecked or u ns afe operations."
Create the JAR file
jar - cf jpcap.jar jpcap
Confirm the content s of your JAR file with the following comma n d:
jar - tvf jpcap.jar
Copy the new jpcap.jar file to your Java extentions di rectory
$ cp jpcap.jar '[Java - dir] / j re /lib / ext /
For my ins tallation, this was / u s r / lib / jvm/ j ava - 6 - su n / j re / lib / ext
Another option is to copy the JAR file to your ap plication' s di rectory an d ad d it to your
CLASSPATH.
You are now rea dy to begin using the JPCAP Java Native Interface Library.
ht
分享到:
相关推荐
在官方网站上声明,JPCAP支持FreeBSD 3.x, Linux RedHat 6.1, Fedora Core 4, Solaris, and Microsoft Windows 2000/XP等系统。 经过本人亲自测试,在window环境和linux环境下面都是可用的,使用方法: window: 1....
Linux系统抓取数据库的包,进行解析的必要工具
jPCAP在JAVA中,并非一个真正去实现对数据链路层的控制,而是一个中间件,JPCAP调用winpcap/libpcap,给 JAVA语言提供一个公共的接口,从而实现了平台无关性。 其中包含了jpcap.dll与libjpcap.so文件
jpcap 64位 包含jpcap.jar、jpcap.dll以及libjpcap.so文件
Jpcap version 0.06.0
Jpcap已在微软视窗(98/2000/XP/Vista)测试,Linux操作系统(Fedora的,的Mandriva,Ubuntu的),Mac OS X的(达尔文),FreeBSD和Solaris操作系统。 Jpcap可以捕获以太网的IPv4,IPv6的ARP协议/ RARP时,TCP,UDP...
linux 中,安装,提示缺少其他一些组件,经过来回搜索与拷贝,GCC安装成功,所需文件有: libf2c-3.3.2-1.i386.rpm libstdc -devel-3.3.2-1.i386.rpm glibc-kernheaders-2.4-8.36.i386.rpm glibc-headers-2.3.2-101.i386....
Windows下亲测有效,使用方法,首先安装WinPcap,然后将jpcap.jar拷贝到${JAVA_HOME}/jre/lib/ext中,将Jpcap.dll拷贝到${JAVA_HOME}/jre/bin中,这样就可以在Java Project中使用jpcap了,Linux下libpcap+jpcap环境...
java 网络通讯报文监听。。。。 jpcap.jar 和 jpcap.dll(32位动态库和64位动态库),需要安装wincap
jpcap的Jpcap.dll和jpcap.jar。有一篇原创博文的评论说:“为什么我下载的jpcap压缩包中没有jpcap.jar呢”,故上传该资源方便其下载。哈哈哈啦啦啦
找了很长时间的jpcap知识,经过自己的努力,终于编辑了一个可用的jpcap代码。可以捕获和分析IP数据包,NETBEAN下运行通过。只要jpcap配置正确,保证可以运行。xixi代码,保证质量。谢谢大家长时间的支持!我会继续...
jpcap教程.pdf
jpcap dll 64位 jpcap jar jpcap dll 64位 jpcap jar
jpcap.jar+Jpcap.dll java版,能够抓取经过数据链路层的数据包,对抓取到的数据包进行一定程序的解析,可自己写IP数据包直接发送给数据链路层……
jpcap 发送、捕捉返回消息jpcap 发送、捕捉返回消息jpcap 发送、捕捉返回消息jpcap 发送、捕捉返回消息jpcap 发送、捕捉返回消息
java利用jpcap进行数据包的捕获与分析的重要资料
jpcap的开发API文档以及可使用的jar包,可供开发者使用
这个包用到了Libpcap和原始套接字API,目前,Jpcap在FreeBSD 3.x, Linux RedHat 6.1, Solaris, and Microsoft Windows 2000/XP系统上已经做过测试,并且支持Ethernet, IPv4, IPv6, ARP/RARP, TCP, UDP, ICMPv4协议。...
Jpcap 64位,完整一套包括Winpcap,Jpcap,jpcap.dll,demo.
安装jpcap过了好久,不记得上次是怎么安装jpcap的, 他可以帮助我们捕获网络数据,当然,你如果够牛B,可以写出比你本人更牛B的程序来的(说明一点,jpcap给我们提供的功能太强大了),本人安装它可谓一波三折,犯了...