Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 10-28-2008, 12:25 PM   #1 (permalink)
 
Newb Techie

Join Date: Feb 2006

Location: somewhere in Asia

Posts: 16

Deetech is on a distinguished road

Send a message via MSN to Deetech
Default Need Help! Urgent

Hello there, im doing a small program just like a packet sniffer but i have a one problem.Below are the codes which are used to list all the network interfaces and the output will be something like this:

1.Interface Name's: lo / MS TCP Loopback interface

Address: 127.0.0.1

2.Interface Name's: eth0 / Realtek RTL8139 Family PCI Fast Ethernet NIC - Packet Scheduler Miniport

3.Interface Name's: eth1 / Gigabyte WIKG mini PCI WLAN Card - Packet Scheduler Miniport

Address: 192.168.1.101

4.Interface Name's: eth2 / Bluetooth Device (Personal Area Network)

then i created a dialog where a user can select one of the interface to be scan to do a packet analyser, but i don't know how the code will be.

I tried to search around and i came across the jpcap library,. i already tried to use it but it didnt work. i installed the jpcap and even use import jpcap.*; but it still got errors as if it doesnt recognise any syntax such as jpcap.JpcapCaptor or anything related to pcap.

please help me..if there are any alternative to do packet analyzer instead of using jpcap

Thank you

---------------------------------------------------------------------------------------
(codes use to list all the network interfaces)

Code:
public void actionPerformed(ActionEvent e) {
  if (e.getSource() == b1) {
    if(true){
      try{
	java.net.SocketException se = new java.net.SocketException();
	Enumeration enu = NetworkInterface.getNetworkInterfaces();
	int i = 1;
	while(i < 10 && enu.hasMoreElements()) {
     	NetworkInterface net = (NetworkInterface)enu.nextElement();
      	System.out.println(i+"." + "Interface Name's: " + net.getName() + " / " + net.getDisplayName() +"\n");
	i++;
	Enumeration enum2 = net.getInetAddresses();
      	while (enum2.hasMoreElements()) {
             InetAddress address = (InetAddress)enum2.nextElement();
        	System.out.println("Address: " + address.getHostAddress()+ "\n");
	}
}
JOptionPane.showInputDialog(null,"Select Interface to be scan", JOptionPane.QUESTION_MESSAGE);
//		if(i == 1)///if a user select one of the interface, it will do  packet analyzer
}
catch(java.net.SocketException se){
    se.printStackTrace();
}
}
}


Last edited by Mak213; 10-28-2008 at 02:16 PM.
Deetech is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Home Network - No Network Places?? Urgent! HELPMEPLZ Computer Networking & Internet Access 5 09-21-2008 09:51 AM
urgent help plz Anique Building, Buying, or Upgrading High Performance PC Systems 6 07-31-2008 11:08 PM
Sound Recording Problem, Fairly Urgent! mad_max247 Computer Audio & Multimedia 1 05-05-2008 11:10 PM
URGENT HELP Microsoft Word Yipo Windows Operating Systems and Software 5 03-12-2008 04:44 PM
Big Big Urgent Urgent Urgent Help Needed...plssssss krazyq Hardware Troubleshooting 25 12-28-2007 11:49 AM