📄 jpcapdumper.java
字号:
package jdumper;
import java.util.*;
import java.io.*;
import javax.swing.JOptionPane;
import jdumper.ui.JDFrame;
import jpcap.JpcapCaptor;
public class JpcapDumper
{
public static Properties JDProperty;
public static javax.swing.JFileChooser chooser=new javax.swing.JFileChooser();
static Vector frames=new Vector();
public static void main(String[] args){
try{
Class c=Class.forName("jpcap.JpcapCaptor");
}catch(ClassNotFoundException e){
JOptionPane.showMessageDialog(null,"Cannot find Jpcap. Please download and install Jpcap before running.");
System.exit(0);
}
JDPacketAnalyzerLoader.loadDefaultAnalyzer();
JDStatisticsTakerLoader.loadStatisticsTaker();
loadProperty();
openNewWindow();
}
public static void saveProperty(){
if(JDProperty==null) return;
try{
JDProperty.store((OutputStream)new FileOutputStream("JpcapDumper.property"),"JpcapDumper");
//JDProperty.store(new FileOutputStream("JpcapDumper.property"),"JpcapDumper");
}catch(IOException e){
}catch(ClassCastException e){
}
}
static void loadProperty(){
try{
JDProperty=new Properties();
JDProperty.load((InputStream)new FileInputStream("JpcapDumper.property"));
}catch(IOException e){
}
}
public static void openNewWindow(){
JDCaptor captor=new JDCaptor();
frames.add(JDFrame.openNewWindow(captor));
}
public static void closeWindow(JDFrame frame){
frame.captor.stopCapture();
frame.captor.saveIfNot();
frame.captor.closeAllWindows();
frames.remove(frame);
frame.dispose();
if(frames.isEmpty()){
saveProperty();
System.exit(0);
}
}
protected void finalize() throws Throwable{
saveProperty();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -