Solved

jpcap class IPAddress help

Posted on 2004-07-31
8
734 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

895 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

17 Experts available now in Live!

Get 1:1 Help Now