Hello, I did a JSP code that capture the NIC names, takes 1 of em, get the IP of it, then gets the mac address of that IP, and then depending on the MAC, gives the user his results. The thing is that is working on my pc, the localhost webserver successfully, BUT, when some1 connects to my pc and use the page, he doesnt get his mac address no his ip nor anything. instead he gets MY IP, MY mac, MY Hostname and MY results. More info: using tomcat6 OS: ubuntu 9.10 linux what must I do to make that code work on other pcs to get their mac and their results instead of mine? could send any info that helps. plz help me and thx a lot in advance
hey can u po#T YOUR code here look like you 've wriiten code to capture the mac and ip of the HOST try changuing to client.methods im not sure cannot tell xactly withoutr looking ur src
Code: <html> <head> <title>Batsat.net</title> <%@ page language="java" import="java.io.*, java.net.*, java.util.*, java.lang.*, java.text.*" %> <% FileReader F= new FileReader("/usr/local/tomcat/webapps/Mac/database.txt"); BufferedReader br=new BufferedReader(F); File outputFile = new File("/usr/local/tomcat/webapps/Mac/results.html"); FileWriter outz= new FileWriter(outputFile); outz.write("<html>"); outz.write("<head><meta http-equiv="Pragma" content="no-cache"></head>"); outz.write("<body>"); String[] t={"0","0","0"}; int j=0; Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netIf : Collections.list(nets)) { t[j]=netIf.getName(); j++; outz.write("Display name: \n"+ netIf.getDisplayName()+"<br>"); outz.write("Name: \n"+ netIf.getName()+"<br>"); } String S2=null; NetworkInterface networkInterface = NetworkInterface.getByName(t[0]); List<InterfaceAddress> interfaceAddresses = networkInterface.getInterfaceAddresses(); for (InterfaceAddress address : interfaceAddresses) { S2=String.valueOf(address.getAddress()); S2=S2.substring(1); outz.write("\nAddress " + address.getAddress()+"<br>"); outz.write("Broadcast " + address.getBroadcast()+"<br>"); } String result = ""; InetAddress Add = InetAddress.getByName(S2); NetworkInterface networkInterfaces = NetworkInterface.getByInetAddress(Add); byte[] b1 = networkInterfaces.getHardwareAddress(); outz.write("Hardware Address = "); for (int i=0; i < b1.length; i++) { result += Integer.toString( ( b1[i] & 0xff ) + 0x100, 16).substring( 1 ); if(i!=5) result += "-"; } outz.write(result+"<br><br>"); try { InetAddress address = InetAddress.getLocalHost(); String IP = new String (address.getHostAddress()); outz.write(IP); } catch (Exception e) { e.printStackTrace(); } String s, first="1", second="2", third="3"; while((s=br.readLine())!=null) { Scanner pars = new Scanner(s).useDelimiter(" "); if(s.startsWith(result)) { while(pars.hasNext()){ first=pars.next(); second=pars.next(); third=pars.next(); } pars.close(); outz.write("<center>"); outz.write("<table border="+"1"+"><tr><th align=center>MAC</th><th align=center>DOWNLOAD</th><th align=center>UPLOAD</th></tr><tr><td align=center>"+first+"</td><td align=center>"+second+"</td><td align=center>"+third+"</td></tr>"); outz.write("</center></body>"); outz.write("</html>"); } } outz.write("<center><br><br><br><br><A HREF="); outz.write("mac.jsp"); outz.write(">Return to Main</a></center><br>"); outz.close(); %> </head> <body> <center> <br><br><br><br><br><br> <H1>(Account Checker)</H1> <a href=results.html>Check my account</a> </center> </body> </html> this code wont give me the client's mac.