Solved

jpcap class IPAddress help

Posted on 2004-07-31
8
733 Views
Last Modified: 2008-02-01
I have started playing around with the jpcap classes for java and I would like to use some stuff I saw in the IPAddress package(setAddressConvert(boolean isDomainName), getHostName(), getHostAddress(), toString() )
 and was wondering if anyone new of a site where I could get more info on how to use them or if anyone could post some sample code would be great. I looked through the api manual, but I like to see examples.

Thank you to all
0
Comment
Question by:heydude
8 Comments
 
LVL 3

Assisted Solution

by:JohnnyAffa
JohnnyAffa earned 100 total points
Comment Utility
am not familiar with jpcap package or IPAddress class, but have you looked at InetAddress class in java.net package?.....sound like is something similar to what you want.

what sort of info are you after? (be specific)
0
 
LVL 30

Assisted Solution

by:mayankeagle
mayankeagle earned 25 total points
Comment Utility
0
 

Author Comment

by:heydude
Comment Utility
I had already looked through the API Manual at the from the link listed by mayankeagle and it doesn't tell me much. I like to see examples. I haven't looked at the InetAddress, I was looking at the packet capturing side and wanted to use jpcap because it does that. I don't think the InetAddress class would handle that.
0
 
LVL 7

Accepted Solution

by:
JugglerW earned 375 total points
Comment Utility
You've seen this example? Is from the same site as the link above.
To get it work you need libcap from: http://www.tcpdump.org/


import jpcap.*;

class Tcpdump implements JpcapHandler
{
   public void handlePacket(Packet packet){
     System.out.println(packet);
   }
 
   public static void main(String[] args) throws java.io.IOException{
     String[] lists=Jpcap.getDeviceDescription();
     System.out.println("Start capturing on "+lists[0]);

     Jpcap jpcap=Jpcap.openDevice(Jpcap.getDeviceList()[0],1000,false,20);
     jpcap.loopPacket(-1,new Tcpdump());
   }
}

Another link I've found:

http://jpcap.sourceforge.net/

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:heydude
Comment Utility
setAddressConvert(boolean isDomainName), getHostName(), getHostAddress(), toString() )

I've seen it and ranit and it doesn't tell me anything about the items that I am looking for. I also found the visual JpcapDumper, but I can't figure out how it displays the destination host name and source hostname. That's really what I am looking for is how to capture packets witht he jpcap package and display the destination ip and url. So if I went to say the experts exchange website I would see(this is not the real ip of the expert's exchange)
68.45.98.109 www.experts-exchange.com the tcpdump program shows how to capture packets, but nothing more. I wish they would have more examples listed.
0
 
LVL 7

Expert Comment

by:JugglerW
Comment Utility
0
 

Author Comment

by:heydude
Comment Utility
I am looking for samples, examples, etc.. that pertain to the following post I had submitted:

I've seen it and ran it(tcpdump) and it doesn't tell me anything about the items that I am looking for. I also found the visual JpcapDumper, but I can't figure out how it displays the destination host name and source hostname. That's really what I am looking for is how to capture packets with the jpcap package and display the destination ip and url. So if I went to say the experts exchange website I would see(this is not the real ip of the expert's exchange website)
68.45.98.109 www.experts-exchange.com the tcpdump program shows how to capture packets, but nothing more. I wish they would have more examples listed.
0
 

Author Comment

by:heydude
Comment Utility
I'm giving up on this question and will research myself. I'm giving some point's to JugglerW  for the sourceforge link. I had already been their, but I found a new link the second time around. Everything else was stuf I already was aware of.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now