MCPcopy Create free account
hub / github.com/aixed/WeChat-Hook / GetDeviceUUID

Function GetDeviceUUID

src/tools.cpp:749–806  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747
748
749std::string GetDeviceUUID() {
750 // 获取CPU序列号前8位并转换为十进制
751 std::string cpuidtxt;
752 cpuidtxt = 系统_取CPU序列号_Hash();
753 //OutputDebugStringA(("CPU序列号: " + cpuidtxt + "\n").c_str());
754
755 // 获取MAC地址
756 std::string mac_all;
757 try {
758 mac_all = GetMACAddress();
759 //OutputDebugStringA(("获取的MAC地址: " + mac_all + "\n").c_str());
760 }
761 catch (...) {
762 mac_all = "000000000000";
763 }
764
765 // 计算MAC地址的MD5
766 std::string macmd5;
767 try {
768 macmd5 = 取数据摘要(字节集_十六进制到字节集(mac_all));
769 macmd5 = 到小写(删全部空(macmd5));
770 //OutputDebugStringA(("MAC地址MD5: " + macmd5 + "\n").c_str());
771 }
772 catch (...) {
773 macmd5 = std::string(32, '0'); // 32个0作为默认值
774 }
775
776 // 组合MAC MD5和CPU序列号
777 std::string dev_md5 = macmd5 + cpuidtxt;
778 //OutputDebugStringA(("组合字符串: " + dev_md5 + "\n").c_str());
779
780 try {
781 // 将组合字符串转换为十六进制
782 dev_md5 = 字节集_字节集到十六进制(到字节集(dev_md5));
783
784 // 再次计算MD5
785 dev_md5 = 取数据摘要(字节集_十六进制到字节集(dev_md5));
786 dev_md5 = 到小写(删全部空(dev_md5));
787 //OutputDebugStringA(("最终MD5: " + dev_md5 + "\n").c_str());
788
789 // 取前15位
790 if (dev_md5.length() >= 15) {
791 dev_md5 = dev_md5.substr(0, 15);
792 }
793 else {
794 // 如果长度不足,填充
795 dev_md5 += std::string(15 - dev_md5.length(), '0');
796 }
797 }
798 catch (const std::exception& ) {
799 dev_md5 = "000000000000000";
800 }
801
802 // 添加Windows标志
803 dev_md5 = "W" + dev_md5;
804
805 return dev_md5;
806}

Callers

nothing calls this directly

Calls 9

GetMACAddressFunction · 0.85
取数据摘要Function · 0.85
到小写Function · 0.85
删全部空Function · 0.85
到字节集Function · 0.85
stringFunction · 0.50

Tested by

no test coverage detected