Preciso desenvolver um sistema de login com jsf, que ao usuario autenticar me retorne o ip e o mac da maquina do usuario que esta autenticando.
Ja tentei usar InetAddress, NetworkInterface. Onde ele me retorna o mac e o ip do servidor q esta armazenado minha aplicação.
Como fazer para pegar o mac e o ip da maquina que esta fetuando o login???
[quote=Gbzao!]
MacAddress
public String getMACAddress(String ip){
String str = "";
String macAddress = "";
try {
Process p = Runtime.getRuntime().exec("nbtstat -A " + ip);
InputStreamReader ir = new InputStreamReader(p.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
for (int i = 1; i < 100; i++) {
str = input.readLine();
if (str != null) {
if (str.indexOf("MAC Address") > 1) {
macAddress = str.substring(str.indexOf("MAC Address") + 14, str.length());
break;
}
}
}
} catch (IOException e) {
e.printStackTrace(System.out);
}
return macAddress;
}
[/quote]
ihhh, não sei não se funciona assim, talvés pra um rede interna, mas externa o buraco é mais em baixo…
bom, mas testa ai, e depois posta pra gente se funcionou…