Implements #88, documents adjust, uniformed default values

This commit is contained in:
Matteo ℱan 2020-09-03 23:52:59 +02:00
parent 27aa94a6e4
commit 33cedce48c
No known key found for this signature in database
GPG key ID: 3C30A05BC133D9B6
14 changed files with 144 additions and 142 deletions

View file

@ -1,5 +1,5 @@
# Documentation
What follows are some detailed explanations how some parts work.
What follows are some detailed explanations how the KMS infrastructure works.
## Understanding Key Management Service
KMS activates Microsoft products on a local network, eliminating the need for individual computers to connect to Microsoft. To do this, KMS uses a clientserver topology. A KMS client locates a KMS server by using DNS or a static
@ -324,7 +324,7 @@ Where command line options are:
</tbody>
</table>
## Further references
## Further References
* <sup>[1]</sup> https://forums.mydigitallife.net/threads/emulated-kms-servers-on-non-windows-platforms.50234
* <sup>[2]</sup> https://forums.mydigitallife.net/threads/discussion-microsoft-office-2019.75232
* <sup>[3]</sup> https://forums.mydigitallife.net/threads/miscellaneous-kms-related-developments.52594

View file

@ -1,10 +1,9 @@
# Getting Started
What follows are some guides how to start the `pykms_Server.py` script, which provides the server.
What follows are some guides how to start the `pykms_Server.py` script, which provides the emulated server.
## Running as a service
***
You can simply manage a daemon that runs as a background process. This can be achieved by using any of the guides below or by writing your own solution.
You can simply manage a daemon that runs as a background process. This can be achieved by using any of the notes below or by writing your own solution.
### Docker
![docker-auto](https://img.shields.io/docker/cloud/automated/pykmsorg/py-kms)
@ -12,19 +11,20 @@ You can simply manage a daemon that runs as a background process. This can be ac
![docker-pulls](https://img.shields.io/docker/pulls/pykmsorg/py-kms)
![docker-size](https://img.shields.io/docker/image-size/pykmsorg/py-kms)
If you wish to get _py-kms_ just up and running without installing any dependencies or writing own scripts: Just use Docker! Docker also solves problems regarding the explicit IPv4 and IPv6 usage: It just supports both. The following
If you wish to get _py-kms_ just up and running without installing any dependencies or writing own scripts: Just use Docker !
Docker also solves problems regarding the explicit IPv4 and IPv6 usage (it just supports both). The following
command will download, "install" and start _py-kms_ and also keep it alive after any service disruption.
```bash
docker run -d --name py-kms --restart always -p 1688:1688 pykmsorg/py-kms
```
There are currently three tags of the image available (select one just by appending `:<tag>` to the image from above):
* `latest`, currently the same like minimal...
* `minimal`, wich is based on the python3 minimal configuration of py-kms. _This tag does NOT include `sqlite` support!_
* `latest`, currently the same like `minimal`.
* `minimal`, which is based on the python3 minimal configuration of py-kms. _This tag does NOT include `sqlite` support !_
* `python3`, which is fully configurable and equipped with `sqlite` support and a web interface for management.
If you just want to use the image and don't want to build them yourself, you can always use the official image at the [Docker Hub](https://hub.docker.com/r/pykmsorg/py-kms) (`pykmsorg/py-kms`). To ensure that you are using always the
latest version you should check something like [watchtower](https://github.com/containrrr/watchtower) out!
latest version you should check something like [watchtower](https://github.com/containrrr/watchtower) out !
### Systemd
If you are running a Linux distro using `systemd`, create the file: `sudo nano /etc/systemd/system/py3-kms.service`, then add the following (change it where needed) and save:
@ -114,14 +114,19 @@ if __name__ == '__main__':
Now in a command prompt type `C:\Windows\Python27\python.exe kms-winservice.py install` to install the service. Display all the services with `services.msc` and find the service associated with _py-kms_, change the startup type
from `manual` to `auto`. Finally `Start` the service. If this approach fails, you can try to use [Non-Sucking Service Manager](https://nssm.cc/) or Task Scheduler as described [here](https://blogs.esri.com/esri/arcgis/2013/07/30/scheduling-a-scrip/).
## Manual execution
### Other Platforms
They might be useful to you:
- [FreeNAS](https://github.com/SystemRage/py-kms/issues/56)
- [FreeBSD](https://github.com/SystemRage/py-kms/issues/89)
## Manual Execution
***
### Dependencies
- Python 3.x.
- Tkinter module (for the GUI).
- If the `tzlocal` module is installed, the "Request Time" in the verbose output will be converted into local time. Otherwise, it will be in UTC.
- It can use the `sqlite3` module so you can use the database function, storing activation data so it can be recalled again.
- It can use the `sqlite3` module, storing activation data in a database so it can be recalled again.
- Installation example on Ubuntu / Mint:
- `sudo apt-get update`
- `sudo apt-get install python3-tk python3-pip`
@ -146,7 +151,7 @@ user@host ~ $ ip addr
inet6 ****::****:****:****:****/64 scope link noprefixroute
valid_lft forever preferred_lft forever
```
In the example above is `192.168.1.102` the ip we want to listen on, so it is this command (**note you can omit the ip AND port specification if you just wish to listen on all interfaces**):
In the example above is `192.168.1.102` the ip we want to listen on, so it is this command (**note you can omit the ip AND port specification if you just wish to listen on all interfaces with port 1688**):
```
user@host ~/path/to/folder/py-kms $ python3 pykms_Server.py 192.168.1.102 1688
@ -155,8 +160,8 @@ user@host ~/path/to/folder/py-kms $ python3 pykms_Server.py 192.168.1.102 1688
To stop `pykms_Server.py`, in the same bash window where code running, simply press `CTRL+C`.
Alternatively, in a new bash window, use `kill <pid>` command (you can type `ps aux` first and have the process <pid>) or `killall <name_of_server>`.
#### Notes
The following are just some quick notes - for a more detailed list of parameters see [here](Usage.md).
### Quick Guide
The following are just some brief notes about parameters handling. For a more detailed description see [here](Usage.md).
- To generate a random HWID use `-w` option: `python3 pykms_Server.py -w RANDOM`.
- To get the HWID from any server use the client, for example type: `python3 pykms_Client.py :: 1688 -m Windows8.1 -V INFO`.

View file

@ -54,7 +54,8 @@ e.g. because it could not reach the server. The default is 120 minutes (2 hours)
> Instructs clients to renew activation every _RENEWALINTERVAL_ minutes. The default is 10080 minutes (7 days).
-s or --sqlite
> Use this option to store request information from unique clients in an SQLite database.
> Use this option to store request information from unique clients in an SQLite database. Deactivated by default.
If enabled the default database file is _pykms_database.db_. You can also provide a specific location.
-t0 or --timeout-idle <TIMEOUT>
> Maximum inactivity time (in seconds) after which the connection with the client is closed.
@ -63,7 +64,7 @@ Default setting is serve forever (no timeout).
-y or --async-msg
> With high levels of logging (e.g hundreds of log statements), in a traditional synchronous log model,
the overhead involved becomes more expensive, so using this option you enable printing (pretty / logging) messages
asynchronously reducing time-consuming. Desactivated by default.
asynchronously reducing time-consuming. Deactivated by default.
-V or --loglevel <{CRITICAL, ERROR, WARNING, INFO, DEBUG, MINI}>
> Use this flag to set a logging loglevel. The default is _ERROR_.
@ -81,7 +82,7 @@ Mon, 12 Jun 2017 22:09:00 INFO HWID: 364F463A8863D35F
> Creates a _LOGFILE.log_ logging file. The default is named _pykms_logserver.log_.
example:
```
user@user ~/path/to/folder/py-kms $ python3 pykms_Server.py 192.168.1.102 8080 -F ~/path/to/folder/py-kms/newlogfile.log -V INFO -w RANDOM
user@host ~/path/to/folder/py-kms $ python3 pykms_Server.py 192.168.1.102 8080 -F ~/path/to/folder/py-kms/newlogfile.log -V INFO -w RANDOM
```
creates _newlogfile.log_ with these initial messages:
```
@ -134,7 +135,7 @@ You can also enable other suboptions of `-F` doing what is reported in the follo
</table>
-S or --logsize <MAXSIZE>
> Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.
> Use this flag to set a maximum size (in MB) to the output log file. Deactivated by default.
### pykms_Client.py
If _py-kms_ server doesn't works correctly, you can test it with the KMS client `pykms_Client.py`, running on the same machine where you started `pykms_Server.py`.
@ -142,7 +143,7 @@ If _py-kms_ server doesn't works correctly, you can test it with the KMS client
For example (in separated bash windows) run these commands:
```
user@host ~/path/to/folder/py-kms $ python3 pykms_Server.py -V DEBUG
user@host ~/path/to/folder/py-kms $ python3 pykms_Client.py 0.0.0.0 1688 -V DEBUG
user@host ~/path/to/folder/py-kms $ python3 pykms_Client.py -V DEBUG
```
Or if you want better specify:
@ -176,7 +177,7 @@ activate regardless of CMID being unique for a subset of specific machines or no
> Use this flag to manually specify an ASCII _MACHINENAME_ to use. If no _MACHINENAME_ is specified a random one will be generated.
-y or --async-msg
> Prints pretty / logging messages asynchronously. Desactivated by default.
> Prints pretty / logging messages asynchronously. Deactivated by default.
-V or --loglevel <{CRITICAL, ERROR, WARNING, INFO, DEBUG, MINI}>
> Use this flag to set a logging loglevel. The default is _ERROR_.
@ -186,11 +187,10 @@ activate regardless of CMID being unique for a subset of specific machines or no
You can enable same _pykms_Server.py_ suboptions of `-F`.
-S or --logsize <MAXSIZE>
> Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.
> Use this flag to set a maximum size (in MB) to the output log file. Deactivated by default.
## Activation Procedure
Briefly the product asks for a key during installation, so it needs you to enter the GVLK. Then the user can set connection parameters, while KMS server must already be running on server machine. Finally with specific
commands activation occurs automatically and can be extended later every time for another 180 (or 30 or 45) days.
The product asks for a key during installation, so it needs you to enter the GVLK. Then the user can set connection parameters, while KMS server must already be running on server machine. Finally with specific commands, activation occurs automatically and can be extended later every time for another 180 (or 30 or 45) days.
### Windows
***
@ -203,7 +203,7 @@ The `//nologo` option of `cscript` was used only to hide the startup logo.
0. Run a Command Prompt as Administrator (you are directly in `C:\Windows\System32` path).
1. This is optional, it's for unistalling any existing product key.
2. Then put in your product's GVLK.
3. Set connection parameters...
3. Set connection parameters.
4. Try online activation, but... if that fails with error `0xC004F074` youll most likely have to configure your firewall that it accepts incoming connections on TCP port 1688. So for Linux users (server-side with `pykms_Server.py`
running): `sudo ufw allow 1688` (to remove this rule `sudo ufw delete allow 1688`)
5. Attempt online activation (now with traffic on 1688 enabled).