Slatum 43 Posted November 20, 2016 Report Share Posted November 20, 2016 Does anyone know how to add something to this code that can allow Macintosh users to log in? import java.io.BufferedReader; import java.io.File; import java.io.FileWriter; import java.io.InputStreamReader; public class CreateUID { public static String getWMIValue(String wmiQueryStr, String wmiCommaSeparatedFieldName) throws Exception { String vbScript = getVBScript(wmiQueryStr, wmiCommaSeparatedFieldName); String tmpDirName = getEnvVar("TEMP").trim(); String tmpFileName = tmpDirName + File.separator + "jwmi.vbs"; writeStrToFile(tmpFileName, vbScript); String output = execute(new String[] {"cmd.exe", "/C","/users/", "cscript.exe", tmpFileName}); new File(tmpFileName).delete(); return output.trim(); } private static final String CRLF = "\r\n"; private static String getVBScript(String wmiQueryStr, String wmiCommaSeparatedFieldName) { String vbs = "Dim oWMI : Set oWMI = GetObject(\"winmgmts:\")"+CRLF; vbs += "Dim classComponent : Set classComponent = oWMI.ExecQuery(\""+wmiQueryStr+"\")"+CRLF; vbs += "Dim obj, strData"+CRLF; vbs += "For Each obj in classComponent"+CRLF; String[] wmiFieldNameArray = wmiCommaSeparatedFieldName.split(","); for(int i = 0; i < wmiFieldNameArray.length; i++) { vbs += " strData = strData & obj."+wmiFieldNameArray[i]+" & VBCrLf"+CRLF; } vbs += "Next"+CRLF; vbs += "wscript.echo strData"+CRLF; return vbs; } private static String getEnvVar(String envVarName) throws Exception { String varName = "%"+envVarName+"%"; String envVarValue = execute(new String[] {"cmd.exe","/C", "/users/", "echo "+varName}); if(envVarValue.equals(varName)) { throw new Exception("Environment variable '"+envVarName+"' does not exist!"); } return envVarValue; } private static void writeStrToFile(String filename, String data) throws Exception { FileWriter output = new FileWriter(filename); output.write(data); output.flush(); output.close(); output = null; } private static String execute(String[] cmdArray) throws Exception { Process process = Runtime.getRuntime().exec(cmdArray); BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream())); String output = ""; String line = ""; while((line = input.readLine()) != null) { //need to filter out lines that don't contain our desired output if(!line.contains("Microsoft") && !line.equals("")) { output += line +CRLF; } } process.destroy(); process = null; return output.trim(); } public static String generateUID() throws Exception { String serial = getWMIValue("SELECT SerialNumber FROM Win32_BIOS", "SerialNumber"); //serial = serial.replaceAll("[^\\d]", ""); String idate = getWMIValue("Select InstallDate from Win32_OperatingSystem", "InstallDate"); //idate = idate.replaceAll("[^\\d]", ""); return (serial.concat(idate)); } public static final String CLASS_Win32_BIOS = "Win32_BIOS"; public static final String CLASS_Win32_OperatingSystem = "Win32_OperatingSystem"; } Link to comment Share on other sites More sharing options...
leclerc 112 Posted November 20, 2016 Report Share Posted November 20, 2016 can or can't? Link to comment Share on other sites More sharing options...
Slatum 43 Posted November 20, 2016 Author Report Share Posted November 20, 2016 5 minutes ago, leclerc said: can or can't? I am trying to figure out if i can add something to make this compatible for mac users. As of right now, they are unable to log in. Link to comment Share on other sites More sharing options...
leclerc 112 Posted November 20, 2016 Report Share Posted November 20, 2016 1 hour ago, Slatum said: I am trying to figure out if i can add something to make this compatible for mac users. As of right now, they are unable to log in. mac users don't have the "C drive", they use "user.home". 1 Link to comment Share on other sites More sharing options...
godaddy 4 Posted July 27, 2017 Report Share Posted July 27, 2017 I would like to see a snippet or tutorial for adding uuid detection on linux machines aswell. Link to comment Share on other sites More sharing options...
DecrepitDegenerate 36 Posted July 28, 2017 Report Share Posted July 28, 2017 On 11/20/2016 at 5:00 PM, leclerc said: mac users don't have the "C drive", they use "user.home". this^ Link to comment Share on other sites More sharing options...
KieranDevvs 1 Posted December 10, 2018 Report Share Posted December 10, 2018 No VBScript isnt something that's available on Mac. Also UUID bans are pretty much useless as you cant trust anything outside the servers domain. The most efficient way to ban someone is to make it hard to create accounts to the point where its not worth creating numerous. A good idea might be to only allow one connection from any given remote address and implement a system where all new users are segregated from the player base for x hours. That way when you ban someone they have to already have pre-made accounts to log back in, or go through the whole process again. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now