public class PcapUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
getAllIPsForNetworkInterface(org.pcap4j.core.PcapNetworkInterface nif)
Get all possible IP addresses for the given network interface and the corresponding subnet.
|
static InetAddress |
getIPv4Address(org.pcap4j.core.PcapNetworkInterface nif)
Get the first IPv4 address for the given network interface
|
static InetAddress |
getIPv6Address(org.pcap4j.core.PcapNetworkInterface nif)
Get the first IPv6 address for the given network interface
|
static org.pcap4j.util.MacAddress |
getMACAddress(String macAddress) |
static org.pcap4j.core.PcapNetworkInterface |
getNetworkInterfaceForIP(String someIP)
Get a network interface matching the IP address or connected to the corresponding subnet
|
static String |
getPCapVersion()
The version of the underlying Pcap library
|
static boolean |
isAmazonMacAddress(org.pcap4j.util.MacAddress macAddress)
Checks if the given MAC address belongs to Amazon
|
static boolean |
isIPv4Address(InetAddress address)
Checks if the given IP address is a IPv4 address
|
static boolean |
isIPv6Address(InetAddress address)
Checks if the given IP address is a IPv6 address
|
static boolean |
isPCapPresent()
Checks if Pcap is installed and available
|
public static final boolean isPCapPresent()
public static final String getPCapVersion()
public static final org.pcap4j.core.PcapNetworkInterface getNetworkInterfaceForIP(String someIP) throws IOException
someIP - Any IP address in the desired subnetIOExceptionpublic static final List<String> getAllIPsForNetworkInterface(org.pcap4j.core.PcapNetworkInterface nif)
nif - The network interfacepublic static InetAddress getIPv4Address(org.pcap4j.core.PcapNetworkInterface nif)
nif - The network interfacepublic static InetAddress getIPv6Address(org.pcap4j.core.PcapNetworkInterface nif)
nif - The network interfacepublic static boolean isIPv4Address(InetAddress address)
address - The IP address to checkpublic static boolean isIPv6Address(InetAddress address)
address - The IP address to checkpublic static org.pcap4j.util.MacAddress getMACAddress(String macAddress)
public static boolean isAmazonMacAddress(org.pcap4j.util.MacAddress macAddress)
macAddress - The MAC address to checkCopyright © 2017. All rights reserved.