-
大小: 140KB文件类型: .rar金币: 1下载: 0 次发布日期: 2021-08-04
- 语言: 其他
- 标签: JpcapDumper
资源简介
JPCAPDumper是Keita Fujiiy编写的基于JPCAP的网络分析软件,用于演示JPCAP的功能。JPCAPDumper为英文程序,对中文操作系统支持较差,可参考反编译和汉化后的程序数据包捕获器,两者功能一致。
代码片段和文件信息
/*
* 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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 603 2007-02-20 16:38 JpcapDumper-0.3-src\build.xm
文件 26432 2006-01-09 13:31 JpcapDumper-0.3-src\COPYING
文件 3804 2006-01-09 22:41 JpcapDumper-0.3-src\doc\document.html
文件 5260 2006-01-09 22:41 JpcapDumper-0.3-src\doc\donation.html
文件 5232 2006-01-09 22:41 JpcapDumper-0.3-src\doc\download.html
文件 3799 2006-01-09 22:41 JpcapDumper-0.3-src\doc\faq.html
文件 6445 2006-01-09 22:41 JpcapDumper-0.3-src\doc\index.html
文件 5032 2006-01-09 22:41 JpcapDumper-0.3-src\doc\install.html
文件 4683 2006-01-09 22:41 JpcapDumper-0.3-src\doc\li
文件 3981 2006-01-09 22:41 JpcapDumper-0.3-src\doc\screenshot.html
文件 87247 2003-04-08 17:52 JpcapDumper-0.3-src\doc\screenshot.PNG
文件 56 2006-01-09 13:31 JpcapDumper-0.3-src\JpcapDumper.MF
文件 180 2007-02-20 16:32 JpcapDumper-0.3-src\JpcapDumper.property
文件 1021 2003-04-04 12:07 JpcapDumper-0.3-src\src\image\capture.gif
文件 986 2003-04-04 12:07 JpcapDumper-0.3-src\src\image\nic.gif
文件 154 2003-04-04 12:07 JpcapDumper-0.3-src\src\image\open.gif
文件 148 2003-04-04 12:07 JpcapDumper-0.3-src\src\image\save.gif
文件 1001 2003-04-04 12:07 JpcapDumper-0.3-src\src\image\stopcap.gif
文件 2436 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\ARPAnalyzer.java
文件 1194 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\EthernetAnalyzer.java
文件 719 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\FTPAnalyzer.java
文件 1600 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\HTTPAnalyzer.java
文件 2634 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\ICMPAnalyzer.java
文件 2743 2007-02-20 16:28 JpcapDumper-0.3-src\src\jdumper\analyzer\IPv4Analyzer.java
文件 1803 2007-02-20 16:29 JpcapDumper-0.3-src\src\jdumper\analyzer\IPv6Analyzer.java
文件 616 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\JDPacketAnalyzer.java
文件 1145 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\PacketAnalyzer.java
文件 655 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\POP3Analyzer.java
文件 653 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\SMTPAnalyzer.java
文件 650 2006-01-09 13:31 JpcapDumper-0.3-src\src\jdumper\analyzer\SSHAnalyzer.java
............此处省略40个文件信息
评论
共有 条评论