SystemRage / py-kms

KMS Server Emulator written in Python
The Unlicense
2.04k stars 618 forks source link

Confused about some of the defaults #131

Closed WinkelCode closed 3 years ago

WinkelCode commented 3 years ago

According to the readthedocs page: The HWID is by default a hardcoded value, is there a reason for doing this when it could just be randomly generated by default, like the ePID?

Also, why is --client-count "None" by default, shouldn't it be some higher value as in the description of the parameter?

I did some googling but was unable to find further details, I'd really appreciate some clarification about the reasoning/effects of these options.

simonmicro commented 3 years ago

Okay, according to https://github.com/SystemRage/py-kms/blob/a3b0c85b5b90f63b33dfa5ae6085fcd52c6da2ff/py-kms/pykms_Server.py#L203 the default HWID is actually hard coded. Tbh I have also no idea why it was implemented that way. If I recall correctly the Docker setup also uses a hard coded value... @SystemRage why do we do this?

Regarding the client count... Maybe somewhere else in the code...

I'll update the docs when someone could explain this (and this person will not update the docs by herself)...

WinkelCode commented 3 years ago

I just looked into the code again and found this part that seems to explain what happens with the clientcount: https://github.com/SystemRage/py-kms/blob/5ffcbb8606c20fab4ffeda88dcc61c612a0e01f3/py-kms/pykms_Base.py#L158

Looks like "none" actually means (according to the comment) 10 clients for Server versions and 50 for Desktop versions (or, 2x the minimum activation count).

Still wondering about the HWID though, is it at any point transmitted to the client or is that just the ePID (which is randomized by default)?

SystemRage commented 3 years ago

The initial versions of py-kms had a "randomHWID.py", then fork-by-fork this small code was introduced directly in "server.py". Its use was intended to help the user to create the HWID string (and now with -w option), but just for once, so you have to always reuse the same value. Technically you should put real values for HWID and EPID, which come from a real KMS server, otherwise your emulated server doesn't acts as much as possible as a real one.

In a local context doesn't seem to affect clients activations (maybe when updating, some KB package can reveal that a client was activated by a not original server ??? I think not, but i don't know.). Instead if you want to make public your KMS server you have some more problems, since can be marked by M$ as not genuine and stopped/banned. So random HWID and EPID generation are not the best (but they are the original algorithms so as long as they work... i left them untouched). See for details "vlmcsd" -r0, -r1, -r2 options. Could be added something similar for py-kms. Other info: https://forums.mydigitallife.net/threads/a-couple-questions-regarding-the-various-kms-tools.51662/

simonmicro commented 3 years ago

Thanks for the explanation - in combination with the notes in the docs, I've now got a pretty clear picture of how it works! :+1: