Created
February 2, 2025 20:26
-
-
Save thanksshu/231cd4a6f2486403702a8974816297dd to your computer and use it in GitHub Desktop.
Generate AIDA64 key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Generate AIDA64 key. | |
| AIDA64 download link, edition and version can be changed: | |
| https://download.aida64.com/aida64business750.zip | |
| """ | |
| import random | |
| from datetime import datetime, timezone | |
| from enum import Enum | |
| _ENCODE_DICT = bytes(b"DY14UF3RHWCXLQB6IKJT9N5AGS2PM8VZ7E") | |
| class KeyEdition(Enum): | |
| BUSINESS = 1 | |
| EXTREME = 2 | |
| ENGINEER = 3 | |
| NETWORK_AUDIT = 4 | |
| def generate_key( | |
| edition: KeyEdition, | |
| purchase_date=datetime.now(timezone.utc), | |
| seats=1, | |
| license_expiry=0, # 0 days = nerver expire | |
| maintenance_expiry=3652, # 3652 days = 10 years | |
| ) -> str: | |
| purchase_date = max( | |
| datetime(2004, 1, 1, tzinfo=timezone.utc), | |
| min(purchase_date, datetime(2099, 1, 1, tzinfo=timezone.utc)), | |
| ) | |
| seats = max(1, min(seats, 797)) | |
| maintenance_expiry = max(1, min(maintenance_expiry, 3652)) | |
| unk1 = random.randint(100, 989) | |
| unk2 = random.randint(0, 100) | |
| unk3 = random.randint(0, 100) | |
| purchase_date_data = ( | |
| (purchase_date.year - 2003) * 512 + purchase_date.month * 32 + purchase_date.day | |
| ) | |
| key = bytearray(25) | |
| base = random.randint(0, 2 * len(_ENCODE_DICT)) | |
| key[0:2] = _encode_data(base ^ edition.value ^ 0xBF, 2) | |
| key[2:4] = _encode_data(base ^ unk1 ^ 0xED, 2) | |
| key[4:6] = _encode_data(base ^ unk2 ^ 0x77, 2) | |
| key[6:8] = _encode_data(base ^ unk3 ^ 0xDF, 2) | |
| key[8:12] = _encode_data(base ^ seats ^ 0x4755, 4) | |
| key[12:16] = _encode_data(base ^ purchase_date_data ^ 0x7CC1, 4) | |
| key[16:19] = _encode_data(base ^ license_expiry ^ 0x3FD, 3) | |
| key[19:22] = _encode_data(base ^ maintenance_expiry ^ 0x935, 3) | |
| key[22:24] = _encode_data(base, 2) | |
| key[24] = _encode_data(_get_checksum(key[0:24]), 3)[1] | |
| key_characters = [chr(k) for k in key] | |
| for i in range(20, 4, -5): | |
| key_characters.insert(i, "-") | |
| return "".join(key_characters) | |
| def _encode_data(data: int, byte_count: int) -> bytearray: | |
| return bytearray( | |
| _ENCODE_DICT[(data // (len(_ENCODE_DICT) ** i)) % len(_ENCODE_DICT)] | |
| for i in reversed(range(byte_count)) | |
| ) | |
| def _get_checksum(key_slice: bytes) -> int: | |
| checksum = 0 | |
| for byte in key_slice: | |
| checksum ^= byte << 8 | |
| for _ in range(8): | |
| checksum = (checksum << 1) ^ (0x8201 if checksum & 0x8000 else 0) | |
| return (checksum & 0xFFFF) % 0x9987 | |
| if __name__ == "__main__": | |
| key = generate_key(KeyEdition.BUSINESS) | |
| print(key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment