资源简介
使用JAVA库JPCAP来在传输层构造TCP数据包发送,并在网络层捕获数据包!
代码片段和文件信息
/*
* Created on Apr 4 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package jdumper;
import java.io.File;
import java.util.Vector;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import jdumper.stat.JDStatisticsTaker;
import jdumper.ui.JDCaptureDialog;
import jdumper.ui.JDContinuousStatframe;
import jdumper.ui.JDCumlativeStatframe;
import jdumper.ui.JDframe;
import jdumper.ui.JDStatframe;
import jpcap.JpcapCaptor;
import jpcap.PacketReceiver;
import jpcap.JpcapWriter;
import jpcap.packet.Packet;
/**
* @author kfujii
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class JDCaptor {
long MAX_PACKETS_HOLD=10000;
Vector packets = new Vector();
JpcapCaptor jpcap=null;
boolean isLiveCapture;
boolean isSaved = false;
JDframe frame;
public void setJDframe(JDframe frame){
this.frame=frame;
}
public Vector getPackets(){
return packets;
}
public void capturePacketsFromDevice() {
if(jpcap!=null)
jpcap.close();
jpcap = JDCaptureDialog.getJpcap(frame);
clear();
if (jpcap != null) {
isLiveCapture = true;
frame.disableCapture();
startCaptureThread();
}
}
public void loadPacketsFromFile() {
isLiveCapture = false;
clear();
int ret = JpcapDumper.chooser.showOpenDialog(frame);
if (ret == JFileChooser.APPROVE_OPTION) {
String path = JpcapDumper.chooser.getSelectedFile().getPath();
String filename = JpcapDumper.chooser.getSelectedFile().getName();
try {
if(jpcap!=null){
jpcap.close();
}
jpcap = JpcapCaptor.openFile(path);
} catch (java.io.IOException e) {
JOptionPane.showMessageDialog(
frame
“Can‘t open file: “ + path);
e.printStackTrace();
return;
}
frame.disableCapture();
startCaptureThread();
}
}
private void clear(){
packets.clear();
frame.clear();
for(int i=0;iames.size();i++)
((JDStatframe)sframes.get(i)).clear();
}
public void saveToFile() {
if (packets == null)
return;
int ret = JpcapDumper.chooser.showSaveDialog(frame);
if (ret == JFileChooser.APPROVE_OPTION) {
File file = JpcapDumper.chooser.getSelectedFile();
if (file.exists()) {
if (JOptionPane
.showConfirmDialog(
frame
“Overwrite “ + file.getName() + “?“
“Overwrite?“
JOptionPane.YES_NO_OPTION)
== JOptionPane.NO_OPTION) {
return;
}
}
try {
//System.out.println(“link:“+info.linktype);
//System.out.println(lastJpcap);
JpcapWriter writer = JpcapWriter.openDumpFile(jpcapfile.getPath());
for (int i = 0; i < packets.size(); i++) {
writer.writePacket((Packet) packets.elementAt(i));
}
writer.close();
isSaved = true;
//JOptionPane.sh
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
I.A.... 603 2007-02-20 16:38 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\build.xm
I.A.... 26432 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\COPYING
I.A.... 3804 2006-01-09 22:41 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\document.html
I.A.... 5260 2006-01-09 22:41 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\donation.html
I.A.... 5232 2006-01-09 22:41 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\download.html
I.A.... 3799 2006-01-09 22:41 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\faq.html
I.A.... 6445 2006-01-09 22:41 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\index.html
I.A.... 5032 2006-01-09 22:41 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\install.html
I.A.... 4683 2006-01-09 22:41 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\li
I.A.... 3981 2006-01-09 22:41 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\screenshot.html
I.A.... 87247 2003-04-08 17:52 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\doc\screenshot.PNG
I.A.... 56 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\JpcapDumper.MF
I.A.... 180 2007-02-20 16:32 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\JpcapDumper.property
I.A.... 1021 2003-04-04 12:07 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\image\capture.gif
I.A.... 986 2003-04-04 12:07 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\image\nic.gif
I.A.... 154 2003-04-04 12:07 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\image\open.gif
I.A.... 148 2003-04-04 12:07 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\image\save.gif
I.A.... 1001 2003-04-04 12:07 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\image\stopcap.gif
I.A.SH. 9216 2007-07-26 12:47 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\image\Thumbs.db
I.A.... 2436 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\ARPAnalyzer.java
I.A.... 1194 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\EthernetAnalyzer.java
I.A.... 719 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\FTPAnalyzer.java
I.A.... 1600 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\HTTPAnalyzer.java
I.A.... 2634 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\ICMPAnalyzer.java
I.A.... 2743 2007-02-20 16:28 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\IPv4Analyzer.java
I.A.... 1803 2007-02-20 16:29 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\IPv6Analyzer.java
I.A.... 616 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\JDPacketAnalyzer.java
I.A.... 1145 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\PacketAnalyzer.java
I.A.... 655 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\POP3Analyzer.java
I.A.... 653 2006-01-09 13:31 Java抓包必备\JpacapDumper\JpcapDumper-0.3-src\src\jdumper\analyzer\SMTPAnalyzer.java
............此处省略535个文件信息
- 上一篇:jsp网上购物系统完整版
- 下一篇:android便签源码
相关资源
- 用java实现ping功能
- 计算机网络课程设计报告_DH算法_Wir
- Android实时抓包分析的app
- 计算机网络课程设计实验报告-网络聊
- Java抓包程序实现(附说明文档)
- 局域网聊天程序 计算机网络课程设计
- 游戏引擎jar包
- android使用jpct加载三维模型
- JpcapDumper
- jpcap+winpcap及安装教程
- jpcap安装包259777
- 支持64位的Jpcap.dll
- jpcap资源
- java下进行抓包使用的jpcap.dll和jpcap.
- jpcap.jar jpcap.dll 32位 64位 完整匹配无
- 基于Jpcap的网络数据抓包程序
- jpcap_x64.dll+jpcap.jar
- java网络抓包(Jpcap0.7的教程 程序 源码
- 利用JPcap实现嗅探器Snifer,以web形式来
- jpcap监听网络 收发数据包java
- Java抓包程序
- 支持支持64位的Jpcap.dll
- jpcap 64位113461
- Jpcap.jar
- jpcap.jar jpcap.dll 32 64
- JpcapDumper-0.3-src.zip
- Jpcap资料与应用
- Jpcap 64位
- 64位的jpcap.dl、jpcap.jar
- jpcap压缩包
评论
共有 条评论