All Projects → gaoxingliang → mac-address-detector-java

gaoxingliang / mac-address-detector-java

Licence: Apache-2.0 license
Use pcap4j to detect a mac address of remote host

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to mac-address-detector-java

macvendor
CLI tool which looks up hardware vendor names for network devices based on the macvendors.com API
Stars: ✭ 17 (-29.17%)
Mutual labels:  mac-address
Spoofmac
💼 Change your MAC address for debugging
Stars: ✭ 2,687 (+11095.83%)
Mutual labels:  mac-address
vmam
VLAN Mac-address Authentication Manager
Stars: ✭ 19 (-20.83%)
Mutual labels:  mac-address
TideBot
我的 IRC 机器人,虽然这个 Bot 能让聊天者在 IRC 里玩游戏,但除了游戏,还有其他很多功能。
Stars: ✭ 26 (+8.33%)
Mutual labels:  mac-address

mac-address-detector-java

Use pcap4j to detect a mac address of remote host

Reason

I searched the whole website, and I found no solution provided to detect a mac address of remote host under same subnetwork.

So I created this project.

Implementation

I used pcap4j to send and filtering packets. and for a IPv4 address, I used arp protocol related function to extract the mac address. and for a IPv6 address, I used ndp (neighbor discovery) protocol related function to extract the mac address.

Dependency

  1. pcap4j 1.7.3
  2. libpcap. (ready for use version files has been uploaded into libpcapfiles)

How to build

Build networkutils-*.jar

  1. gradle build (no dep jars included)
  2. gradle fatjar (recommended, dep jars included)

Run on linux

on linux, you can load the libpcap directly without install anything

java -Dorg.pcap4j.core.pcapLibName=libpcap.so -cp .:networkutils-all-0.2.jar Test 192.168.170.149

Run on windows

On windows, the npcap is required to be installed. (no reboot required)

java -Dorg.pcap4j.core.pcapLibName=wpcap.dll -Dorg.pcap4j.core.packetLibName=Packet.dll -cp .;networkutils-all-0.2.jar Test 192.168.170.149

Updates 01-24-2018

Add a func to do packet dump by using pcap4j. After build the jar, call the main class PacketDump. java -Dorg.pcap4j.core.pcapLibName=libpcap.so -cp .:networkutils-all-0.2.jar PacketDump "udp"

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].