Is it possible to create a java class using JPCAP that capture all the packets destined to a particular IP address? Like if i need to capture all the packets destined to my router .. is it possible ?
Asked
Active
Viewed 674 times
0
-
do you mean destined to a particular IP? – Shurmajee Feb 14 '13 at 11:50
-
exactly.. i need to only capture packets threw the router – user1941212 Feb 14 '13 at 11:53
-
In a network all packets pass "through" the router. Ideally – Shurmajee Feb 14 '13 at 11:54
-
Why don't you just use and existing packet sniffer; e.g. WireShark. – Stephen C Feb 14 '13 at 11:55
-
he is willing to do it through jpcap – Shurmajee Feb 14 '13 at 11:57
-
its my senior project and i must use JPCAP, and when i run the project the src ip is my ip and the dest ip is for example the server of google. It must give me the gateway! – user1941212 Feb 14 '13 at 11:58
1 Answers
0
Yes It is..
- Packet capturing using jpcap (or any such library) allows the user to open the Ethernet interface in two different modes.
- In promiscuous mode, you can capture every packet from the wire, i.e., even if its source or destination MAC address is not same as the MAC address of the interface you are opening.
- In non-promiscuous mode, you can only capture packets send and received by your host.
- In order to catch all the packets passing through your router you need to tell your program to open the Ethernet interface in promiscuous mode.
- This will enable you to capture all the packets flowing in the network.Later you will need to filter these packets according to your router's IP address.

Shurmajee
- 1,027
- 3
- 12
- 35
-
Your wright about the diffrent modes, but about the filtering, you can't filter for ip addresses you can use the filter technique to listen for TCP/IP packets for example. – user1941212 Feb 14 '13 at 14:25
-
yes you can filter them at the time of capturing or after storing the captured packets in a file and then parsing the file – Shurmajee Feb 15 '13 at 03:54