import base64 import os from Crypto.Cipher import AES from Crypto.Util.Padding import pad defsub_4832B0(a1, a2, a3): # for ( i = 7; i >= 0; --i ) for i inrange(7, -1, -1): result = a2 - 1; v4 = (a3 >> (4 * i)) & 0x0F; v5 = a2 - 1; if (v4 <= a2 - 1): while (v4 <= result):
print(''.join(map(chr,a1))) # while ( v4 <= result ); return result; defmcrc16(x: bytes) -> bytes: a = 0xFFFF b = 0xA001 for byte in x: a ^= byte for i inrange(8): last = a % 2 a >>= 1 if last == 1: a ^= b return a.to_bytes(2, 'little') defkg(aeskey: str): aeskey = aeskey.replace('-', '').encode() info = aeskey info += b'1234' info += b'5678' info += b'\x4b\x48\x00\x00' info += 0x07ffffff.to_bytes(4, 'little') info += b'\x66\x00' info += b'ABCDEF' info += 0x00.to_bytes(2, 'little') # donot Transform # info=bytes(sub_4832B0(list(info), len(info), 0)) info += mcrc16(info) aescipher = AES.new(key=aeskey, mode=AES.MODE_ECB) bs = aescipher.encrypt(pad(info, 16)) lic = base64.b64encode(bs).decode() licpath = os.path.expanduser('~')+r'\AppData\Roaming\Cmsoft\NetAssist.lic' print(lic) print('注册指定过不了网络验证,但可以写入lic文件') print('lic文件路径:'+licpath) x = input("是否写入lic文件?(y)").lower() if x == 'y': withopen(licpath, 'w') as f: f.write(lic) # aescipher.decrypt( )
if __name__ == '__main__': mid = input("请输入终端识别码:") kg(mid)