Jump to content
Existing user? Sign In

Sign In



Sign Up

UUID Ban [Mac Computers]


Slatum

Recommended Posts

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

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

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".

Link to comment
Share on other sites

  • 8 months later...
  • 1 year later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Contact

[email protected]

astra.security

What is a RSPS?

A RSPS, also known as RuneScape private server, is an online game based on RuneScape, and controlled by independent individuals.

Popular RSPS Servers

Runewild Ikov RedemptionRSPS

Disclaimer

Runesuite is not affiliated with runescape, jagex in any way & exists solely for educational purposes.

×
×
  • Create New...