Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHR License Structure #44

Open
bimaindrawans opened this issue Oct 7, 2024 · 5 comments
Open

CHR License Structure #44

bimaindrawans opened this issue Oct 7, 2024 · 5 comments

Comments

@bimaindrawans
Copy link

bimaindrawans commented Oct 7, 2024

I used the license.py file from your previous repository update, but I encountered an issue when generating a license for the CHR version. Would you be willing to share the structure for creating a license for the CHR type? This is because the software ID structure is different from the regular x86, which only has 9 characters, while in CHR there is a combination of letters and symbols totaling 11 characters.

should i cut the chr license byte like this ?

def generate_license(software_id, private_key: bytes, version: int = 7, level: int = 6):
    assert isinstance(private_key, bytes)
    
    if isinstance(software_id, str):
        # Hash the software_id if it's longer than 6 bytes (for CHR version)
        if len(software_id) > 6:
            hashed_id = hashlib.sha256(software_id.encode()).digest()
            software_id = int.from_bytes(hashed_id[:6], 'little')
        else:
            software_id = mikro_softwareid_decode(software_id)
    
    lic = software_id.to_bytes(6, 'little')
    lic += version.to_bytes(1, 'little')
    lic += level.to_bytes(1, 'little')
    lic += b'\0' * 8
    
    sig = mikro_kcdsa_sign(lic, private_key)
    lic = mikro_base64_encode(mikro_encode(lic) + sig, True)
    
    return (MIKRO_LICENSE_HEADER + '\n' + 
            lic[:len(lic) // 2] + '\n' + 
            lic[len(lic) // 2:] + '\n' + 
            MIKRO_LICENSE_FOOTER)
@israelrmm
Copy link

you must check this

https://t.me/mikrotikpatch/13486

@bimaindrawans
Copy link
Author

you must check this

https://t.me/mikrotikpatch/13486

i didn't find chr structure on that script, because i think the structure written on the license_generator files.

@israelrmm
Copy link

israelrmm commented Dec 4, 2024

you must check this

https://t.me/mikrotikpatch/13486

if you see that source code. RouterOS Lisecnse Key XXXX-XXXX has 6bit, and "little" is true....

chr lisense could be 3bit and "little" is false .. (See attchment)

then maybe lic = software_id.to_bytes(6, 'little') ---> lic = software_id.to_bytes(3, ???) ???=big?

and in "micro.py" ( mikro_softwareid_decode() function ) SOFTWARE_ID_CHARACTER_TABLE = b'TN0BYX18S5HZ4IA67DGF3LPCJQRUK9MW2VE' must be --->

SOFTWARE_ID_CHARACTER_TABLE = ???????????????????? <- This varible for chr is the trick and we need to found it.

(elsif = chyvalrys = zyb) apparently they are the same person... He decode it ( Revert ingeniering chr character table ) we mus be capable to do too...

photo_2024-08-26_23-34-31

@vnxme
Copy link
Contributor

vnxme commented Dec 18, 2024

if you see that source code. RouterOS Lisecnse Key XXXX-XXXX has 6bit, and "little" is true....

chr lisense could be 3bit and "little" is false .. (See attchment)

then maybe lic = software_id.to_bytes(6, 'little') ---> lic = software_id.to_bytes(3, ???) ???=big?

No, 6 and 3 have nothing to do with the number of bytes a software ID can take in the license payload. These numbers indicate a license level. For CHR, the third level corresponds to the P-Unlimited.

@israelrmm
Copy link

if you see that source code. RouterOS Lisecnse Key XXXX-XXXX has 6bit, and "little" is true....
chr lisense could be 3bit and "little" is false .. (See attchment)
then maybe lic = software_id.to_bytes(6, 'little') ---> lic = software_id.to_bytes(3, ???) ???=big?

No, 6 and 3 have nothing to do with the number of bytes a software ID can take in the license payload. These numbers indicate a license level. For CHR, the third level corresponds to the P-Unlimited.

Ok. i understand. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants