XUID Generator

Posts 115 of 33 · Page 1 of 3
XUID Generator
This was taking from a link in NTAuthority's signature, which (supposedly) is the source code of the XUID generator in alterIW's code. As you know, batfitch has already bypassed the XUID gen with a spoofer, but this could be helpful for other scripters that wish to use it. If not, ah well.

Pastebin Link: C++ | unsigned int hash(unsigned char* inpStr, size_t le - Meh

Code:

Code:
unsigned int hash(unsigned char* inpStr, size_t len)
{
	unsigned int value = 0,temp = 0;
	for(size_t i=0;i<len;i++)
	{
		temp = inpStr[i];
		temp += value;
		value = temp << 10;
		temp += value;
		value = temp >> 6;
		value ^= temp;
	}
	temp = value << 3;
	temp += value;
	unsigned int temp2 = temp >> 11;
	temp = temp2 ^ temp;
	temp2 = temp << 15;
	value = temp2 + temp;
	if(value < 2) value += 2;
	return value;
}

Microsoft::Win32::RegistryKey^ GetNetworkRegistryKey(String^ id) {
	try
	{
		Microsoft::Win32::RegistryKey^ networkInterfaceKey = Microsoft::Win32::Registry::LocalMachine->OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}", false);
		cli::array<String^>^ keyNames = networkInterfaceKey->GetSubKeyNames();

		for each (String^ keyName in keyNames) {
			Microsoft::Win32::RegistryKey^ key = networkInterfaceKey->OpenSubKey(keyName);

			String^ value = (String^)key->GetValue("NetCfgInstanceId", "");
			if (value == id) {
				return key;
			}
		}

		return nullptr;
	}
	catch (System::Security::SecurityException^)
	{
		return nullptr;
	}
}

String^ GetDeviceIDForDriverKey(String^ key)
{
	int index = 0;
	char buffer[1024];
	String^ deviceID = "";

	SP_DEVINFO_DATA data;
	memset(&data, 0, sizeof(data));
	data.cbSize = sizeof(data);

	HDEVINFO handle = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, NULL, NULL, DIGCF_PRESENT);

	while (SetupDiEnumDeviceInfo(handle, index, &data))
	{
		index++;

		if (SetupDiGetDeviceRegistryPropertyA(handle, &data, SPDRP_DRIVER, NULL, (PBYTE)buffer, sizeof(buffer), NULL))
		{
			String^ key2 = gcnew String(buffer);

			if (key->Replace("HKEY_LOCAL_MACHINE\\", "")->ToLower() == key2->ToLower())
			{
				if (SetupDiGetDeviceRegistryPropertyA(handle, &data, SPDRP_HARDWAREID, NULL, (PBYTE)buffer, sizeof(buffer), NULL))
				{
					deviceID = gcnew String(buffer);
				}
			}
		}
	}

	int err = GetLastError();

	if (handle)
	{
		SetupDiDestroyDeviceInfoList(handle);
	}

	return deviceID;
}

bool IsValidInterface(String^ id, bool legacy) {
	if (Environment::OSVersion->Platform != PlatformID::Win32Windows && Environment::OSVersion->Platform != PlatformID::Win32NT) {
		return true;
	}

	Microsoft::Win32::RegistryKey^ key = GetNetworkRegistryKey(id);

	if (key == nullptr) {
		return false;
	}

	String^ deviceID = GetDeviceIDForDriverKey(key->Name->Replace("SYSTEM\\CurrentControlSet\\Control\\Class\\", ""));//(String^)key->GetValue("MatchingDeviceId", "");
	String^ deviceID2 = "";//(String^)key->GetValue("DeviceInstanceId", "");

	if (legacy)
	{
		deviceID = (String^)key->GetValue("DeviceInstanceId", "");

		return (deviceID->ToLower()->StartsWith("pci"));
	}

	key->Close();

	return (deviceID->ToLower()->StartsWith("pci") || deviceID->ToLower()->StartsWith("usb") || deviceID->ToLower()->StartsWith("{") || deviceID2->ToLower()->StartsWith("pci"));
}

