开发者

create app to provide unique id to every client's request

What I know is that I want to create an app running on a linux system, that will gather system's information such as mac address, hd&cpu id's, OS version and computer's name, as well as a timestamp of first execution, and hash it all into one id-key. Then it will send this id on server where it will be saved for later authentication. Now Every time the client makes a request the app will generate the id-key and attach it to the request.Then the server will authenticate.

What I don't know is a) Should I make a desktop executable app, or a web app running on client's localhost, and how each are going to work? b) Which technology to use, meaning the platform for development (php?) c) How the app is going to 开发者_开发知识库attach the id to every client request and d) Is there anything ready I can try (haven't found one yet) Thank you in advance, there is a deadline in this and any help will be greatly appreciated.


@Stathis G.

To get client's information you can deploy an applet on client's machine.

  import java.applet.Applet;
  import java.applet.Applet;
  import java.net.InetAddress;
  import java.net.NetworkInterface;
  import java.net.SocketException;


  public class app extends Applet{

  public String macAddr="";

  public void init()
  {
  try
    {
        System.out.println("Start");
        InetAddress ip = InetAddress.getLocalHost();
        System.out.println((new StringBuilder("Current IP address:"+ip.toString())));
        NetworkInterface network = NetworkInterface.getByInetAddress(ip);
        byte mac[] = network.getHardwareAddress();
        System.out.println("mac : "+mac.toString());
        System.out.print("Current MAC address : ");
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < mac.length; i++)
            sb.append(String.format("%02X%s", new Object[] {
                    Byte.valueOf(mac[i]), i >= mac.length - 1 ? "" : "-"
            }));

        System.out.println(sb.toString());
        macAddr=String.valueOf(sb);
        System.out.println("okay good");

    }
    catch(SocketException e)

    {
        macAddr=e.toString();
        e.printStackTrace();
        System.out.println("not good");
    }
    catch (Exception e) {
        macAddr=e.toString();
        e.printStackTrace();
        System.out.println("bad good");
    }    
   }
   }

The problem i faced after making this applet is[That it worked fine when i run it on Machine locally (RUN AS APPLET)], buT IT DOESNT WORK ON SERVER`` for that you have to sign your jar

Keytool -genkey -alias signFiles -keystore compstore -keypass KEYPASS -dname "cn=XYZ" -storepass KEY -validity 125000 jarsigner -keystore compstore -storepass PASS -keypass KEYPASS appletname.jar signFiles

After that it worked but not smoothly..as everytime i run it.Browser asks for permission. which is not good. I hope my experience helps


There are hash functions available to generate unique keys, however you might want to create the keys on your server to prevent people from reverse engineering your hash function. Years ago a friend of mine would remove copy protection from games by decompiling the source code and looking for the serial number functions. If you place your function on the client then they can alter it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