自己下载python-x64-v3.8软件 我电脑电脑用python3.13.1可以用下载好多不能用
Python3.8.1以上都可以;由于软件太大不能上传自行下载
代码保存为new.py(自己编);
打开CMD,CD到保存new.py文件夹,
用python new.py *********运行,
图中000000换成你的机器码。 大功告成。
import sys
def crc16(data): num = len(data) if num > 0: num2 = 0xFFFF for byte in data: num2 ^= byte for _ in range(8): if (num2 & 1) != 0: num2 = (num2 >> 1) ^ 0xA001 else: num2 >>= 1 return num2 else: return 0
def generate_mac_password(mac): # Convert MAC address to bytes array = bytearray(mac.encode('ascii')) # Calculate CRC16 num = crc16(array) # Generate password based on CRC16 value text = f"{num * 7:04X}" return text[-4:]
def generate_password1(mac, index): # Generate the base password from MAC address base_password = generate_mac_password(mac) # Append the index (converted to hex) text = base_password + f"{index:02X}" # Convert the combined text to bytes for CRC calculation array = bytearray(text.encode('ascii')) # Calculate CRC16 and append to the password crc = crc16(array) return text + f"{crc & 0xFF:02X}"
if __name__ == "__main__": # print(len(sys.argv)) if len(sys.argv) not in [2, 3]: print("Usage: python script.py <mac> <textBox_pollCode>") sys.exit(1)
print(f"输入的本机序列码:{sys.argv[1]}") mac = sys.argv[1] textBox_pollCode = "00000000" if len(sys.argv) == 3: # Both mac address and textBox_pollCode are provided textBox_pollCode = sys.argv[2] if len(textBox_pollCode) < 6: print("Error: textBox_pollCode should have at least 8 characters") sys.exit(2)
# Extract index from textBox_pollCode index = int(textBox_pollCode[4:6], 16)
# Generate the password generated_password = generate_password1(mac, index)
print(f"对应拓邦用户注册码: {generated_password}")