String^ WhyInvalidInterface(String^ id) {
	if (Environment::OSVersion->Platform != PlatformID::Win32Windows && Environment::OSVersion->Platform != PlatformID::Win32NT) {
		return "BECAUSE I'M COOL";
	}

	Microsoft::Win32::RegistryKey^ key = GetNetworkRegistryKey(id);

	if (key == nullptr) {
		return "NULLPTR";
	}

	String^ deviceID = (String^)key->GetValue("MatchingDeviceId", "");
	String^ deviceID2 = (String^)key->GetValue("DeviceInstanceId", "");
	String^ deviceID3 = GetDeviceIDForDriverKey(key->Name->Replace("SYSTEM\\CurrentControlSet\\Control\\Class\\", "")); // edit: this code wasn't used originally, and isn't used in currently released code ;)

	key->Close();

	return ("#1: " + deviceID->ToLower() + " #2: " + deviceID2->ToLower() + " #3 (AwesomeID): " + deviceID3->ToLower());
}

char* lolololol = "ATTN: developer of that weird registry hook\r\nI'm sorry, but it seems you didn't read rule #724865. Read it, apply it, and maybe I'll give up. By the way, your actions did have some results: banning doesn't result in a ban anymore.";

bool IsConnectedInterface(String^ id) {
	if (Environment::OSVersion->Platform != PlatformID::Win32Windows && Environment::OSVersion->Platform != PlatformID::Win32NT) {
		return true;
	}

	Microsoft::Win32::RegistryKey^ key = GetNetworkRegistryKey(id);

	if (key == nullptr) {
		return false;
	}

	cli::array<String^>^ values = key->GetValueNames();
	String^ valueName = "";
	bool hasProviderName = false;

	for each (String^ value in values) {
		if (value->ToLower()->StartsWith("ne") && value->ToLower()->Contains("re")) {
			valueName = value;
		}

		if (value->ToLower()->StartsWith("pr") && value->ToLower()->Contains("rn")) {
			hasProviderName = true;
		}
	}

	if (valueName == "") {
		return true;
	}

	String^ valueData = (String^)key->GetValue(valueName, "ne");
	return (valueData == String::Empty) && hasProviderName;
}

unsigned int steamID = 0;
bool gotFakeSteamID = true;
bool useNewAuthFunctions = true;
bool connectedInterface = true;
bool steamIDLegacy = false;

void SetSteamIDLegacy(bool legacy)
{
	steamIDLegacy = legacy;
	steamID = 0;
}

void ErrorWithWebLink(String^ error, String^ webLink);

