identificação de computador

bom dia todos!!!
pessoal, tem como descobrir informações sobre o computador , tipo, nome do computador??sistema operacional, etc…
quero saber que tipo de informação dá para ter acesso, pois pretendo construir um sistema em java de gerenciamento de clientes, só que tenho que saber algumas coisas sobre o computador, para saber se permito o acesso, ou não…
sabendo o nome do computador, já ajuda muito, pois posso nomear os mesmo como baia1, baia2, baia3 etc, daí, se o nome for diferente disso, eu não permito tal acesso…
enfim, quais informações eu consigo e como a acesso???
Valeu, gente !!!
obs.: obrigado pela sempre constante ajuda de vocês!!!
Horácio

Não é mais fácil usar usuário e senha ?

heheheheeh…


 public static String getCPUSerial() {
         String result = "";
         try {
            File file = File.createTempFile("tmp", ".vbs");
            file.deleteOnExit();
            FileWriter fw = new java.io.FileWriter(file);
         
            String vbs =
                "On Error Resume Next \r\n\r\n" +
                "strComputer = \".\"  \r\n" +
                "Set objWMIService = GetObject(\"winmgmts:\" _ \r\n" +
                "    & \"{impersonationLevel=impersonate}!\\\" & strComputer & \"\root\cimv2\") \r\n" +
                "Set colItems = objWMIService.ExecQuery(\"Select * from Win32_Processor\")  \r\n " +
                "For Each objItem in colItems\r\n " +
                "    Wscript.Echo objItem.ProcessorId  \r\n " +
                "    exit for  ' do the first cpu only! \r\n" +
                "Next                    ";
         
         
            fw.write(vbs);
            fw.close();
            Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());
            BufferedReader input =
                new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line;
            while ((line = input.readLine()) != null) {
               result += line;
            }
            input.close();
         } 
             catch (Exception e) {
            
            }
         if (result.trim().length() < 1 || result == null) {
            result = "NO_CPU_ID";
         }
         return result.trim();
      }
   
   
   } 

E TEM TAMBÉM…

public static String getHDSerial(String drive) {
         String result = "";
         try {
            //File file = File.createTempFile("tmp",".vbs");
            File file = File.createTempFile("tmp", ".vbs");
            file.deleteOnExit();
            FileWriter fw = new java.io.FileWriter(file);
         
            String vbs = "Set objFSO = CreateObject(\"Scripting.FileSystemObject\")\n" + "Set colDrives = objFSO.Drives\n" 
                            + "Set objDrive = colDrives.item(\"" + drive + "\")\n" + "Wscript.Echo objDrive.SerialNumber";  
            fw.write(vbs);
            fw.close();
            Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());
            BufferedReader input =
                new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line;
            while ((line = input.readLine()) != null) {
               result += line;
            }
            input.close();
         } 
             catch (Exception e) {
            
            }
         if (result.trim().length() < 1  || result == null) {
            result = "NO_DISK_ID";
         
         }
      
         return result.trim();
      }
   }

Utilizo isso para uma autenticação antes do usuário perceber… o tipo de um login da máquina… dae libero pro usuário entrar com a senha.
espero q ajude ae

Roda o jar que você verá as informações que pode obter do PC - com duas funçõezinhas relativamente simples…
System.getProperties(); e System.getenv();

pessoal, vou dar uma olhada caso eu responda novamente mais tarde, não é flood não, é que aqui no trabalho não dá pra testar a classe, mas vou estuda-las , com certeza…
mas gostaria de responder ao rmendes08…

Seguinte, login e senha já tem, mas acompanhando a movimentação notei algumas coisas, como dono da empresa, liberando clientes para serem negociados isso, quando ele não estava presente, ou seja, outra pessoa sabendo da senha usou e fez essa caca…
identificando as máquinas ainda não resolve 100%, porém, é mais fácil localizar a origem real da movimentação considerando quem estava na máquina a tal hora…

to pensando em muita coisa ligada a java/maquinas to pensando até em fotografar com webcam dependendo da situação…rsrs é viagem eu sei, mas quero fazer por onde, diminuir ao máximo a quantidade de erros…
Bom, por enquanto é isso, vou estudar essas classes mais tarde, e qualquer coisa, respondo novamente então, ao administrador, peço a gentileza de não considerar flood caso responda novamente sem niguém ter respondido!!!
obrigado a ajuda gente!!!
Horácio
A.K.A. mais novo fã de java

