Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to send ARP request via Java?

Tags:

java

arp

Is there a way to send ARP request within a Java application? I know that ARP is sitting a layer under TCP and UDP therefore by default Java couldn't send ARP request. I am just wondering is there any 3rd party Java library that will allow you to send ARP request.

To capture ARP reply, I know I can use jpcap so that part is solved.

Thanks

like image 977
beyonddc Avatar asked Feb 01 '13 15:02

beyonddc


2 Answers

As you've stated, the Java standard library does not provide a low level enough networking API to send an ARP request.

The pcap4j provides Java bindings for libpcap / winpcap and thus can be used to send an ARP request. Information on the library can be found on their homepage. See this sample for how to send an ARP request.

like image 52
natbob1 Avatar answered Sep 23 '22 01:09

natbob1


A java app can always execute some external command, calling another tool to do it. I'm not sure what you mean by "standard java" though.

Based on googling, there seems to be arping in kraken pcap which is in Java. See about Kraken.

There's also jpcap as well that's used for the purpose.

like image 43
eis Avatar answered Sep 21 '22 01:09

eis