unsigned int GetPlayerSteamID() {
	//return 51393034;
	//StreamReader^ reader = File::OpenText("steamID.txt");
	//int id = int::Parse(reader->ReadToEnd()->Trim());
	//reader->Close();
	if (useNewAuthFunctions && Custom::Hook != nullptr) {
		int id = Custom::Hook->GetSteamID();

		if (id != 0) {
			return id;
		}
	}

	if (steamID == 0) {
		String^ dbg = "";

		//steamID = Random::Next();
		gotFakeSteamID = true;
		Random^ random = gcnew Random();
		steamID = random->Next();

		#if !DEDICATED
		try {
			cli::array<NetworkInformation::NetworkInterface^>^ ifaces = NetworkInformation::NetworkInterface::GetAllNetworkInterfaces();
			for each (NetworkInterface^ iface in ifaces) {
				dbg += String::Format("Interface {0} (type {1})\r\n", iface->Description, iface->NetworkInterfaceType);

				if (iface->NetworkInterfaceType != NetworkInterfaceType::Tunnel && iface->NetworkInterfaceType != NetworkInterfaceType::Loopback) {
					if (!IsValidInterface(iface->Id, steamIDLegacy)) {
						dbg += "INVALID INTERFACE\r\nWHY: " + WhyInvalidInterface(iface->Id) + "\r\n";
						continue;
					}

					if (!IsConnectedInterface(iface->Id)) {
						connectedInterface = false;
						dbg += "NON-CONNECTED INTERFACE\r\n";
						continue;
					}

						cli::array<unsigned char>^ address = iface->GetPhysicalAddress()->GetAddressBytes();

						try {
							dbg += "MAC ADDRESS: ";

							for (int i = 0; i < address->Length; i++)
							{
								dbg += address[i].ToString("X2");
							}

							dbg += "\r\n";

							pin_ptr<unsigned char> addressPtr = &address[0];

							steamID = hash(addressPtr, address->Length);

							// check steamID for being '2', which happens if GetAddressBytes is a list of zero
							if (steamID == 2) {
								dbg += "STEAMID IS 2, WHICH IS BAD\r\n";
								continue;
							}

							if (steamID == 0xE2642C56 || steamID == 0x6A9528FD || steamID == 0x57B3821C)
							{
								dbg += "invalid steamid generated: " + steamID.ToString("X8") + "\r\n";
								continue;
							}

							gotFakeSteamID = false;

							dbg += "KA-CHING\r\n";
							break;
						} catch (IndexOutOfRangeException^ exx) {
							dbg += "EXCEPTION\r\n";
							dbg += exx->ToString() + "\r\n";
						}
				}
			}
		} catch (Exception^ exe) {
			dbg += "MAIN EXCEPTION\r\n";
			dbg += exe->ToString() + "\r\n";
		}
		#endif

		if (gotFakeSteamID) {
#if !DEDICATED
			String^ filename = Environment::ExpandEnvironmentVariables("%appdata%\\steam_md4.dat");
#else
			String^ filename = "dedi_xuid.dat";
#endif
			if (!File::Exists(filename)) {
				FileStream^ stream = File::OpenWrite(filename);
				stream->Write(BitConverter::GetBytes(steamID), 0, 4);
				stream->Close();
			} else {
				if (steamIDLegacy)
				{
					FileStream^ stream = File::OpenRead(filename);
					array<Byte>^ buffer = gcnew array<Byte>(5);
					stream->Read(buffer, 0, 4);
					steamID = BitConverter::ToUInt32(buffer, 0);
					stream->Close();
				}
				else 
				{
					steamID = 2;

					Windows::Forms::MessageBox::Show("WARNING #5C-DEV-IDGEN: please report on http://alteriw.net/ forums.\r\nDEBUG INFO: \r\n" + dbg + "\r\nTo copy this info, press Ctrl+C in this dialog window.", "alterCI");
				}
			}

			if (!connectedInterface) {
				ErrorWithWebLink("The main\\iw_22.iwd file is incorrect. You might have used the 'Update' package while having an old version.\nClick OK to be directed to the alterIWnet download page.", "http://alteriw.net/viewtopic.php?f=3&t=24");
				return 2;
			}
		}

	}

	return steamID;
}
Enjoy :>
Its funny because you'd have to properly make use of the code, let alone understand it, when theres an alternate extremely-noob friendly 30 second method that requires no other programs what so ever.
Quote Originally Posted by alteredIW View Post
Its funny because you'd have to properly make use of the code, let alone understand it, when theres an alternate extremely-noob friendly 30 second method that requires no other programs what so ever.
It's funny because I posted that there is the XUID gen which is much easier, but the simple fact that if other scripters that did understand this code wanted to use/implement it, it was here for them.
Far, it took you that long to post it? You're getting slow..
Quote Originally Posted by aIW|Convery View Post
Far, it took you that long to post it? You're getting slow..
I know, damn. I'm never on alterIW's forum anymore, usually XUID spoofing and aimbotting in random SnD servers. Ah well.
Quote Originally Posted by Convary View Post
I know, damn. I'm never on alterIW's forum anymore, usually XUID spoofing and aimbotting in random SnD servers. Ah well.
I hope you are not trying to claim that you were able to code anything yourself
Quote Originally Posted by aIW|Convery View Post
I hope you are not trying to claim that you were able to code anything yourself
Since when did I claim anything of the sort my good man? I clearly state in the beginning sentence of this page that there is already an XUID spoofer, and I have never made any inclination of having knowledge capable of coding an aimbot.
nice release
you have lucky you have dynamic ip than
but u know it's annoying people with aimbot?
Quote Originally Posted by lolbie View Post
nice release
you have lucky you have dynamic ip than
but u know it's annoying people with aimbot?
What's more annoying is when someone has registered the name you wanted to use on a forum :3
Quote Originally Posted by convery View Post
What's more annoying is when someone has registered the name you wanted to use on a forum :3
LOL! Just fucking win.
lol
still not a reason to use aimbot and such

omg i am so confused now 3 convery ?
Quote Originally Posted by lolbie View Post
omg i am so confused now 3 convery ?
Read the names, there's two hedgehogs and a toad..
Quote Originally Posted by aIW|Convery View Post
Read the names, there's two hedgehogs and a toad..
Don't you mean two asskissers and a fag?
Quote Originally Posted by Convary View Post
Don't you mean two asskissers and a fag?
Nope, you only have one persona named Convary :3
Quote Originally Posted by aIW|Convery View Post
Nope, you only have one persona named Convary :3
Ohh nice comeback.
Posts 115 of 33 · Page 1 of 3
This thread is closed for replies.

Tags for this Thread

None

Need help?