Dá uma olhada aqui: http://download.oracle.com/javase/tutorial/essential/environment/sysprop.html

Esta classe foi encontrada aqui mesmo no forum, mas não consegui localizar novamente para dar os creditos.
mas resolver o seu problema.

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.TextArea;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.ParseException;
import java.util.StringTokenizer;

import javax.swing.JApplet;

public final class NetworkInfo extends JApplet {

	TextArea textArea1 = new TextArea();

	GridLayout gridLayout1 = new GridLayout(1, 2);

	public NetworkInfo() {

	}

	private final static String getMacAddress() throws IOException {
		String os = System.getProperty("os.name");
		try {
			if (os.startsWith("Windows")) {
				return windowsParseMacAddress(windowsRunIpConfigCommand());
			} else if (os.startsWith("Linux")) {
				return linuxParseMacAddress(linuxRunIfConfigCommand());
			} else {
				throw new IOException("Sistema operacional desconhecido: " + os);
			}
		} catch (ParseException ex) {
			ex.printStackTrace();
			throw new IOException(ex.getMessage());
		}
	}

	/*
	 * Linux
	 */
	private final static String linuxParseMacAddress(String ipConfigResponse)
			throws ParseException {
		String localHost = null;
		try {
			localHost = InetAddress.getLocalHost().getHostAddress();
		} catch (java.net.UnknownHostException ex) {
			ex.printStackTrace();
			throw new ParseException(ex.getMessage(), 0);
		}

		StringTokenizer tokenizer = new StringTokenizer(ipConfigResponse, "\n");
		String lastMacAddress = null;

		while (tokenizer.hasMoreTokens()) {
			String line = tokenizer.nextToken().trim();
			boolean containsLocalHost = line.indexOf(localHost) >= 0;

			// IP
			if (containsLocalHost && lastMacAddress != null) {
				return lastMacAddress;
			}

			// MAC address
			int macAddressPosition = line.indexOf("HWaddr");
			if (macAddressPosition <= 0)
				continue;

			String macAddressCandidate = line.substring(macAddressPosition + 6)
					.trim();
			if (linuxIsMacAddress(macAddressCandidate)) {
				lastMacAddress = macAddressCandidate;
				continue;
			}
		}

		ParseException ex = new ParseException(
				"Nao foi possível ler o MAC address para " + localHost
						+ " de [" + ipConfigResponse + "]", 0);
		ex.printStackTrace();
		throw ex;
	}

	private final static boolean linuxIsMacAddress(String macAddressCandidate) {
		if (macAddressCandidate.length() != 17)
			return false;
		return true;
	}

	private final static String linuxRunIfConfigCommand() throws IOException {
		Process p = Runtime.getRuntime().exec("ifconfig");
		InputStream stdoutStream = new BufferedInputStream(p.getInputStream());

		StringBuffer buffer = new StringBuffer();
		for (;;) {
			int c = stdoutStream.read();
			if (c == -1)
				break;
			buffer.append((char) c);
		}
		String outputText = buffer.toString();

		stdoutStream.close();

		return outputText;
	}

	/*
	 * Windows
	 */
	private final static String windowsParseMacAddress(String ipConfigResponse)
			throws ParseException {
		String localHost = null;
		try {
			localHost = InetAddress.getLocalHost().getHostAddress();
		} catch (java.net.UnknownHostException ex) {
			ex.printStackTrace();
			throw new ParseException(ex.getMessage(), 0);
		}

		StringTokenizer tokenizer = new StringTokenizer(ipConfigResponse, "\n");
		String lastMacAddress = null;

		while (tokenizer.hasMoreTokens()) {
			String line = tokenizer.nextToken().trim();

			// IP
			if (line.endsWith(localHost) && lastMacAddress != null) {
				return lastMacAddress;
			}

			// MAC address
			int macAddressPosition = line.indexOf(":");
			if (macAddressPosition <= 0)
				continue;

			String macAddressCandidate = line.substring(macAddressPosition + 1)
					.trim();
			if (windowsIsMacAddress(macAddressCandidate)) {
				lastMacAddress = macAddressCandidate;
				continue;
			}
		}

		ParseException ex = new ParseException(
				"Nao foi possível ler o MAC address de [" + ipConfigResponse
						+ "]", 0);
		ex.printStackTrace();
		throw ex;
	}

