Solved

jpcap class IPAddress help

Posted on 2004-07-31
8
751 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 3

Assisted Solution

by:JohnnyAffa
JohnnyAffa earned 100 total points
ID: 11687137
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:Mayank S
Mayank S earned 25 total points
ID: 11687561
0
 

Author Comment

by:heydude
ID: 11687675
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 7

Accepted Solution

by:
JugglerW earned 375 total points
ID: 11688989
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
 

Author Comment

by:heydude
ID: 11689041
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
ID: 11689047
0
 

Author Comment

by:heydude
ID: 11689144
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
ID: 11706889
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This video teaches viewers about errors in exception handling.
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.
Suggested Courses

615 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