mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 16:49:10 +00:00
Merge pull request #8 from matt123337/patch-2
Update NetworkInterface.java
This commit is contained in:
@@ -12,7 +12,7 @@ public class NetworkInterface {
|
|||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
mac = getRealHardwareAddress();
|
mac = getRealHardwareAddress();
|
||||||
} catch (Exception ignored) {
|
} catch (SocketException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,17 +23,11 @@ public class NetworkInterface {
|
|||||||
public static byte[] getRealHardwareAddress() throws SocketException{
|
public static byte[] getRealHardwareAddress() throws SocketException{
|
||||||
if (realMac != null)
|
if (realMac != null)
|
||||||
return realMac;
|
return realMac;
|
||||||
Enumeration<java.net.NetworkInterface> nis = java.net.NetworkInterface
|
|
||||||
.getNetworkInterfaces();
|
|
||||||
while (nis.hasMoreElements()) {
|
|
||||||
try {
|
try {
|
||||||
byte[] b = nis.nextElement().getHardwareAddress();
|
return realMac = java.net.NetworkInterface.getByInetAddress(
|
||||||
if (b.length == 0)
|
InetAddress.getLocalHost()).getHardwareAddress();
|
||||||
continue;
|
|
||||||
return realMac = b;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return mac;
|
return mac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user