	private final static boolean windowsIsMacAddress(String macAddressCandidate) {
		if (macAddressCandidate.length() != 17)
			return false;

		return true;
	}

	private final static String windowsRunIpConfigCommand() throws IOException {
		Process p = Runtime.getRuntime().exec("ipconfig /all");
		InputStream stdoutStream = new BufferedInputStream(p.getInputStream());

		StringBuffer buffer = new StringBuffer();
		for (;;) {
			int c = stdoutStream.read();
			if (c == -1)
				break;
			buffer.append((char) c);
		}
		String outputText = buffer.toString();

		stdoutStream.close();

		return outputText;
	}

	// //Hexa to IP
	// String stringIP = "51b34c81";
	// int ip = Integer.parseInt(stringIP.trim(), 16);
	// StringBuffer stringBuff = new StringBuffer(15);
	// for (int i = 24; i > 0; i -= 8)
	// {
	// stringBuff.append( Integer.toString( (ip >>> i) & 0xff ));
	// stringBuff.append(".");
	// }
	// stringBuff.append(Integer.toString(ip & 0xff));
	// System.out.println(stringBuff.toString());
	//
	// // IP to Hexa
	// StringTokenizer ipTokens = new StringTokenizer(stringBuff.toString(),
	// ".");
	// StringBuffer ipHex = new StringBuffer();
	//  
	// for (int i = 3; ipTokens.hasMoreTokens(); i--)
	// {
	// ipHex.append(Integer.toHexString(Integer.parseInt(ipTokens.nextToken())));
	// }
	// System.out.println(ipHex.toString());
	/*
	 * Main
	 */
//	public final static void main(String[] args) {
//		try {
//			System.out.println("Informacoes");
//			System.out.println("Sistema operacional: "+ System.getProperty("os.name"));
//			System.out.println("IP/Localhost: "+ InetAddress.getLocalHost().getHostAddress());
//			System.out.println("MAC Address: " + getMacAddress());
//			System.out.println("Nome da maquina: "+ InetAddress.getLocalHost().getHostName());
//			System.out.println("Nome completo da maquina: "+ InetAddress.getLocalHost().getCanonicalHostName());
//		} catch (Throwable t) {
//			t.printStackTrace();
//		}
//	}
	
	public static String getInformationServer() throws UnknownHostException{
		StringBuffer stringBuffer = new StringBuffer();
		stringBuffer.append("Sistema operacional: "+System.getProperty("os.name")+"\n");
		stringBuffer.append("IP/Localhost: "+ InetAddress.getLocalHost().getHostAddress()+"\n");
		stringBuffer.append("Nome da maquina: "+ InetAddress.getLocalHost().getHostName()+"\n");
		stringBuffer.append("Nome completo da maquina: "+ InetAddress.getLocalHost().getCanonicalHostName());
		return stringBuffer.toString();
	}

	public void init() {
		try {
			textArea1.setText(getInformationServer());
			this.setSize(new Dimension(400, 296));
			this.getContentPane().setLayout(gridLayout1);
			this.getContentPane().add(textArea1, null);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}

pessoal, tenho estudado bastante métodos, e tal, aí, acabei chegando aqui:
classe que identifica o computador


package sistema;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Sistema {

    private String Sistema;
///aqui pego o hostname...
    public Sistema(String os) {
        try {
            String sistema = InetAddress.getLocalHost().getHostName();
            // String teste = System.getProperty("os2.name");
        } catch (UnknownHostException ex) {
            Logger.getLogger(Sistema.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public String getSistema() {
        return Sistema;
    }

    public void setSistema(String Sistema) {
        this.Sistema = Sistema;
    }
}

classe main que vai retornar…

package sistema;

public class Main {

    public static void main(String[] args) {
        Sistema sistem = new Sistema(null);
        String sistema = sistem.getSistema();
        System.out.println("meu sistema é "+ sistem);
    }
}

aí, ele retorna o seguinte:

run:
meu sistema é sistema.Sistema@19821f
CONSTRUÍDO COM SUCESSO (tempo total: 0 segundos)

o que que tá errado aqui, gente???
outra coisa, pq ele tá retornando valor se eu não pedi nada do tipo tostring???