Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ICMPdump.java
Package: ICMPdump.rar [view]
Upload User: luaite
Upload Date: 2022-08-06
Package Size: 1k
Code Size: 2k
Category:
WinSock-NDIS
Development Platform:
Java
- import jpcap.*;
- import java.net.*;
- public class ICMPdump implements JpcapHandler
- {
- public void handlePacket(Packet packet){
- System.out.println(packet);
- if (packet instanceof ICMPPacket) {
- System.out.println("协议类型:icmpPacket");
- ICMPPacket icmpPacket = (ICMPPacket) packet;
- /*System.out.println("Id=" + icmpPacket.id +":" );
- System.out.println("Type=" + icmpPacket.type);
- System.out.println("Code=" + icmpPacket.code);
- System.out.println("data=" + icmpPacket.data);*/
- String srchost=String.valueOf(icmpPacket.getSourceAddress());
- String dstHost = String.valueOf(icmpPacket.getDestinationAddress());
- // System.out.println("icmpPacket sourceaddress"+icmpPacket.sourceaddress);
- // System.out.println("icmpPacket destinationaddress"+icmpPacket.destinationaddress);
- System.out.println("icmpPacket type" + icmpPacket.type);
- System.out.println("icmpPacket code" + icmpPacket.code);
- System.out.println("icmpPacket checksum" + icmpPacket.checksum);
- System.out.println("");
- System.out.println("ip header" + icmpPacket.header);
- System.out.println("icmpPacket data" + icmpPacket.data);
- }
- }
- public static void main(String[] args) throws java.io.IOException{
- String[] devices = Jpcap.getDeviceList();
- System.out.println("Start capturing on "+devices[0]);
- String deviceName = devices[0];
- Jpcap jpcap = Jpcap.openDevice(deviceName, 1000, false, 20);
- jpcap.loopPacket(-1, new ICMPdump());
- }
- }