mirror of https://github.com/SystemRage/py-kms.git
Merge branch 'master' into dont-log-to-script-dir
This commit is contained in:
commit
da943729a6
|
@ -1,3 +1,10 @@
|
||||||
|
### py-kms_2020-07-01
|
||||||
|
- py-kms Gui: now matches all cli options, added modes onlyserver / onlyclient,
|
||||||
|
added some animations.
|
||||||
|
- Added suboptions FILEOFF and STDOUTOFF of -F.
|
||||||
|
- Created option for asynchronous messages.
|
||||||
|
- Cleaned options parsing process.
|
||||||
|
|
||||||
### py-kms_2020-02-02
|
### py-kms_2020-02-02
|
||||||
- Optimized pretty-print messages process.
|
- Optimized pretty-print messages process.
|
||||||
- Added -F FILESTDOUT option.
|
- Added -F FILESTDOUT option.
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Matteo ℱan
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
20
README.md
20
README.md
|
@ -8,7 +8,8 @@ _py-kms_ is a port of node-kms created by [cyrozap](http://forums.mydigitallife.
|
||||||
- Windows 7
|
- Windows 7
|
||||||
- Windows 8
|
- Windows 8
|
||||||
- Windows 8.1
|
- Windows 8.1
|
||||||
- Windows 10 ( 1511 / 1607 / 1703 / 1709 / 1803 / 1809 / 1903 / 1909 )
|
- Windows 10 ( 1511 / 1607 / 1703 / 1709 / 1803 / 1809 )
|
||||||
|
- Windows 10 ( 1903 / 1909 / 20H1 )
|
||||||
- Windows Server 2008
|
- Windows Server 2008
|
||||||
- Windows Server 2008 R2
|
- Windows Server 2008 R2
|
||||||
- Windows Server 2012
|
- Windows Server 2012
|
||||||
|
@ -44,20 +45,26 @@ _py-kms_ is a port of node-kms created by [cyrozap](http://forums.mydigitallife.
|
||||||
- To show the help pages type: `python pykms_Server.py -h` and `python pykms_Client.py -h`.
|
- To show the help pages type: `python pykms_Server.py -h` and `python pykms_Client.py -h`.
|
||||||
- To generate a random HWID use `-w` option: `python pykms_Server.py -w RANDOM`.
|
- To generate a random HWID use `-w` option: `python pykms_Server.py -w RANDOM`.
|
||||||
- To get the HWID from any server use the client, for example type: `python pykms_Client.py 0.0.0.0 1688 -m Windows8.1 -V INFO`.
|
- To get the HWID from any server use the client, for example type: `python pykms_Client.py 0.0.0.0 1688 -m Windows8.1 -V INFO`.
|
||||||
|
|
||||||
|
- To change your logfile path use `-F` option, for example: `python pykms_Server.py -F /path/to/your/logfile.log -V DEBUG`.
|
||||||
- To view a minimal set of logging information use `-V MINI` option, for example: `python pykms_Server.py -F /path/to/your/logfile.log -V MINI`.
|
- To view a minimal set of logging information use `-V MINI` option, for example: `python pykms_Server.py -F /path/to/your/logfile.log -V MINI`.
|
||||||
- To redirect logging on stdout use `-F STDOUT` option, for example: `python pykms_Server.py -F STDOUT -V DEBUG`.
|
- To redirect logging on stdout use `-F STDOUT` option, for example: `python pykms_Server.py -F STDOUT -V DEBUG`.
|
||||||
- You can create logfile and view logging information on stdout at the same time with `-F FILESTDOUT` option, for example: `python pykms_Server.py -F FILESTDOUT /path/to/your/logfile.log -V DEBUG`.
|
- You can create logfile and view logging information on stdout at the same time with `-F FILESTDOUT` option, for example: `python pykms_Server.py -F FILESTDOUT /path/to/your/logfile.log -V DEBUG`.
|
||||||
- Select timeout (seconds) for py-kms with `-t` option, for example `python pykms_Server.py -t 10`
|
- With `-F STDOUTOFF` you disable all stdout messages (but a logfile will be created), for example: `python pykms_Server.py -F STDOUTOFF /path/to/your/logfile.log -V DEBUG`.
|
||||||
|
- With `-F FILEOFF` you disable logfile creation.
|
||||||
|
|
||||||
|
- Select timeout (seconds) for py-kms with `-t0` option, for example `python pykms_Server.py -t0 10`.
|
||||||
|
- Option `-y` enables printing asynchronously of messages (pretty / logging).
|
||||||
- For launching py-kms GUI make executable `pykms_Server.py` file with `chmod +x /path/to/folder/py-kms/pykms_Server.py`, then simply run `pykms_Server.py` double-clicking.
|
- For launching py-kms GUI make executable `pykms_Server.py` file with `chmod +x /path/to/folder/py-kms/pykms_Server.py`, then simply run `pykms_Server.py` double-clicking.
|
||||||
- You can run py-kms deamonized (via [Etrigan](https://github.com/SystemRage/Etrigan)) using a command like: `python pykms_Server.py etrigan start` and stop it with: `python pykms_Server.py etrigan stop`.
|
- You can run py-kms daemonized (via [Etrigan](https://github.com/SystemRage/Etrigan)) using a command like: `python pykms_Server.py etrigan start` and stop it with: `python pykms_Server.py etrigan stop`.
|
||||||
- With Etrigan you have another way to launch py-kms GUI (specially suitable if you're using a virtualenv), so: `python pykms_Server.py etrigan start -g`
|
- With Etrigan you have another way to launch py-kms GUI (specially suitable if you're using a virtualenv), so: `python pykms_Server.py etrigan start -g`
|
||||||
and stop the GUI with the same precedent command (or interact with EXIT button).
|
and stop the GUI with `python pykms_Server.py etrigan stop` (or interact with the EXIT button).
|
||||||
|
|
||||||
# Docker
|
# Docker
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
This projects has docker image support. You can find all available image configurations inside the docker folder.
|
This project has docker image support. You can find all available image configurations inside the docker folder.
|
||||||
There are three tags of the images available:
|
There are three tags of the images available:
|
||||||
* `latest`, currently the same like minimal...
|
* `latest`, currently the same like minimal...
|
||||||
* `minimal`, wich is based on the python3 minimal configuration of py-kms. _This image does NOT include SQLLite support!_
|
* `minimal`, wich is based on the python3 minimal configuration of py-kms. _This image does NOT include SQLLite support!_
|
||||||
|
@ -70,4 +77,5 @@ To ensure that the image is always up-to-date you should check [watchtower](http
|
||||||
Consult the [Wiki](https://github.com/SystemRage/py-kms/wiki) for more information about activation with _py-kms_ and to get GVLK keys.
|
Consult the [Wiki](https://github.com/SystemRage/py-kms/wiki) for more information about activation with _py-kms_ and to get GVLK keys.
|
||||||
|
|
||||||
# License
|
# License
|
||||||
[](https://github.com/SystemRage/py-kms/blob/master/LICENSE)
|
_py-kms_ is [](https://github.com/SystemRage/py-kms/blob/master/LICENSE)
|
||||||
|
_py-kms GUI_ is [](https://github.com/SystemRage/py-kms/blob/master/LICENSE.gui.md) © Matteo ℱan
|
||||||
|
|
|
@ -15,7 +15,7 @@ docker run -it -d --name py3-kms \
|
||||||
--restart unless-stopped pykmsorg/py-kms:[TAG]
|
--restart unless-stopped pykmsorg/py-kms:[TAG]
|
||||||
```
|
```
|
||||||
_Make sure to insert at `[TAG]` your wanted edition! The default is `latest`, which does not include SQLLite support. For all available tag check [this](https://hub.docker.com/r/pykmsorg/py-kms/tags) out._
|
_Make sure to insert at `[TAG]` your wanted edition! The default is `latest`, which does not include SQLLite support. For all available tag check [this](https://hub.docker.com/r/pykmsorg/py-kms/tags) out._
|
||||||
Please note you can omit the `SQLITE` option if you plan to use the minimal ot `latest` image
|
Therefore you can omit the `-e SQLITE=...` and `-p 8080:8080` option if you plan to use the `minimal` or `latest` image.
|
||||||
|
|
||||||
# Sqlite-web
|
# Sqlite-web
|
||||||
A web-based SQLite database browser written in Python.
|
A web-based SQLite database browser written in Python.
|
||||||
|
|
|
@ -592,8 +592,8 @@ def main():
|
||||||
parser = Etrigan_parser()
|
parser = Etrigan_parser()
|
||||||
args = vars(parser.parse_args())
|
args = vars(parser.parse_args())
|
||||||
# Check arguments.
|
# Check arguments.
|
||||||
Etrigan_check().checkfile(args['etriganpid'], 'pidfile', '.pid')
|
Etrigan_check().checkfile(args['etriganpid'], '--etrigan-pid', '.pid')
|
||||||
Etrigan_check().checkfile(args['etriganlog'], 'pidfile', '.log')
|
Etrigan_check().checkfile(args['etriganlog'], '--etrigan-log', '.log')
|
||||||
|
|
||||||
# Setup daemon.
|
# Setup daemon.
|
||||||
jasonblood_1 = Etrigan(pidfile = args['etriganpid'], logfile = args['etriganlog'], loglevel = args['etriganlev'],
|
jasonblood_1 = Etrigan(pidfile = args['etriganpid'], logfile = args['etriganlog'], loglevel = args['etriganlev'],
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 524 KiB After Width: | Height: | Size: 524 KiB |
|
@ -140,21 +140,21 @@ class kmsBase:
|
||||||
# https://docs.microsoft.com/en-us/windows/deployment/volume-activation/activate-windows-10-clients-vamt
|
# https://docs.microsoft.com/en-us/windows/deployment/volume-activation/activate-windows-10-clients-vamt
|
||||||
MinClients = kmsRequest['requiredClientCount']
|
MinClients = kmsRequest['requiredClientCount']
|
||||||
RequiredClients = MinClients * 2
|
RequiredClients = MinClients * 2
|
||||||
if self.srv_config["CurrentClientCount"] != None:
|
if self.srv_config["clientcount"] != None:
|
||||||
if 0 < self.srv_config["CurrentClientCount"] < MinClients:
|
if 0 < self.srv_config["clientcount"] < MinClients:
|
||||||
# fixed to 6 (product server) or 26 (product desktop)
|
# fixed to 6 (product server) or 26 (product desktop)
|
||||||
currentClientCount = MinClients + 1
|
currentClientCount = MinClients + 1
|
||||||
pretty_printer(log_obj = loggersrv.warning,
|
pretty_printer(log_obj = loggersrv.warning,
|
||||||
put_text = "{reverse}{yellow}{bold}Not enough clients ! Fixed with %s, but activated client \
|
put_text = "{reverse}{yellow}{bold}Not enough clients ! Fixed with %s, but activated client \
|
||||||
could be detected as not genuine !{end}" %currentClientCount)
|
could be detected as not genuine !{end}" %currentClientCount)
|
||||||
elif MinClients <= self.srv_config["CurrentClientCount"] < RequiredClients:
|
elif MinClients <= self.srv_config["clientcount"] < RequiredClients:
|
||||||
currentClientCount = self.srv_config["CurrentClientCount"]
|
currentClientCount = self.srv_config["clientcount"]
|
||||||
pretty_printer(log_obj = loggersrv.warning,
|
pretty_printer(log_obj = loggersrv.warning,
|
||||||
put_text = "{reverse}{yellow}{bold}With count = %s, activated client could be detected as not genuine !{end}" %currentClientCount)
|
put_text = "{reverse}{yellow}{bold}With count = %s, activated client could be detected as not genuine !{end}" %currentClientCount)
|
||||||
elif self.srv_config["CurrentClientCount"] >= RequiredClients:
|
elif self.srv_config["clientcount"] >= RequiredClients:
|
||||||
# fixed to 10 (product server) or 50 (product desktop)
|
# fixed to 10 (product server) or 50 (product desktop)
|
||||||
currentClientCount = RequiredClients
|
currentClientCount = RequiredClients
|
||||||
if self.srv_config["CurrentClientCount"] > RequiredClients:
|
if self.srv_config["clientcount"] > RequiredClients:
|
||||||
pretty_printer(log_obj = loggersrv.warning,
|
pretty_printer(log_obj = loggersrv.warning,
|
||||||
put_text = "{reverse}{yellow}{bold}Too many clients ! Fixed with %s{end}" %currentClientCount)
|
put_text = "{reverse}{yellow}{bold}Too many clients ! Fixed with %s{end}" %currentClientCount)
|
||||||
else:
|
else:
|
||||||
|
@ -230,8 +230,8 @@ could be detected as not genuine !{end}" %currentClientCount)
|
||||||
# rule: timeserver - 4h <= timeclient <= timeserver + 4h, check if is satisfied.
|
# rule: timeserver - 4h <= timeclient <= timeserver + 4h, check if is satisfied.
|
||||||
response['responseTime'] = kmsRequest['requestTime']
|
response['responseTime'] = kmsRequest['requestTime']
|
||||||
response['currentClientCount'] = currentClientCount
|
response['currentClientCount'] = currentClientCount
|
||||||
response['vLActivationInterval'] = self.srv_config["VLActivationInterval"]
|
response['vLActivationInterval'] = self.srv_config["activation"]
|
||||||
response['vLRenewalInterval'] = self.srv_config["VLRenewalInterval"]
|
response['vLRenewalInterval'] = self.srv_config["renewal"]
|
||||||
|
|
||||||
if self.srv_config['sqlite'] and self.srv_config['dbSupport']:
|
if self.srv_config['sqlite'] and self.srv_config['dbSupport']:
|
||||||
response = sql_update_epid(self.dbName, kmsRequest, response)
|
response = sql_update_epid(self.dbName, kmsRequest, response)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import binascii
|
import binascii
|
||||||
|
@ -21,11 +22,12 @@ from pykms_RequestV5 import kmsRequestV5
|
||||||
from pykms_RequestV6 import kmsRequestV6
|
from pykms_RequestV6 import kmsRequestV6
|
||||||
from pykms_RpcBase import rpcBase
|
from pykms_RpcBase import rpcBase
|
||||||
from pykms_DB2Dict import kmsDB2Dict
|
from pykms_DB2Dict import kmsDB2Dict
|
||||||
from pykms_Misc import logger_create, check_logfile
|
from pykms_Misc import check_setup
|
||||||
from pykms_Misc import KmsParser, KmsException, KmsHelper
|
from pykms_Misc import KmsParser, KmsParserException, KmsParserHelp
|
||||||
from pykms_Format import justify, byterize, enco, deco, ShellMessage, pretty_printer
|
from pykms_Misc import kms_parser_get, kms_parser_check_optionals, kms_parser_check_positionals
|
||||||
|
from pykms_Format import justify, byterize, enco, deco, pretty_printer
|
||||||
|
|
||||||
clt_version = "py-kms_2020-02-02"
|
clt_version = "py-kms_2020-07-01"
|
||||||
__license__ = "The Unlicense"
|
__license__ = "The Unlicense"
|
||||||
__author__ = u"Matteo ℱan <SystemRage@protonmail.com>"
|
__author__ = u"Matteo ℱan <SystemRage@protonmail.com>"
|
||||||
__url__ = "https://github.com/SystemRage/py-kms"
|
__url__ = "https://github.com/SystemRage/py-kms"
|
||||||
|
@ -55,8 +57,10 @@ clt_options = {
|
||||||
'choi' : ["WindowsVista","Windows7","Windows8","Windows8.1","Windows10","Office2010","Office2013","Office2016","Office2019"]},
|
'choi' : ["WindowsVista","Windows7","Windows8","Windows8.1","Windows10","Office2010","Office2013","Office2016","Office2019"]},
|
||||||
'cmid' : {'help' : 'Use this flag to manually specify a CMID to use. If no CMID is specified, a random CMID will be generated.',
|
'cmid' : {'help' : 'Use this flag to manually specify a CMID to use. If no CMID is specified, a random CMID will be generated.',
|
||||||
'def' : None, 'des' : "cmid"},
|
'def' : None, 'des' : "cmid"},
|
||||||
'name' : {'help' : 'Use this flag to manually specify an ASCII machineName to use. If no machineName is specified a random machineName \
|
'name' : {'help' : 'Use this flag to manually specify an ASCII machine name to use. If no machine name is specified a random one \
|
||||||
will be generated.', 'def' : None, 'des' : "machineName"},
|
will be generated.', 'def' : None, 'des' : "machine"},
|
||||||
|
'asyncmsg' : {'help' : 'Prints pretty / logging messages asynchronously. Desactivated by default.',
|
||||||
|
'def' : False, 'des' : "asyncmsg"},
|
||||||
'llevel' : {'help' : 'Use this option to set a log level. The default is \"ERROR\".', 'def' : "ERROR", 'des' : "loglevel",
|
'llevel' : {'help' : 'Use this option to set a log level. The default is \"ERROR\".', 'def' : "ERROR", 'des' : "loglevel",
|
||||||
'choi' : ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "MINI"]},
|
'choi' : ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "MINI"]},
|
||||||
'lfile' : {'help' : 'Use this option to set an output log file. The default is \"pykms_logclient.log\". Type \"STDOUT\" to view \
|
'lfile' : {'help' : 'Use this option to set an output log file. The default is \"pykms_logclient.log\". Type \"STDOUT\" to view \
|
||||||
|
@ -66,10 +70,7 @@ log info on stdout. Type \"FILESTDOUT\" to combine previous actions.',
|
||||||
}
|
}
|
||||||
|
|
||||||
def client_options():
|
def client_options():
|
||||||
try:
|
client_parser = KmsParser(description = clt_description, epilog = 'version: ' + clt_version, add_help = False)
|
||||||
client_parser = KmsParser(description = clt_description, epilog = 'version: ' + clt_version, add_help = False, allow_abbrew = False)
|
|
||||||
except TypeError:
|
|
||||||
client_parser = KmsParser(description = clt_description, epilog = 'version: ' + clt_version, add_help = False)
|
|
||||||
client_parser.add_argument("ip", nargs = "?", action = "store", default = clt_options['ip']['def'],
|
client_parser.add_argument("ip", nargs = "?", action = "store", default = clt_options['ip']['def'],
|
||||||
help = clt_options['ip']['help'], type = str)
|
help = clt_options['ip']['help'], type = str)
|
||||||
client_parser.add_argument("port", nargs = "?", action = "store", default = clt_options['port']['def'],
|
client_parser.add_argument("port", nargs = "?", action = "store", default = clt_options['port']['def'],
|
||||||
|
@ -80,6 +81,8 @@ def client_options():
|
||||||
help = clt_options['cmid']['help'], type = str)
|
help = clt_options['cmid']['help'], type = str)
|
||||||
client_parser.add_argument("-n", "--name", dest = clt_options['name']['des'] , default = clt_options['name']['def'],
|
client_parser.add_argument("-n", "--name", dest = clt_options['name']['des'] , default = clt_options['name']['def'],
|
||||||
help = clt_options['name']['help'], type = str)
|
help = clt_options['name']['help'], type = str)
|
||||||
|
client_parser.add_argument("-y", "--async-msg", action = "store_true", dest = clt_options['asyncmsg']['des'],
|
||||||
|
default = clt_options['asyncmsg']['def'], help = clt_options['asyncmsg']['help'])
|
||||||
client_parser.add_argument("-V", "--loglevel", dest = clt_options['llevel']['des'], action = "store",
|
client_parser.add_argument("-V", "--loglevel", dest = clt_options['llevel']['des'], action = "store",
|
||||||
choices = clt_options['llevel']['choi'], default = clt_options['llevel']['def'],
|
choices = clt_options['llevel']['choi'], default = clt_options['llevel']['def'],
|
||||||
help = clt_options['llevel']['help'], type = str)
|
help = clt_options['llevel']['help'], type = str)
|
||||||
|
@ -87,24 +90,29 @@ def client_options():
|
||||||
default = clt_options['lfile']['def'], help = clt_options['lfile']['help'], type = str)
|
default = clt_options['lfile']['def'], help = clt_options['lfile']['help'], type = str)
|
||||||
client_parser.add_argument("-S", "--logsize", dest = clt_options['lsize']['des'], action = "store",
|
client_parser.add_argument("-S", "--logsize", dest = clt_options['lsize']['des'], action = "store",
|
||||||
default = clt_options['lsize']['def'], help = clt_options['lsize']['help'], type = float)
|
default = clt_options['lsize']['def'], help = clt_options['lsize']['help'], type = float)
|
||||||
|
|
||||||
client_parser.add_argument("-h", "--help", action = "help", help = "show this help message and exit")
|
client_parser.add_argument("-h", "--help", action = "help", help = "show this help message and exit")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "-h" in sys.argv[1:]:
|
userarg = sys.argv[1:]
|
||||||
KmsHelper().printer(parsers = [client_parser])
|
|
||||||
clt_config.update(vars(client_parser.parse_args()))
|
# Run help.
|
||||||
except KmsException as e:
|
if any(arg in ["-h", "--help"] for arg in userarg):
|
||||||
pretty_printer(put_text = "{reverse}{red}{bold}%s. Exiting...{end}" %str(e), to_exit = True)
|
KmsParserHelp().printer(parsers = [client_parser])
|
||||||
|
|
||||||
|
# Get stored arguments.
|
||||||
|
pykmsclt_zeroarg, pykmsclt_onearg = kms_parser_get(client_parser)
|
||||||
|
# Update pykms options for dict client config.
|
||||||
|
kms_parser_check_optionals(userarg, pykmsclt_zeroarg, pykmsclt_onearg, msg = 'optional py-kms client',
|
||||||
|
exclude_opt_len = ['-F', '--logfile'])
|
||||||
|
kms_parser_check_positionals(clt_config, client_parser.parse_args, msg = 'positional py-kms client')
|
||||||
|
|
||||||
|
except KmsParserException as e:
|
||||||
|
pretty_printer(put_text = "{reverse}{red}{bold}%s. Exiting...{end}" %str(e), to_exit = True, where = "clt")
|
||||||
|
|
||||||
def client_check():
|
def client_check():
|
||||||
# Check logfile.
|
# Setup and some checks.
|
||||||
clt_config['logfile'] = check_logfile(clt_config['logfile'], clt_options['lfile']['def'], where = "clt")
|
check_setup(clt_config, clt_options, loggerclt, where = "clt")
|
||||||
|
|
||||||
# Setup hidden or not messages.
|
|
||||||
ShellMessage.view = ( False if any(i in ['STDOUT', 'FILESTDOUT'] for i in clt_config['logfile']) else True )
|
|
||||||
|
|
||||||
# Create log.
|
|
||||||
logger_create(loggerclt, clt_config, mode = 'a')
|
|
||||||
|
|
||||||
# Check cmid.
|
# Check cmid.
|
||||||
if clt_config['cmid'] is not None:
|
if clt_config['cmid'] is not None:
|
||||||
|
@ -112,12 +120,22 @@ def client_check():
|
||||||
uuid.UUID(clt_config['cmid'])
|
uuid.UUID(clt_config['cmid'])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pretty_printer(log_obj = loggerclt.error, to_exit = True, where = "clt",
|
pretty_printer(log_obj = loggerclt.error, to_exit = True, where = "clt",
|
||||||
put_text = "{reverse}{red}{bold}Bad CMID. Exiting...{end}")
|
put_text = "{reverse}{red}{bold}argument `-c/--cmid`: invalid with: '%s'. Exiting...{end}" %clt_config['cmid'])
|
||||||
# Check machineName.
|
|
||||||
if clt_config['machineName'] is not None:
|
# Check machine name.
|
||||||
if len(clt_config['machineName']) < 2 or len(clt_config['machineName']) > 63:
|
if clt_config['machine'] is not None:
|
||||||
|
try:
|
||||||
|
clt_config['machine'].encode('utf-16le')
|
||||||
|
|
||||||
|
if len(clt_config['machine']) < 2:
|
||||||
|
pretty_printer(log_obj = loggerclt.error, to_exit = True, where = "clt",
|
||||||
|
put_text = "{reverse}{red}{bold}argument `-n/--name`: too short (required 2 - 63 chars). Exiting...{end}")
|
||||||
|
elif len(clt_config['machine']) > 63:
|
||||||
|
pretty_printer(log_obj = loggerclt.error, to_exit = True, where = "clt",
|
||||||
|
put_text = "{reverse}{red}{bold}argument `-n/--name`: too long (required 2 - 63 chars). Exiting...{end}")
|
||||||
|
except UnicodeEncodeError:
|
||||||
pretty_printer(log_obj = loggerclt.error, to_exit = True, where = "clt",
|
pretty_printer(log_obj = loggerclt.error, to_exit = True, where = "clt",
|
||||||
put_text = "{reverse}{red}{bold}machineName must be between 2 and 63 characters in length. Exiting...{end}")
|
put_text = "{reverse}{red}{bold}argument `-n/--name`: invalid with: '%s'. Exiting...{end}" %clt_config['machine'])
|
||||||
|
|
||||||
clt_config['call_id'] = 1
|
clt_config['call_id'] = 1
|
||||||
|
|
||||||
|
@ -148,8 +166,14 @@ def client_update():
|
||||||
|
|
||||||
def client_create():
|
def client_create():
|
||||||
loggerclt.info("Connecting to %s on port %d..." % (clt_config['ip'], clt_config['port']))
|
loggerclt.info("Connecting to %s on port %d..." % (clt_config['ip'], clt_config['port']))
|
||||||
s = socket.create_connection((clt_config['ip'], clt_config['port']))
|
try:
|
||||||
loggerclt.info("Connection successful !")
|
s = socket.create_connection((clt_config['ip'], clt_config['port']))
|
||||||
|
loggerclt.info("Connection successful !")
|
||||||
|
except (socket.gaierror, socket.error) as e:
|
||||||
|
pretty_printer(log_obj = loggerclt.error, to_exit = True, where = "clt",
|
||||||
|
put_text = "{reverse}{red}{bold}Connection failed '%s:%d': %s. Exiting...{end}" %(clt_config['ip'],
|
||||||
|
clt_config['port'],
|
||||||
|
str(e)))
|
||||||
binder = pykms_RpcBind.handler(None, clt_config)
|
binder = pykms_RpcBind.handler(None, clt_config)
|
||||||
RPC_Bind = enco(str(binder.generateRequest()), 'latin-1')
|
RPC_Bind = enco(str(binder.generateRequest()), 'latin-1')
|
||||||
|
|
||||||
|
@ -247,7 +271,7 @@ def createKmsRequestBase():
|
||||||
requestDict['previousClientMachineId'] = '\0' * 16 # I'm pretty sure this is supposed to be a null UUID.
|
requestDict['previousClientMachineId'] = '\0' * 16 # I'm pretty sure this is supposed to be a null UUID.
|
||||||
requestDict['requiredClientCount'] = clt_config['RequiredClientCount']
|
requestDict['requiredClientCount'] = clt_config['RequiredClientCount']
|
||||||
requestDict['requestTime'] = dt_to_filetime(datetime.datetime.utcnow())
|
requestDict['requestTime'] = dt_to_filetime(datetime.datetime.utcnow())
|
||||||
requestDict['machineName'] = (clt_config['machineName'] if (clt_config['machineName'] is not None) else
|
requestDict['machineName'] = (clt_config['machine'] if (clt_config['machine'] is not None) else
|
||||||
''.join(random.choice(string.ascii_letters + string.digits) for i in range(random.randint(2,63)))).encode('utf-16le')
|
''.join(random.choice(string.ascii_letters + string.digits) for i in range(random.randint(2,63)))).encode('utf-16le')
|
||||||
requestDict['mnPad'] = '\0'.encode('utf-16le') * (63 - len(requestDict['machineName'].decode('utf-16le')))
|
requestDict['mnPad'] = '\0'.encode('utf-16le') * (63 - len(requestDict['machineName'].decode('utf-16le')))
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
import logging
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Python 2.x imports
|
# Python 2.x imports
|
||||||
|
@ -16,6 +17,7 @@ except ImportError:
|
||||||
import queue as Queue
|
import queue as Queue
|
||||||
|
|
||||||
pyver = sys.version_info[:2]
|
pyver = sys.version_info[:2]
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def enco(strg, typ = 'latin-1'):
|
def enco(strg, typ = 'latin-1'):
|
||||||
|
@ -195,13 +197,15 @@ if pyver < (3, 3):
|
||||||
file = kwargs.get('file', sys.stdout)
|
file = kwargs.get('file', sys.stdout)
|
||||||
file.flush() if file is not None else sys.stdout.flush()
|
file.flush() if file is not None else sys.stdout.flush()
|
||||||
|
|
||||||
# based on: https://ryanjoneil.github.io/posts/2014-02-14-capturing-stdout-in-a-python-child-process.html,
|
# based on: https://ryanjoneil.github.io/posts/2014-02-14-capturing-stdout-in-a-python-child-process.html
|
||||||
# but not using threading/multiprocessing so:
|
queue_print = Queue.Queue()
|
||||||
# 1) message visualization order preserved.
|
|
||||||
# 2) newlines_count function output not wrong.
|
|
||||||
class ShellMessage(object):
|
class ShellMessage(object):
|
||||||
view = True
|
viewsrv, viewclt = (True for _ in range(2))
|
||||||
count, remain, numlist = (0, 0, [])
|
asyncmsgsrv, asyncmsgclt = (False for _ in range(2))
|
||||||
|
indx, count, remain, numlist = (0, 0, 0, [])
|
||||||
|
loggersrv_pty = logging.getLogger('logsrvpty')
|
||||||
|
loggerclt_pty = logging.getLogger('logcltpty')
|
||||||
|
|
||||||
class Collect(StringIO):
|
class Collect(StringIO):
|
||||||
# Capture string sent to stdout.
|
# Capture string sent to stdout.
|
||||||
|
@ -215,8 +219,9 @@ class ShellMessage(object):
|
||||||
self.put_text = put_text
|
self.put_text = put_text
|
||||||
self.where = where
|
self.where = where
|
||||||
self.plaintext = []
|
self.plaintext = []
|
||||||
self.path = os.path.dirname(os.path.abspath( __file__ )) + '/pykms_newlines.txt'
|
self.path_nl = os.path.dirname(os.path.abspath( __file__ )) + '/pykms_newlines.txt'
|
||||||
self.print_queue = Queue.Queue()
|
self.path_clean_nl = os.path.dirname(os.path.abspath( __file__ )) + '/pykms_clean_newlines.txt'
|
||||||
|
self.queue_get = Queue.Queue()
|
||||||
|
|
||||||
def formatter(self, msgtofrmt):
|
def formatter(self, msgtofrmt):
|
||||||
if self.newlines:
|
if self.newlines:
|
||||||
|
@ -236,14 +241,14 @@ class ShellMessage(object):
|
||||||
|
|
||||||
def newlines_file(self, mode, *args):
|
def newlines_file(self, mode, *args):
|
||||||
try:
|
try:
|
||||||
with open(self.path, mode) as file:
|
with open(self.path_nl, mode) as file:
|
||||||
if mode in ['w', 'a']:
|
if mode in ['w', 'a']:
|
||||||
file.write(args[0])
|
file.write(args[0])
|
||||||
elif mode == 'r':
|
elif mode == 'r':
|
||||||
data = [int(i) for i in [line.rstrip('\n') for line in file.readlines()]]
|
data = [int(i) for i in [line.rstrip('\n') for line in file.readlines()]]
|
||||||
self.newlines, ShellMessage.remain = data[0], sum(data[1:])
|
self.newlines, ShellMessage.remain = data[0], sum(data[1:])
|
||||||
except:
|
except:
|
||||||
with open(self.path, 'w') as file:
|
with open(self.path_nl, 'w') as file:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def newlines_count(self, num):
|
def newlines_count(self, num):
|
||||||
|
@ -265,40 +270,114 @@ class ShellMessage(object):
|
||||||
self.continuecount = True
|
self.continuecount = True
|
||||||
elif num in [-2 ,-4]:
|
elif num in [-2 ,-4]:
|
||||||
self.newlines_file('r')
|
self.newlines_file('r')
|
||||||
if num == 21:
|
|
||||||
ShellMessage.count, ShellMessage.remain, ShellMessage.numlist = (0, 0, [])
|
|
||||||
os.remove(self.path)
|
|
||||||
|
|
||||||
def run(self):
|
self.newlines_clean(num)
|
||||||
# view = False part.
|
|
||||||
if not ShellMessage.view:
|
def newlines_clean(self, num):
|
||||||
if self.get_text:
|
if num == 0:
|
||||||
self.newlines = 0
|
with open(self.path_clean_nl, 'w') as file:
|
||||||
if self.put_text is not None:
|
file.write('clean newlines')
|
||||||
for msg in self.put_text:
|
try:
|
||||||
self.formatter(msg)
|
with open(self.path_clean_nl, 'r') as file:
|
||||||
else:
|
some = file.read()
|
||||||
for num in self.nshell:
|
if num == 21:
|
||||||
self.formatter(MsgMap[num])
|
ShellMessage.count, ShellMessage.remain, ShellMessage.numlist = (0, 0, [])
|
||||||
return self.plaintext
|
os.remove(self.path_nl)
|
||||||
|
os.remove(self.path_clean_nl)
|
||||||
|
except:
|
||||||
|
if num == 19:
|
||||||
|
ShellMessage.count, ShellMessage.remain, ShellMessage.numlist = (0, 0, [])
|
||||||
|
os.remove(self.path_nl)
|
||||||
|
|
||||||
|
def putter(self, aqueue, toput):
|
||||||
|
try:
|
||||||
|
aqueue.put_nowait(toput)
|
||||||
|
except Queue.Full:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
self.manage()
|
||||||
|
ShellMessage.indx += 1
|
||||||
|
|
||||||
|
def print_logging_setup(self, logger, async_flag, formatter = logging.Formatter('%(name)s %(message)s')):
|
||||||
|
from pykms_GuiBase import gui_redirector
|
||||||
|
stream = gui_redirector(StringIO())
|
||||||
|
handler = logging.StreamHandler(stream)
|
||||||
|
handler.name = 'LogStream'
|
||||||
|
handler.setLevel(logging.INFO)
|
||||||
|
handler.setFormatter(formatter)
|
||||||
|
|
||||||
|
if logger.handlers:
|
||||||
|
logger.handlers = []
|
||||||
|
|
||||||
|
if async_flag:
|
||||||
|
from pykms_Misc import MultiProcessingLogHandler
|
||||||
|
logger.addHandler(MultiProcessingLogHandler('Thread-AsyncMsg{0}'.format(handler.name), handler = handler))
|
||||||
|
else:
|
||||||
|
logger.addHandler(handler)
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
|
def print_logging(self, toprint):
|
||||||
|
if (self.nshell and ((0 in self.nshell) or (2 in self.nshell and not ShellMessage.viewclt))) or ShellMessage.indx == 0:
|
||||||
|
from pykms_GuiBase import gui_redirector_setup, gui_redirector_clear
|
||||||
|
gui_redirector_setup()
|
||||||
|
gui_redirector_clear()
|
||||||
|
self.print_logging_setup(ShellMessage.loggersrv_pty, ShellMessage.asyncmsgsrv)
|
||||||
|
self.print_logging_setup(ShellMessage.loggerclt_pty, ShellMessage.asyncmsgclt)
|
||||||
|
|
||||||
|
if self.where == 'srv':
|
||||||
|
ShellMessage.loggersrv_pty.info(toprint)
|
||||||
|
elif self.where == 'clt':
|
||||||
|
ShellMessage.loggerclt_pty.info(toprint)
|
||||||
|
|
||||||
|
def notview(self):
|
||||||
|
if self.get_text:
|
||||||
|
self.newlines = 0
|
||||||
|
if self.put_text is not None:
|
||||||
|
for msg in self.put_text:
|
||||||
|
self.formatter(msg)
|
||||||
else:
|
else:
|
||||||
|
for num in self.nshell:
|
||||||
|
self.formatter(MsgMap[num])
|
||||||
|
self.putter(self.queue_get, self.plaintext)
|
||||||
|
|
||||||
|
def manage(self):
|
||||||
|
if not ShellMessage.viewsrv:
|
||||||
|
# viewsrv = False, viewclt = True.
|
||||||
|
if ShellMessage.viewclt:
|
||||||
|
if self.where == 'srv':
|
||||||
|
self.notview()
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
# viewsrv = False, viewclt = False.
|
||||||
|
self.notview()
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
# viewsrv = True, viewclt = False.
|
||||||
|
if not ShellMessage.viewclt:
|
||||||
|
if self.where == 'clt':
|
||||||
|
self.notview()
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
# viewsrv = True, viewclt = True.
|
||||||
|
pass
|
||||||
|
|
||||||
# Do job.
|
# Do job.
|
||||||
self.produce()
|
self.produce()
|
||||||
toprint = self.consume(timeout = 0.1)
|
toprint = self.consume(queue_print, timeout = 0.1)
|
||||||
# Redirect output.
|
|
||||||
if sys.stdout.isatty():
|
if sys.stdout.isatty():
|
||||||
print(toprint)
|
print(toprint, flush = True)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# Import after variables creation.
|
self.print_logging(toprint)
|
||||||
from pykms_GuiBase import gui_redirect
|
|
||||||
gui_redirect(toprint, self.where)
|
|
||||||
except:
|
except:
|
||||||
print(toprint)
|
print(toprint, flush = True)
|
||||||
|
|
||||||
# Get string/s printed.
|
# Get string/s printed.
|
||||||
if self.get_text:
|
if self.get_text:
|
||||||
return self.plaintext
|
self.putter(self.queue_get, self.plaintext)
|
||||||
|
return
|
||||||
|
|
||||||
def produce(self):
|
def produce(self):
|
||||||
# Save everything that would otherwise go to stdout.
|
# Save everything that would otherwise go to stdout.
|
||||||
|
@ -327,15 +406,12 @@ class ShellMessage(object):
|
||||||
finally:
|
finally:
|
||||||
# Restore stdout and send content.
|
# Restore stdout and send content.
|
||||||
sys.stdout = sys.__stdout__
|
sys.stdout = sys.__stdout__
|
||||||
try:
|
self.putter(queue_print, outstream.getvalue())
|
||||||
self.print_queue.put(outstream.getvalue())
|
|
||||||
except Queue.Full:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def consume(self, timeout = None):
|
def consume(self, aqueue, timeout = None):
|
||||||
try:
|
try:
|
||||||
toprint = self.print_queue.get(block = timeout is not None, timeout = timeout)
|
toprint = aqueue.get(block = timeout is not None, timeout = timeout)
|
||||||
self.print_queue.task_done()
|
aqueue.task_done()
|
||||||
return toprint
|
return toprint
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
return None
|
return None
|
||||||
|
@ -381,11 +457,13 @@ def pretty_printer(**kwargs):
|
||||||
options['get_text'] = False
|
options['get_text'] = False
|
||||||
|
|
||||||
# Process messages.
|
# Process messages.
|
||||||
plain_messages = ShellMessage.Process(options['num_text'],
|
shmsg = ShellMessage.Process(options['num_text'],
|
||||||
get_text = options['get_text'],
|
get_text = options['get_text'],
|
||||||
put_text = options['put_text'],
|
put_text = options['put_text'],
|
||||||
where = options['where']).run()
|
where = options['where'])
|
||||||
|
|
||||||
|
shmsg.execute()
|
||||||
|
plain_messages = shmsg.consume(shmsg.queue_get, timeout = None)
|
||||||
if options['log_obj']:
|
if options['log_obj']:
|
||||||
for plain_message in plain_messages:
|
for plain_message in plain_messages:
|
||||||
options['log_obj'](plain_message)
|
options['log_obj'](plain_message)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -21,12 +22,14 @@ except ImportError:
|
||||||
import tkinter.font as tkFont
|
import tkinter.font as tkFont
|
||||||
|
|
||||||
from pykms_Server import srv_options, srv_version, srv_config, server_terminate, serverqueue, serverthread
|
from pykms_Server import srv_options, srv_version, srv_config, server_terminate, serverqueue, serverthread
|
||||||
from pykms_GuiMisc import ToolTip, TextDoubleScroll, TextRedirect, custom_background
|
from pykms_GuiMisc import ToolTip, TextDoubleScroll, TextRedirect, ListboxOfRadiobuttons
|
||||||
|
from pykms_GuiMisc import custom_background, custom_pages
|
||||||
from pykms_Client import clt_options, clt_version, clt_config, client_thread
|
from pykms_Client import clt_options, clt_version, clt_config, client_thread
|
||||||
|
|
||||||
gui_version = "py-kms_gui_v2.0"
|
gui_version = "py-kms_gui_v3.0"
|
||||||
__license__ = "The Unlicense"
|
__license__ = "MIT License"
|
||||||
__author__ = u"Matteo ℱan <SystemRage@protonmail.com>"
|
__author__ = u"Matteo ℱan <SystemRage@protonmail.com>"
|
||||||
|
__copyright__ = "© Copyright 2020"
|
||||||
__url__ = "https://github.com/SystemRage/py-kms"
|
__url__ = "https://github.com/SystemRage/py-kms"
|
||||||
gui_description = "A GUI for py-kms."
|
gui_description = "A GUI for py-kms."
|
||||||
|
|
||||||
|
@ -47,34 +50,47 @@ def get_ip_address():
|
||||||
ip = 'Unknown'
|
ip = 'Unknown'
|
||||||
return ip
|
return ip
|
||||||
|
|
||||||
def gui_redirect(str_to_print, where):
|
def gui_redirector(stream, redirect_to = TextRedirect.Pretty, redirect_conditio = True, stderr_side = "srv"):
|
||||||
global txsrv, txclt, txcol
|
global txsrv, txclt, txcol
|
||||||
|
if redirect_conditio:
|
||||||
|
if stream == 'stdout':
|
||||||
|
sys.stdout = redirect_to(txsrv, txclt, txcol)
|
||||||
|
elif stream == 'stderr':
|
||||||
|
sys.stderr = redirect_to(txsrv, txclt, txcol, stderr_side)
|
||||||
|
else:
|
||||||
|
stream = redirect_to(txsrv, txclt, txcol)
|
||||||
|
return stream
|
||||||
|
|
||||||
|
def gui_redirector_setup():
|
||||||
|
TextRedirect.Pretty.tag_num = 0
|
||||||
|
TextRedirect.Pretty.newlinecut = [-1, -2, -4, -5]
|
||||||
|
|
||||||
|
def gui_redirector_clear():
|
||||||
|
global txsrv, oysrv
|
||||||
try:
|
try:
|
||||||
TextRedirect.StdoutRedirect(txsrv, txclt, txcol, str_to_print, where)
|
if oysrv:
|
||||||
|
txsrv.configure(state = 'normal')
|
||||||
|
txsrv.delete('1.0', 'end')
|
||||||
|
txsrv.configure(state = 'disabled')
|
||||||
except:
|
except:
|
||||||
print(str_to_print)
|
# self.onlysrv not defined (menu not used)
|
||||||
|
pass
|
||||||
|
|
||||||
##---------------------------------------------------------------------------------------------------------------------------------------------------------
|
##-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class KmsGui(tk.Tk):
|
class KmsGui(tk.Tk):
|
||||||
def browse(self, entrywidget, options):
|
|
||||||
path = filedialog.askdirectory()
|
|
||||||
if os.path.isdir(path):
|
|
||||||
entrywidget.delete('0', 'end')
|
|
||||||
entrywidget.insert('end', path + os.sep + os.path.basename(options['lfile']['def']))
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
tk.Tk.__init__(self, *args, **kwargs)
|
tk.Tk.__init__(self, *args, **kwargs)
|
||||||
self.wraplength = 200
|
self.wraplength = 200
|
||||||
serverthread.with_gui = True
|
serverthread.with_gui = True
|
||||||
self.validation_int = self.register(self.validate_int)
|
self.validation_int = (self.register(self.validate_int), "%S")
|
||||||
|
self.validation_float = (self.register(self.validate_float), "%P")
|
||||||
|
|
||||||
## Define fonts and colors.
|
## Define fonts and colors.
|
||||||
self.btnwinfont = tkFont.Font(family = 'Times', size = 12, weight = 'bold')
|
self.btnwinfont = tkFont.Font(family = 'Times', size = 12, weight = 'bold')
|
||||||
self.othfont = tkFont.Font(family = 'Times', size = 9, weight = 'bold')
|
self.othfont = tkFont.Font(family = 'Times', size = 9, weight = 'bold')
|
||||||
self.optfont = tkFont.Font(family = 'Helvetica', size = 11, weight = 'bold')
|
self.optfont = tkFont.Font(family = 'Helvetica', size = 11, weight = 'bold')
|
||||||
|
self.optfontredux = tkFont.Font(family = 'Helvetica', size = 9, weight = 'bold')
|
||||||
self.msgfont = tkFont.Font(family = 'Monospace', size = 6) # need a monospaced type (like courier, etc..).
|
self.msgfont = tkFont.Font(family = 'Monospace', size = 6) # need a monospaced type (like courier, etc..).
|
||||||
|
|
||||||
self.customcolors = { 'black' : '#000000',
|
self.customcolors = { 'black' : '#000000',
|
||||||
|
@ -88,40 +104,191 @@ class KmsGui(tk.Tk):
|
||||||
'cyan' : '#AFEEEE',
|
'cyan' : '#AFEEEE',
|
||||||
'lavender': '#E6E6FA',
|
'lavender': '#E6E6FA',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.option_add('*TCombobox*Listbox.font', self.optfontredux)
|
||||||
|
|
||||||
self.gui_create()
|
self.gui_create()
|
||||||
|
|
||||||
|
def browse(self, entrywidget, options):
|
||||||
|
path = filedialog.askdirectory()
|
||||||
|
if os.path.isdir(path):
|
||||||
|
entrywidget.delete('0', 'end')
|
||||||
|
entrywidget.insert('end', path + os.sep + os.path.basename(options['lfile']['def']))
|
||||||
|
|
||||||
|
def invert(self, widgets = []):
|
||||||
|
for widget in widgets:
|
||||||
|
if widget['state'] == 'normal':
|
||||||
|
widget.configure(state = 'disabled')
|
||||||
|
elif widget['state'] == 'disabled':
|
||||||
|
widget.configure(state = 'normal')
|
||||||
|
|
||||||
|
def gui_menu(self):
|
||||||
|
self.onlysrv, self.onlyclt = (False for _ in range(2))
|
||||||
|
menubar = tk.Menu(self)
|
||||||
|
prefmenu = tk.Menu(menubar, tearoff = 0, font = ("Noto Sans Regular", 10), borderwidth = 3, relief = 'ridge')
|
||||||
|
menubar.add_cascade(label = 'Preferences', menu = prefmenu)
|
||||||
|
prefmenu.add_command(label = 'Enable server-side mode', command = lambda: self.pref_onlysrv(prefmenu))
|
||||||
|
prefmenu.add_command(label = 'Enable client-side mode', command = lambda: self.pref_onlyclt(prefmenu))
|
||||||
|
self.config(menu = menubar)
|
||||||
|
|
||||||
|
def pref_onlysrv(self, menu):
|
||||||
|
global oysrv
|
||||||
|
|
||||||
|
if self.onlyclt or serverthread.is_running_server:
|
||||||
|
return
|
||||||
|
self.onlysrv = not self.onlysrv
|
||||||
|
if self.onlysrv:
|
||||||
|
menu.entryconfigure(0, label = 'Disable server-side mode')
|
||||||
|
self.clt_on_show(force_remove = True)
|
||||||
|
else:
|
||||||
|
menu.entryconfigure(0, label = 'Enable server-side mode')
|
||||||
|
self.invert(widgets = [self.shbtnclt])
|
||||||
|
oysrv = self.onlysrv
|
||||||
|
|
||||||
|
def pref_onlyclt(self, menu):
|
||||||
|
if self.onlysrv or serverthread.is_running_server:
|
||||||
|
return
|
||||||
|
self.onlyclt = not self.onlyclt
|
||||||
|
if self.onlyclt:
|
||||||
|
menu.entryconfigure(1, label = 'Disable client-side mode')
|
||||||
|
if self.shbtnclt['text'] == 'SHOW\nCLIENT':
|
||||||
|
self.clt_on_show(force_view = True)
|
||||||
|
self.optsrvwin.grid_remove()
|
||||||
|
self.msgsrvwin.grid_remove()
|
||||||
|
gui_redirector('stderr', redirect_to = TextRedirect.Stderr, stderr_side = "clt")
|
||||||
|
else:
|
||||||
|
menu.entryconfigure(1, label = 'Enable client-side mode')
|
||||||
|
self.optsrvwin.grid()
|
||||||
|
self.msgsrvwin.grid()
|
||||||
|
gui_redirector('stderr', redirect_to = TextRedirect.Stderr)
|
||||||
|
|
||||||
|
self.invert(widgets = [self.runbtnsrv, self.shbtnclt, self.runbtnclt])
|
||||||
|
|
||||||
def gui_create(self):
|
def gui_create(self):
|
||||||
## Create server gui
|
## Create server gui
|
||||||
self.gui_srv()
|
self.gui_srv()
|
||||||
## Create client gui + other operations.
|
## Create client gui + other operations.
|
||||||
self.gui_complete()
|
self.gui_complete()
|
||||||
|
## Create menu.
|
||||||
|
self.gui_menu()
|
||||||
## Create globals for printing process (redirect stdout).
|
## Create globals for printing process (redirect stdout).
|
||||||
global txsrv, txclt, txcol
|
global txsrv, txclt, txcol
|
||||||
txsrv = self.textboxsrv.get()
|
txsrv = self.textboxsrv.get()
|
||||||
txclt = self.textboxclt.get()
|
txclt = self.textboxclt.get()
|
||||||
txcol = self.customcolors
|
txcol = self.customcolors
|
||||||
## Redirect stderr.
|
## Redirect stderr.
|
||||||
sys.stderr = TextRedirect.StderrRedirect(txsrv, txclt, txcol)
|
gui_redirector('stderr', redirect_to = TextRedirect.Stderr)
|
||||||
|
|
||||||
|
def gui_pages_show(self, pagename, side):
|
||||||
|
# https://stackoverflow.com/questions/7546050/switch-between-two-frames-in-tkinter
|
||||||
|
# https://www.reddit.com/r/learnpython/comments/7xxtsy/trying_to_understand_tkinter_and_how_to_switch/
|
||||||
|
pageside = self.pagewidgets[side]
|
||||||
|
tk.Misc.lift(pageside["PageWin"][pagename], aboveThis = None)
|
||||||
|
keylist = list(pageside["PageWin"].keys())
|
||||||
|
|
||||||
|
for elem in [pageside["BtnAni"], pageside["LblAni"]]:
|
||||||
|
if pagename == "PageStart":
|
||||||
|
elem["Left"].config(state = "disabled")
|
||||||
|
if len(keylist) == 2:
|
||||||
|
elem["Right"].config(state = "normal")
|
||||||
|
elif pagename == "PageEnd":
|
||||||
|
elem["Right"].config(state = "disabled")
|
||||||
|
if len(keylist) == 2:
|
||||||
|
elem["Left"].config(state = "normal")
|
||||||
|
else:
|
||||||
|
for where in ["Left", "Right"]:
|
||||||
|
elem[where].config(state = "normal")
|
||||||
|
|
||||||
|
if pagename != "PageStart":
|
||||||
|
page_l = keylist[keylist.index(pagename) - 1]
|
||||||
|
pageside["BtnAni"]["Left"]['command'] = lambda pag=page_l, pos=side: self.gui_pages_show(pag, pos)
|
||||||
|
if pagename != "PageEnd":
|
||||||
|
page_r = keylist[keylist.index(pagename) + 1]
|
||||||
|
pageside["BtnAni"]["Right"]['command'] = lambda pag=page_r, pos=side: self.gui_pages_show(pag, pos)
|
||||||
|
|
||||||
|
def gui_pages_buttons(self, parent, side):
|
||||||
|
btnwin = tk.Canvas(parent, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
||||||
|
btnwin.grid(row = 14, column = 2, padx = 2, pady = 2, sticky = 'nsew')
|
||||||
|
btnwin.grid_columnconfigure(1, weight = 1)
|
||||||
|
self.pagewidgets[side]["BtnWin"] = btnwin
|
||||||
|
|
||||||
|
for position in ["Left", "Right"]:
|
||||||
|
if position == "Left":
|
||||||
|
col = [0, 0, 1]
|
||||||
|
stick = 'e'
|
||||||
|
elif position == "Right":
|
||||||
|
col = [2, 1, 0]
|
||||||
|
stick = 'w'
|
||||||
|
|
||||||
|
aniwin = tk.Canvas(btnwin, background = self.customcolors['white'], borderwidth = 0, relief = 'ridge')
|
||||||
|
aniwin.grid(row = 0, column = col[0], padx = 5, pady = 5, sticky = 'nsew')
|
||||||
|
self.pagewidgets[side]["AniWin"][position] = aniwin
|
||||||
|
|
||||||
|
lblani = tk.Label(aniwin, width = 1, height = 1)
|
||||||
|
lblani.grid(row = 0, column = col[1], padx = 2, pady = 2, sticky = stick)
|
||||||
|
self.pagewidgets[side]["LblAni"][position] = lblani
|
||||||
|
|
||||||
|
btnani = tk.Button(aniwin)
|
||||||
|
btnani.grid(row = 0, column = col[2], padx = 2, pady = 2, sticky = stick)
|
||||||
|
self.pagewidgets[side]["BtnAni"][position] = btnani
|
||||||
|
## Customize buttons.
|
||||||
|
custom_pages(self, side)
|
||||||
|
|
||||||
|
def gui_pages_create(self, parent, side, create = {}):
|
||||||
|
self.pagewidgets.update({side : {"PageWin" : create,
|
||||||
|
"BtnWin" : None,
|
||||||
|
"BtnAni" : {"Left" : None,
|
||||||
|
"Right" : None},
|
||||||
|
"AniWin" : {"Left" : None,
|
||||||
|
"Right" : None},
|
||||||
|
"LblAni" : {"Left" : None,
|
||||||
|
"Right" : None},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
for pagename in self.pagewidgets[side]["PageWin"].keys():
|
||||||
|
page = tk.Canvas(parent, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
||||||
|
self.pagewidgets[side]["PageWin"][pagename] = page
|
||||||
|
page.grid(row = 0, column = 2, padx = 2, pady = 2, sticky = "nsew")
|
||||||
|
page.grid_columnconfigure(1, weight = 1)
|
||||||
|
self.gui_pages_buttons(parent = parent, side = side)
|
||||||
|
self.gui_pages_show("PageStart", side = side)
|
||||||
|
|
||||||
|
def gui_store(self, side, typewidgets):
|
||||||
|
stored = []
|
||||||
|
for pagename in self.pagewidgets[side]["PageWin"].keys():
|
||||||
|
for widget in self.pagewidgets[side]["PageWin"][pagename].winfo_children():
|
||||||
|
if widget.winfo_class() in typewidgets:
|
||||||
|
stored.append(widget)
|
||||||
|
return stored
|
||||||
|
|
||||||
def gui_srv(self):
|
def gui_srv(self):
|
||||||
## Create main containers. -------------------------------------------------------------------------------------------------------------
|
## Create main containers. ------------------------------------------------------------------------------------------------------------------
|
||||||
self.masterwin = tk.Canvas(self, borderwidth = 3, relief = tk.RIDGE)
|
self.masterwin = tk.Canvas(self, borderwidth = 3, relief = tk.RIDGE)
|
||||||
self.btnsrvwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
self.btnsrvwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
||||||
self.optsrvwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
self.optsrvwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
||||||
# self.optaddsrvwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
|
||||||
self.msgsrvwin = tk.Frame(self.masterwin, background = self.customcolors['black'], relief = 'ridge', width = 300, height = 200)
|
self.msgsrvwin = tk.Frame(self.masterwin, background = self.customcolors['black'], relief = 'ridge', width = 300, height = 200)
|
||||||
|
|
||||||
## Layout main containers.
|
## Layout main containers.
|
||||||
self.masterwin.grid(row = 0, column = 0, sticky = 'nsew')
|
self.masterwin.grid(row = 0, column = 0, sticky = 'nsew')
|
||||||
self.btnsrvwin.grid(row = 0, column = 1, padx = 2, pady = 2, sticky = 'nw')
|
self.btnsrvwin.grid(row = 0, column = 1, padx = 2, pady = 2, sticky = 'nw')
|
||||||
self.optsrvwin.grid(row = 0, column = 2, padx = 2, pady = 2, sticky = 'nw')
|
self.optsrvwin.grid(row = 0, column = 2, padx = 2, pady = 2, sticky = 'nsew')
|
||||||
# self.optaddsrvwin.grid(row = 0, column = 3, padx = 2, pady = 2, sticky = 'nw')
|
self.optsrvwin.grid_rowconfigure(0, weight = 1)
|
||||||
|
self.optsrvwin.grid_columnconfigure(1, weight = 1)
|
||||||
|
|
||||||
|
self.pagewidgets = {}
|
||||||
|
|
||||||
|
## Subpages of "optsrvwin".
|
||||||
|
self.gui_pages_create(parent = self.optsrvwin, side = "Srv", create = {"PageStart": None,
|
||||||
|
"PageEnd": None})
|
||||||
|
|
||||||
|
## Continue to grid.
|
||||||
self.msgsrvwin.grid(row = 1, column = 2, padx = 1, pady = 1, sticky = 'nsew')
|
self.msgsrvwin.grid(row = 1, column = 2, padx = 1, pady = 1, sticky = 'nsew')
|
||||||
self.msgsrvwin.grid_propagate(False)
|
self.msgsrvwin.grid_propagate(False)
|
||||||
self.msgsrvwin.grid_columnconfigure(0, weight = 1)
|
self.msgsrvwin.grid_columnconfigure(0, weight = 1)
|
||||||
self.msgsrvwin.grid_rowconfigure(0, weight = 1)
|
self.msgsrvwin.grid_rowconfigure(0, weight = 1)
|
||||||
|
|
||||||
## Create widgets (btnsrvwin) -----------------------------------------------------------------------------------------------------------
|
## Create widgets (btnsrvwin) ---------------------------------------------------------------------------------------------------------------
|
||||||
self.statesrv = tk.Label(self.btnsrvwin, text = 'Server\nState:\nStopped', font = self.othfont, foreground = self.customcolors['red'])
|
self.statesrv = tk.Label(self.btnsrvwin, text = 'Server\nState:\nStopped', font = self.othfont, foreground = self.customcolors['red'])
|
||||||
self.runbtnsrv = tk.Button(self.btnsrvwin, text = 'START\nSERVER', background = self.customcolors['green'],
|
self.runbtnsrv = tk.Button(self.btnsrvwin, text = 'START\nSERVER', background = self.customcolors['green'],
|
||||||
foreground = self.customcolors['white'], relief = 'flat', font = self.btnwinfont, command = self.srv_on_start)
|
foreground = self.customcolors['white'], relief = 'flat', font = self.btnwinfont, command = self.srv_on_start)
|
||||||
|
@ -140,84 +307,96 @@ class KmsGui(tk.Tk):
|
||||||
self.clearbtnsrv.grid(row = 3, column = 0, padx = 2, pady = 2, sticky = 'ew')
|
self.clearbtnsrv.grid(row = 3, column = 0, padx = 2, pady = 2, sticky = 'ew')
|
||||||
self.exitbtnsrv.grid(row = 4, column = 0, padx = 2, pady = 2, sticky = 'ew')
|
self.exitbtnsrv.grid(row = 4, column = 0, padx = 2, pady = 2, sticky = 'ew')
|
||||||
|
|
||||||
## Create widgets (optsrvwin) ------------------------------------------------------------------------------------------------------
|
## Create widgets (optsrvwin:Srv:PageWin:PageStart) -----------------------------------------------------------------------------------------
|
||||||
# Version.
|
# Version.
|
||||||
ver = tk.Label(self.optsrvwin, text = 'You are running server version: ' + srv_version, foreground = self.customcolors['red'],
|
ver = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"],
|
||||||
|
text = 'You are running server version: ' + srv_version, foreground = self.customcolors['red'],
|
||||||
font = self.othfont)
|
font = self.othfont)
|
||||||
self.allopts_srv = []
|
|
||||||
# Ip Address.
|
# Ip Address.
|
||||||
srvipaddlbl = tk.Label(self.optsrvwin, text = 'IP Address: ', font = self.optfont)
|
srvipaddlbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'IP Address: ', font = self.optfont)
|
||||||
self.srvipadd = tk.Entry(self.optsrvwin, width = 10, font = self.optfont)
|
self.srvipadd = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont)
|
||||||
self.srvipadd.insert('end', srv_options['ip']['def'])
|
self.srvipadd.insert('end', srv_options['ip']['def'])
|
||||||
ToolTip(self.srvipadd, text = srv_options['ip']['help'], wraplength = self.wraplength)
|
ToolTip(self.srvipadd, text = srv_options['ip']['help'], wraplength = self.wraplength)
|
||||||
myipadd = tk.Label(self.optsrvwin, text = 'Your IP address is: {}'.format(get_ip_address()), foreground = self.customcolors['red'],
|
myipadd = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Your IP address is: {}'.format(get_ip_address()),
|
||||||
font = self.othfont)
|
foreground = self.customcolors['red'], font = self.othfont)
|
||||||
self.allopts_srv.append(self.srvipadd)
|
|
||||||
# Port.
|
# Port.
|
||||||
srvportlbl = tk.Label(self.optsrvwin, text = 'Port: ', font = self.optfont)
|
srvportlbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Port: ', font = self.optfont)
|
||||||
self.srvport = tk.Entry(self.optsrvwin, width = 10, font = self.optfont, validate = "key", validatecommand = (self.validation_int, "%S"))
|
self.srvport = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont, validate = "key",
|
||||||
|
validatecommand = self.validation_int)
|
||||||
self.srvport.insert('end', str(srv_options['port']['def']))
|
self.srvport.insert('end', str(srv_options['port']['def']))
|
||||||
ToolTip(self.srvport, text = srv_options['port']['help'], wraplength = self.wraplength)
|
ToolTip(self.srvport, text = srv_options['port']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.srvport)
|
|
||||||
# EPID.
|
# EPID.
|
||||||
epidlbl = tk.Label(self.optsrvwin, text = 'EPID: ', font = self.optfont)
|
epidlbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'EPID: ', font = self.optfont)
|
||||||
self.epid = tk.Entry(self.optsrvwin, width = 10, font = self.optfont)
|
self.epid = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont)
|
||||||
self.epid.insert('end', str(srv_options['epid']['def']))
|
self.epid.insert('end', str(srv_options['epid']['def']))
|
||||||
ToolTip(self.epid, text = srv_options['epid']['help'], wraplength = self.wraplength)
|
ToolTip(self.epid, text = srv_options['epid']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.epid)
|
|
||||||
# LCID.
|
# LCID.
|
||||||
lcidlbl = tk.Label(self.optsrvwin, text = 'LCID: ', font = self.optfont)
|
lcidlbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'LCID: ', font = self.optfont)
|
||||||
self.lcid = tk.Entry(self.optsrvwin, width = 10, font = self.optfont, validate = "key", validatecommand = (self.validation_int, "%S"))
|
self.lcid = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont, validate = "key",
|
||||||
|
validatecommand = self.validation_int)
|
||||||
self.lcid.insert('end', str(srv_options['lcid']['def']))
|
self.lcid.insert('end', str(srv_options['lcid']['def']))
|
||||||
ToolTip(self.lcid, text = srv_options['lcid']['help'], wraplength = self.wraplength)
|
ToolTip(self.lcid, text = srv_options['lcid']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.lcid)
|
|
||||||
# HWID.
|
# HWID.
|
||||||
hwidlbl = tk.Label(self.optsrvwin, text = 'HWID: ', font = self.optfont)
|
hwidlbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'HWID: ', font = self.optfont)
|
||||||
self.hwid = tk.Entry(self.optsrvwin, width = 10, font = self.optfont)
|
self.hwid = ttk.Combobox(self.pagewidgets["Srv"]["PageWin"]["PageStart"], values = (str(srv_options['hwid']['def']), 'RANDOM'),
|
||||||
self.hwid.insert('end', srv_options['hwid']['def'])
|
width = 17, height = 10, font = self.optfontredux)
|
||||||
|
self.hwid.set(str(srv_options['hwid']['def']))
|
||||||
ToolTip(self.hwid, text = srv_options['hwid']['help'], wraplength = self.wraplength)
|
ToolTip(self.hwid, text = srv_options['hwid']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.hwid)
|
|
||||||
# Client Count
|
# Client Count
|
||||||
countlbl = tk.Label(self.optsrvwin, text = 'Client Count: ', font = self.optfont)
|
countlbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Client Count: ', font = self.optfont)
|
||||||
self.count = tk.Entry(self.optsrvwin, width = 10, font = self.optfont)
|
self.count = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont)
|
||||||
self.count.insert('end', str(srv_options['count']['def']))
|
self.count.insert('end', str(srv_options['count']['def']))
|
||||||
ToolTip(self.count, text = srv_options['count']['help'], wraplength = self.wraplength)
|
ToolTip(self.count, text = srv_options['count']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.count)
|
|
||||||
# Activation Interval.
|
# Activation Interval.
|
||||||
activlbl = tk.Label(self.optsrvwin, text = 'Activation Interval: ', font = self.optfont)
|
activlbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Activation Interval: ', font = self.optfont)
|
||||||
self.activ = tk.Entry(self.optsrvwin, width = 10, font = self.optfont, validate = "key", validatecommand = (self.validation_int, "%S"))
|
self.activ = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont, validate = "key",
|
||||||
|
validatecommand = self.validation_int)
|
||||||
self.activ.insert('end', str(srv_options['activation']['def']))
|
self.activ.insert('end', str(srv_options['activation']['def']))
|
||||||
ToolTip(self.activ, text = srv_options['activation']['help'], wraplength = self.wraplength)
|
ToolTip(self.activ, text = srv_options['activation']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.activ)
|
|
||||||
# Renewal Interval.
|
# Renewal Interval.
|
||||||
renewlbl = tk.Label(self.optsrvwin, text = 'Activation Interval: ', font = self.optfont)
|
renewlbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Renewal Interval: ', font = self.optfont)
|
||||||
self.renew = tk.Entry(self.optsrvwin, width = 10, font = self.optfont, validate = "key", validatecommand = (self.validation_int, "%S"))
|
self.renew = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont, validate = "key",
|
||||||
|
validatecommand = self.validation_int)
|
||||||
self.renew.insert('end', str(srv_options['renewal']['def']))
|
self.renew.insert('end', str(srv_options['renewal']['def']))
|
||||||
ToolTip(self.renew, text = srv_options['renewal']['help'], wraplength = self.wraplength)
|
ToolTip(self.renew, text = srv_options['renewal']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.renew)
|
|
||||||
# Logfile.
|
# Logfile.
|
||||||
srvfilelbl = tk.Label(self.optsrvwin, text = 'Logfile Path / Name: ', font = self.optfont)
|
srvfilelbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Logfile Path / Name: ', font = self.optfont)
|
||||||
self.srvfile = tk.Entry(self.optsrvwin, width = 10, font = self.optfont)
|
self.srvfile = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont)
|
||||||
self.srvfile.insert('end', srv_options['lfile']['def'])
|
self.srvfile.insert('end', srv_options['lfile']['def'])
|
||||||
self.srvfile.xview_moveto(1)
|
self.srvfile.xview_moveto(1)
|
||||||
ToolTip(self.srvfile, text = srv_options['lfile']['help'], wraplength = self.wraplength)
|
ToolTip(self.srvfile, text = srv_options['lfile']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.srvfile)
|
srvfilebtnwin = tk.Button(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Browse',
|
||||||
filebtnwin = tk.Button(self.optsrvwin, text = 'Browse', command = lambda: self.browse(self.srvfile, srv_options))
|
command = lambda: self.browse(self.srvfile, srv_options))
|
||||||
self.allopts_srv.append(filebtnwin)
|
|
||||||
# Loglevel.
|
# Loglevel.
|
||||||
srvlevellbl = tk.Label(self.optsrvwin, text = 'Loglevel: ', font = self.optfont)
|
srvlevellbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Loglevel: ', font = self.optfont)
|
||||||
self.srvlevel = ttk.Combobox(self.optsrvwin, values = tuple(srv_options['llevel']['choi']), width = 10)
|
self.srvlevel = ttk.Combobox(self.pagewidgets["Srv"]["PageWin"]["PageStart"], values = tuple(srv_options['llevel']['choi']),
|
||||||
|
width = 10, height = 10, font = self.optfontredux, state = "readonly")
|
||||||
self.srvlevel.set(srv_options['llevel']['def'])
|
self.srvlevel.set(srv_options['llevel']['def'])
|
||||||
ToolTip(self.srvlevel, text = srv_options['llevel']['help'], wraplength = self.wraplength)
|
ToolTip(self.srvlevel, text = srv_options['llevel']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(self.srvlevel)
|
# Logsize.
|
||||||
# Sqlite database.
|
srvsizelbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Logsize: ', font = self.optfont)
|
||||||
self.chkval = tk.BooleanVar()
|
self.srvsize = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageStart"], width = 10, font = self.optfont, validate = "key",
|
||||||
self.chkval.set(srv_options['sql']['def'])
|
validatecommand = self.validation_float)
|
||||||
chksql = tk.Checkbutton(self.optsrvwin, text = 'Create Sqlite\nDatabase', font = self.optfont, var = self.chkval)
|
self.srvsize.insert('end', srv_options['lsize']['def'])
|
||||||
ToolTip(chksql, text = srv_options['sql']['help'], wraplength = self.wraplength)
|
ToolTip(self.srvsize, text = srv_options['lsize']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_srv.append(chksql)
|
# Asynchronous messages.
|
||||||
|
self.chkvalsrvasy = tk.BooleanVar()
|
||||||
|
self.chkvalsrvasy.set(srv_options['asyncmsg']['def'])
|
||||||
|
chksrvasy = tk.Checkbutton(self.pagewidgets["Srv"]["PageWin"]["PageStart"], text = 'Async\nMsg',
|
||||||
|
font = self.optfontredux, var = self.chkvalsrvasy, relief = 'groove')
|
||||||
|
ToolTip(chksrvasy, text = srv_options['asyncmsg']['help'], wraplength = self.wraplength)
|
||||||
|
|
||||||
## Layout widgets (optsrvwin)
|
# Listbox radiobuttons server.
|
||||||
|
self.chksrvfile = ListboxOfRadiobuttons(self.pagewidgets["Srv"]["PageWin"]["PageStart"],
|
||||||
|
['FILE', 'FILEOFF', 'STDOUT', 'STDOUTOFF', 'FILESTDOUT'],
|
||||||
|
self.optfontredux,
|
||||||
|
changed = [(self.srvfile, srv_options['lfile']['def']),
|
||||||
|
(srvfilebtnwin, ''),
|
||||||
|
(self.srvsize, srv_options['lsize']['def']),
|
||||||
|
(self.srvlevel, srv_options['llevel']['def'])],
|
||||||
|
width = 10, height = 1, borderwidth = 2, relief = 'ridge')
|
||||||
|
|
||||||
|
## Layout widgets (optsrvwin:Srv:PageWin:PageStart)
|
||||||
ver.grid(row = 0, column = 0, columnspan = 3, padx = 5, pady = 5, sticky = 'ew')
|
ver.grid(row = 0, column = 0, columnspan = 3, padx = 5, pady = 5, sticky = 'ew')
|
||||||
srvipaddlbl.grid(row = 1, column = 0, padx = 5, pady = 5, sticky = 'e')
|
srvipaddlbl.grid(row = 1, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
self.srvipadd.grid(row = 1, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
self.srvipadd.grid(row = 1, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
|
@ -238,44 +417,90 @@ class KmsGui(tk.Tk):
|
||||||
self.renew.grid(row = 9, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
self.renew.grid(row = 9, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
srvfilelbl.grid(row = 10, column = 0, padx = 5, pady = 5, sticky = 'e')
|
srvfilelbl.grid(row = 10, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
self.srvfile.grid(row = 10, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
self.srvfile.grid(row = 10, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
filebtnwin.grid(row = 10, column = 2, padx = 5, pady = 5, sticky = 'ew')
|
srvfilebtnwin.grid(row = 10, column = 2, padx = 5, pady = 5, sticky = 'ew')
|
||||||
srvlevellbl.grid(row = 11, column = 0, padx = 5, pady = 5, sticky = 'e')
|
self.chksrvfile.grid(row = 11, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
self.srvlevel.grid(row = 11, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
chksrvasy.grid(row = 11, column = 2, padx = 5, pady = 5, sticky = 'ew')
|
||||||
chksql.grid(row = 12, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
srvlevellbl.grid(row = 12, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
|
self.srvlevel.grid(row = 12, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
|
srvsizelbl.grid(row = 13, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
|
self.srvsize.grid(row = 13, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
|
|
||||||
## Create widgets and layout (msgsrvwin) -----------------------------------------------------------------------------------------------
|
## Create widgets (optsrvwin:Srv:PageWin:PageEnd)-------------------------------------------------------------------------------------------
|
||||||
|
# Timeout connection.
|
||||||
|
timeout0lbl = tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageEnd"], text = 'Timeout connection: ', font = self.optfont)
|
||||||
|
self.timeout0 = tk.Entry(self.pagewidgets["Srv"]["PageWin"]["PageEnd"], width = 16, font = self.optfont)
|
||||||
|
self.timeout0.insert('end', str(srv_options['time0']['def']))
|
||||||
|
ToolTip(self.timeout0, text = srv_options['time0']['help'], wraplength = self.wraplength)
|
||||||
|
# Sqlite database.
|
||||||
|
self.chkvalsql = tk.BooleanVar()
|
||||||
|
self.chkvalsql.set(srv_options['sql']['def'])
|
||||||
|
chksql = tk.Checkbutton(self.pagewidgets["Srv"]["PageWin"]["PageEnd"], text = 'Create Sqlite\nDatabase',
|
||||||
|
font = self.optfontredux, var = self.chkvalsql, relief = 'groove')
|
||||||
|
ToolTip(chksql, text = srv_options['sql']['help'], wraplength = self.wraplength)
|
||||||
|
|
||||||
|
## Layout widgets (optsrvwin:Srv:PageWin:PageEnd)
|
||||||
|
# a label for vertical aligning with PageStart
|
||||||
|
tk.Label(self.pagewidgets["Srv"]["PageWin"]["PageEnd"], width = 0,
|
||||||
|
height = 0, bg = self.customcolors['lavender']).grid(row = 0, column = 0, padx = 5, pady = 5, sticky = 'nw')
|
||||||
|
timeout0lbl.grid(row = 1, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
|
self.timeout0.grid(row = 1, column = 1, padx = 5, pady = 5, sticky = 'w')
|
||||||
|
chksql.grid(row = 2, column = 1, padx = 5, pady = 5, sticky = 'w')
|
||||||
|
|
||||||
|
# Store server-side widgets.
|
||||||
|
self.storewidgets_srv = self.gui_store(side = "Srv", typewidgets = ['Button', 'Entry', 'TCombobox', 'Checkbutton'])
|
||||||
|
self.storewidgets_srv.append(self.chksrvfile)
|
||||||
|
|
||||||
|
## Create widgets and layout (msgsrvwin) ---------------------------------------------------------------------------------------------------
|
||||||
self.textboxsrv = TextDoubleScroll(self.msgsrvwin, background = self.customcolors['black'], wrap = 'none', state = 'disabled',
|
self.textboxsrv = TextDoubleScroll(self.msgsrvwin, background = self.customcolors['black'], wrap = 'none', state = 'disabled',
|
||||||
relief = 'ridge', font = self.msgfont)
|
relief = 'ridge', font = self.msgfont)
|
||||||
self.textboxsrv.put()
|
self.textboxsrv.put()
|
||||||
|
|
||||||
## Create widgets (optaddsrvwin) -----------------------------------------------------------------------------------------------------
|
def always_centered(self, geo, centered, refs):
|
||||||
# self.timeout = tk.Entry(self.optaddsrvwin, width = 10)
|
x = (self.winfo_screenwidth() // 2) - (self.winfo_width() // 2)
|
||||||
# self.timeout.insert('end', '555')
|
y = (self.winfo_screenheight() // 2) - (self.winfo_height() // 2)
|
||||||
## Layout widgets (optaddsrvwin)
|
w, h, dx, dy = geo.split('+')[0].split('x') + geo.split('+')[1:]
|
||||||
# self.timeout.grid(row = 0, column = 0, padx = 5, pady = 5, sticky = 'e')
|
|
||||||
|
if w == refs[1]:
|
||||||
|
if centered:
|
||||||
|
self.geometry('+%d+%d' %(x, y))
|
||||||
|
centered = False
|
||||||
|
elif w == refs[0]:
|
||||||
|
if not centered:
|
||||||
|
self.geometry('+%d+%d' %(x, y))
|
||||||
|
centered = True
|
||||||
|
|
||||||
|
if dx != str(x) or dy != str(y):
|
||||||
|
self.geometry('+%d+%d' %(x, 0))
|
||||||
|
|
||||||
|
self.after(200, self.always_centered, self.geometry(), centered, refs)
|
||||||
|
|
||||||
def gui_complete(self):
|
def gui_complete(self):
|
||||||
## Create client widgets (optcltwin, msgcltwin, btncltwin)
|
## Create client widgets (optcltwin, msgcltwin, btncltwin)
|
||||||
self.update_idletasks() # update Gui to get btnsrvwin values --> btncltwin.
|
self.update_idletasks() # update Gui to get btnsrvwin values --> btncltwin.
|
||||||
|
minw, minh = self.winfo_width(), self.winfo_height()
|
||||||
self.iconify()
|
self.iconify()
|
||||||
self.gui_clt()
|
self.gui_clt()
|
||||||
minw, minh = self.winfo_width(), self.winfo_height()
|
maxw, minh = self.winfo_width(), self.winfo_height()
|
||||||
# Main window custom background.
|
## Main window custom background.
|
||||||
self.update_idletasks() # update Gui for custom background
|
self.update_idletasks() # update Gui for custom background
|
||||||
self.iconify()
|
self.iconify()
|
||||||
custom_background(self)
|
custom_background(self)
|
||||||
# Main window other modifications.
|
## Main window other modifications.
|
||||||
|
self.eval('tk::PlaceWindow %s center' %self.winfo_pathname(self.winfo_id()))
|
||||||
self.wm_attributes("-topmost", True)
|
self.wm_attributes("-topmost", True)
|
||||||
self.protocol("WM_DELETE_WINDOW", lambda:0)
|
self.protocol("WM_DELETE_WINDOW", lambda: 0)
|
||||||
self.minsize(minw, minh)
|
## Disable maximize button.
|
||||||
self.resizable(True, False)
|
self.resizable(False, False)
|
||||||
|
## Centered window.
|
||||||
|
self.always_centered(self.geometry(), False, [minw, maxw])
|
||||||
|
|
||||||
def get_position(self, genericwidget):
|
def get_position(self, widget):
|
||||||
x, y = (genericwidget.winfo_x(), genericwidget.winfo_y())
|
x, y = (widget.winfo_x(), widget.winfo_y())
|
||||||
w, h = (genericwidget.winfo_width(), genericwidget.winfo_height())
|
w, h = (widget.winfo_width(), widget.winfo_height())
|
||||||
return x, y, w, h
|
return x, y, w, h
|
||||||
|
|
||||||
def gui_clt(self):
|
def gui_clt(self):
|
||||||
|
self.count_clear = 0
|
||||||
self.optcltwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
self.optcltwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
||||||
self.msgcltwin = tk.Frame(self.masterwin, background = self.customcolors['black'], relief = 'ridge', width = 300, height = 200)
|
self.msgcltwin = tk.Frame(self.masterwin, background = self.customcolors['black'], relief = 'ridge', width = 300, height = 200)
|
||||||
self.btncltwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
self.btncltwin = tk.Canvas(self.masterwin, background = self.customcolors['white'], borderwidth = 3, relief = 'ridge')
|
||||||
|
@ -284,76 +509,98 @@ class KmsGui(tk.Tk):
|
||||||
self.btncltwin_X = xb + 2
|
self.btncltwin_X = xb + 2
|
||||||
self.btncltwin_Y = yb + hb + 10
|
self.btncltwin_Y = yb + hb + 10
|
||||||
self.btncltwin.place(x = self.btncltwin_X, y = self.btncltwin_Y, bordermode = 'inside', anchor = 'nw')
|
self.btncltwin.place(x = self.btncltwin_X, y = self.btncltwin_Y, bordermode = 'inside', anchor = 'nw')
|
||||||
self.optcltwin.grid(row = 0, column = 4, padx = 2, pady = 2, sticky = 'nw')
|
self.optcltwin.grid(row = 0, column = 4, padx = 2, pady = 2, sticky = 'nsew')
|
||||||
|
self.optcltwin.grid_rowconfigure(0, weight = 1)
|
||||||
|
self.optcltwin.grid_columnconfigure(1, weight = 1)
|
||||||
|
|
||||||
|
## Subpages of "optcltwin".
|
||||||
|
self.gui_pages_create(parent = self.optcltwin, side = "Clt", create = {"PageStart": None,
|
||||||
|
"PageEnd": None})
|
||||||
|
|
||||||
|
## Continue to grid.
|
||||||
self.msgcltwin.grid(row = 1, column = 4, padx = 1, pady = 1, sticky = 'nsew')
|
self.msgcltwin.grid(row = 1, column = 4, padx = 1, pady = 1, sticky = 'nsew')
|
||||||
self.msgcltwin.grid_propagate(False)
|
self.msgcltwin.grid_propagate(False)
|
||||||
self.msgcltwin.grid_columnconfigure(0, weight = 1)
|
self.msgcltwin.grid_columnconfigure(0, weight = 1)
|
||||||
self.msgcltwin.grid_rowconfigure(0, weight = 1)
|
self.msgcltwin.grid_rowconfigure(0, weight = 1)
|
||||||
|
|
||||||
# Create widgets (btncltwin) ------------------------------------------------------------------------------------------------------------
|
## Create widgets (btncltwin) ----------------------------------------------------------------------------------------------------------------
|
||||||
self.runbtnclt = tk.Button(self.btncltwin, text = 'START\nCLIENT', background = self.customcolors['blue'],
|
self.runbtnclt = tk.Button(self.btncltwin, text = 'START\nCLIENT', background = self.customcolors['blue'],
|
||||||
foreground = self.customcolors['white'], relief = 'flat', font = self.btnwinfont,
|
foreground = self.customcolors['white'], relief = 'flat', font = self.btnwinfont,
|
||||||
state = 'disabled', command = self.clt_on_start)
|
state = 'disabled', command = self.clt_on_start)
|
||||||
|
|
||||||
#self.othbutt = tk.Button(self.btncltwin, text = 'Botton\n2', background = self.customcolors['green'],
|
## Layout widgets (btncltwin)
|
||||||
# foreground = self.customcolors['white'], relief = 'flat', font = self.btnwinfont)
|
|
||||||
|
|
||||||
# Layout widgets (btncltwin)
|
|
||||||
self.runbtnclt.grid(row = 0, column = 0, padx = 2, pady = 2, sticky = 'ew')
|
self.runbtnclt.grid(row = 0, column = 0, padx = 2, pady = 2, sticky = 'ew')
|
||||||
#self.othbutt.grid(row = 1, column = 0, padx = 2, pady = 2, sticky = 'ew')
|
|
||||||
|
|
||||||
# Create widgets (optcltwin) ------------------------------------------------------------------------------------------------------------
|
## Create widgets (optcltwin:Clt:PageWin:PageStart) ------------------------------------------------------------------------------------------
|
||||||
# Version.
|
# Version.
|
||||||
cltver = tk.Label(self.optcltwin, text = 'You are running client version: ' + clt_version, foreground = self.customcolors['red'],
|
cltver = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'You are running client version: ' + clt_version,
|
||||||
font = self.othfont)
|
foreground = self.customcolors['red'], font = self.othfont)
|
||||||
self.allopts_clt = []
|
|
||||||
# Ip Address.
|
# Ip Address.
|
||||||
cltipaddlbl = tk.Label(self.optcltwin, text = 'IP Address: ', font = self.optfont)
|
cltipaddlbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'IP Address: ', font = self.optfont)
|
||||||
self.cltipadd = tk.Entry(self.optcltwin, width = 10, font = self.optfont)
|
self.cltipadd = tk.Entry(self.pagewidgets["Clt"]["PageWin"]["PageStart"], width = 10, font = self.optfont)
|
||||||
self.cltipadd.insert('end', clt_options['ip']['def'])
|
self.cltipadd.insert('end', clt_options['ip']['def'])
|
||||||
ToolTip(self.cltipadd, text = clt_options['ip']['help'], wraplength = self.wraplength)
|
ToolTip(self.cltipadd, text = clt_options['ip']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_clt.append(self.cltipadd)
|
|
||||||
# Port.
|
# Port.
|
||||||
cltportlbl = tk.Label(self.optcltwin, text = 'Port: ', font = self.optfont)
|
cltportlbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'Port: ', font = self.optfont)
|
||||||
self.cltport = tk.Entry(self.optcltwin, width = 10, font = self.optfont, validate = "key", validatecommand = (self.validation_int, "%S"))
|
self.cltport = tk.Entry(self.pagewidgets["Clt"]["PageWin"]["PageStart"], width = 10, font = self.optfont, validate = "key",
|
||||||
|
validatecommand = self.validation_int)
|
||||||
self.cltport.insert('end', str(clt_options['port']['def']))
|
self.cltport.insert('end', str(clt_options['port']['def']))
|
||||||
ToolTip(self.cltport, text = clt_options['port']['help'], wraplength = self.wraplength)
|
ToolTip(self.cltport, text = clt_options['port']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_clt.append(self.cltport)
|
|
||||||
# Mode.
|
# Mode.
|
||||||
cltmodelbl = tk.Label(self.optcltwin, text = 'Mode: ', font = self.optfont)
|
cltmodelbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'Mode: ', font = self.optfont)
|
||||||
self.cltmode = ttk.Combobox(self.optcltwin, values = tuple(clt_options['mode']['choi']), width = 10)
|
self.cltmode = ttk.Combobox(self.pagewidgets["Clt"]["PageWin"]["PageStart"], values = tuple(clt_options['mode']['choi']),
|
||||||
|
width = 17, height = 10, font = self.optfontredux, state = "readonly")
|
||||||
self.cltmode.set(clt_options['mode']['def'])
|
self.cltmode.set(clt_options['mode']['def'])
|
||||||
ToolTip(self.cltmode, text = clt_options['mode']['help'], wraplength = self.wraplength)
|
ToolTip(self.cltmode, text = clt_options['mode']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_clt.append(self.cltmode)
|
|
||||||
# CMID.
|
# CMID.
|
||||||
cltcmidlbl = tk.Label(self.optcltwin, text = 'CMID: ', font = self.optfont)
|
cltcmidlbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'CMID: ', font = self.optfont)
|
||||||
self.cltcmid = tk.Entry(self.optcltwin, width = 10, font = self.optfont)
|
self.cltcmid = tk.Entry(self.pagewidgets["Clt"]["PageWin"]["PageStart"], width = 10, font = self.optfont)
|
||||||
self.cltcmid.insert('end', str(clt_options['cmid']['def']))
|
self.cltcmid.insert('end', str(clt_options['cmid']['def']))
|
||||||
ToolTip(self.cltcmid, text = clt_options['cmid']['help'], wraplength = self.wraplength)
|
ToolTip(self.cltcmid, text = clt_options['cmid']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_clt.append(self.cltcmid)
|
|
||||||
# Machine Name.
|
# Machine Name.
|
||||||
cltnamelbl = tk.Label(self.optcltwin, text = 'Machine Name: ', font = self.optfont)
|
cltnamelbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'Machine Name: ', font = self.optfont)
|
||||||
self.cltname = tk.Entry(self.optcltwin, width = 10, font = self.optfont)
|
self.cltname = tk.Entry(self.pagewidgets["Clt"]["PageWin"]["PageStart"], width = 10, font = self.optfont)
|
||||||
self.cltname.insert('end', str(clt_options['name']['def']))
|
self.cltname.insert('end', str(clt_options['name']['def']))
|
||||||
ToolTip(self.cltname, text = clt_options['name']['help'], wraplength = self.wraplength)
|
ToolTip(self.cltname, text = clt_options['name']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_clt.append(self.cltname)
|
|
||||||
# Logfile.
|
# Logfile.
|
||||||
cltfilelbl = tk.Label(self.optcltwin, text = 'Logfile Path / Name: ', font = self.optfont)
|
cltfilelbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'Logfile Path / Name: ', font = self.optfont)
|
||||||
self.cltfile = tk.Entry(self.optcltwin, width = 10, font = self.optfont)
|
self.cltfile = tk.Entry(self.pagewidgets["Clt"]["PageWin"]["PageStart"], width = 10, font = self.optfont)
|
||||||
self.cltfile.insert('end', clt_options['lfile']['def'])
|
self.cltfile.insert('end', clt_options['lfile']['def'])
|
||||||
self.cltfile.xview_moveto(1)
|
self.cltfile.xview_moveto(1)
|
||||||
ToolTip(self.cltfile, text = clt_options['lfile']['help'], wraplength = self.wraplength)
|
ToolTip(self.cltfile, text = clt_options['lfile']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_clt.append(self.cltfile)
|
cltfilebtnwin = tk.Button(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'Browse',
|
||||||
cltfilebtnwin = tk.Button(self.optcltwin, text = 'Browse', command = lambda: self.browse(self.cltfile, clt_options))
|
command = lambda: self.browse(self.cltfile, clt_options))
|
||||||
self.allopts_clt.append(cltfilebtnwin)
|
|
||||||
# Loglevel.
|
# Loglevel.
|
||||||
cltlevellbl = tk.Label(self.optcltwin, text = 'Loglevel: ', font = self.optfont)
|
cltlevellbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'Loglevel: ', font = self.optfont)
|
||||||
self.cltlevel = ttk.Combobox(self.optcltwin, values = tuple(clt_options['llevel']['choi']), width = 10)
|
self.cltlevel = ttk.Combobox(self.pagewidgets["Clt"]["PageWin"]["PageStart"], values = tuple(clt_options['llevel']['choi']),
|
||||||
|
width = 10, height = 10, font = self.optfontredux, state = "readonly")
|
||||||
self.cltlevel.set(clt_options['llevel']['def'])
|
self.cltlevel.set(clt_options['llevel']['def'])
|
||||||
ToolTip(self.cltlevel, text = clt_options['llevel']['help'], wraplength = self.wraplength)
|
ToolTip(self.cltlevel, text = clt_options['llevel']['help'], wraplength = self.wraplength)
|
||||||
self.allopts_clt.append(self.cltlevel)
|
|
||||||
|
|
||||||
# Layout widgets (optcltwin)
|
# Logsize.
|
||||||
|
cltsizelbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'Logsize: ', font = self.optfont)
|
||||||
|
self.cltsize = tk.Entry(self.pagewidgets["Clt"]["PageWin"]["PageStart"], width = 10, font = self.optfont, validate = "key",
|
||||||
|
validatecommand = self.validation_float)
|
||||||
|
self.cltsize.insert('end', clt_options['lsize']['def'])
|
||||||
|
ToolTip(self.cltsize, text = clt_options['lsize']['help'], wraplength = self.wraplength)
|
||||||
|
# Asynchronous messages.
|
||||||
|
self.chkvalcltasy = tk.BooleanVar()
|
||||||
|
self.chkvalcltasy.set(clt_options['asyncmsg']['def'])
|
||||||
|
chkcltasy = tk.Checkbutton(self.pagewidgets["Clt"]["PageWin"]["PageStart"], text = 'Async\nMsg',
|
||||||
|
font = self.optfontredux, var = self.chkvalcltasy, relief = 'groove')
|
||||||
|
ToolTip(chkcltasy, text = clt_options['asyncmsg']['help'], wraplength = self.wraplength)
|
||||||
|
|
||||||
|
# Listbox radiobuttons client.
|
||||||
|
self.chkcltfile = ListboxOfRadiobuttons(self.pagewidgets["Clt"]["PageWin"]["PageStart"],
|
||||||
|
['FILE', 'FILEOFF', 'STDOUT', 'STDOUTOFF', 'FILESTDOUT'],
|
||||||
|
self.optfontredux,
|
||||||
|
changed = [(self.cltfile, clt_options['lfile']['def']),
|
||||||
|
(cltfilebtnwin, ''),
|
||||||
|
(self.cltsize, clt_options['lsize']['def']),
|
||||||
|
(self.cltlevel, clt_options['llevel']['def'])],
|
||||||
|
width = 10, height = 1, borderwidth = 2, relief = 'ridge')
|
||||||
|
|
||||||
|
## Layout widgets (optcltwin:Clt:PageWin:PageStart)
|
||||||
cltver.grid(row = 0, column = 0, columnspan = 3, padx = 5, pady = 5, sticky = 'ew')
|
cltver.grid(row = 0, column = 0, columnspan = 3, padx = 5, pady = 5, sticky = 'ew')
|
||||||
cltipaddlbl.grid(row = 1, column = 0, padx = 5, pady = 5, sticky = 'e')
|
cltipaddlbl.grid(row = 1, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
self.cltipadd.grid(row = 1, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
self.cltipadd.grid(row = 1, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
|
@ -365,47 +612,82 @@ class KmsGui(tk.Tk):
|
||||||
self.cltcmid.grid(row = 4, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
self.cltcmid.grid(row = 4, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
cltnamelbl.grid(row = 5, column = 0, padx = 5, pady = 5, sticky = 'e')
|
cltnamelbl.grid(row = 5, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
self.cltname.grid(row = 5, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
self.cltname.grid(row = 5, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
cltfilelbl.grid(row = 6, column = 0, padx = 5, pady = 5, sticky = 'ew')
|
cltfilelbl.grid(row = 6, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
self.cltfile.grid(row = 6, column = 1, padx = 5, pady = 5, sticky = 'e')
|
self.cltfile.grid(row = 6, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
cltfilebtnwin.grid(row = 6, column = 2, padx = 5, pady = 5, sticky = 'ew')
|
cltfilebtnwin.grid(row = 6, column = 2, padx = 5, pady = 5, sticky = 'ew')
|
||||||
cltlevellbl.grid(row = 7, column = 0, padx = 5, pady = 5, sticky = 'e')
|
self.chkcltfile.grid(row = 7, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
self.cltlevel.grid(row = 7, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
chkcltasy.grid(row = 7, column = 2, padx = 5, pady = 5, sticky = 'ew')
|
||||||
|
cltlevellbl.grid(row = 8, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
|
self.cltlevel.grid(row = 8, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
|
cltsizelbl.grid(row = 9, column = 0, padx = 5, pady = 5, sticky = 'e')
|
||||||
|
self.cltsize.grid(row = 9, column = 1, padx = 5, pady = 5, sticky = 'ew')
|
||||||
|
|
||||||
# Create widgets and layout (msgcltwin) ----------------------------------------------------------------------------------------------------------
|
# ugly fix when client-side mode is activated.
|
||||||
|
templbl = tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageStart"],
|
||||||
|
bg = self.customcolors['lavender']).grid(row = 10, column = 0,
|
||||||
|
padx = 35, pady = 54, sticky = 'e')
|
||||||
|
|
||||||
|
## Create widgets (optcltwin:Clt:PageWin:PageEnd) -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Layout widgets (optcltwin:Clt:PageWin:PageEnd)
|
||||||
|
# a label for vertical aligning with PageStart
|
||||||
|
tk.Label(self.pagewidgets["Clt"]["PageWin"]["PageEnd"], width = 0,
|
||||||
|
height = 0, bg = self.customcolors['lavender']).grid(row = 0, column = 0, padx = 5, pady = 5, sticky = 'nw')
|
||||||
|
|
||||||
|
## Store client-side widgets.
|
||||||
|
self.storewidgets_clt = self.gui_store(side = "Clt", typewidgets = ['Button', 'Entry', 'TCombobox', 'Checkbutton'])
|
||||||
|
self.storewidgets_clt.append(self.chkcltfile)
|
||||||
|
|
||||||
|
## Create widgets and layout (msgcltwin) -----------------------------------------------------------------------------------------------------
|
||||||
self.textboxclt = TextDoubleScroll(self.msgcltwin, background = self.customcolors['black'], wrap = 'none', state = 'disabled',
|
self.textboxclt = TextDoubleScroll(self.msgcltwin, background = self.customcolors['black'], wrap = 'none', state = 'disabled',
|
||||||
relief = 'ridge', font = self.msgfont)
|
relief = 'ridge', font = self.msgfont)
|
||||||
self.textboxclt.put()
|
self.textboxclt.put()
|
||||||
|
|
||||||
def prep_option(self, value):
|
def prep_option(self, value):
|
||||||
value = None if value == 'None' else value
|
|
||||||
try:
|
try:
|
||||||
|
# is an INT
|
||||||
return int(value)
|
return int(value)
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
# is NONE or is a STRING.
|
try:
|
||||||
return value
|
# is a FLOAT
|
||||||
|
return float(value)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
# is a STRING.
|
||||||
|
return value
|
||||||
|
|
||||||
def prep_logfile(self, optionlog):
|
def prep_logfile(self, filepath, status):
|
||||||
if optionlog.startswith('FILESTDOUT '):
|
# FILE (pretty on, log view off, logfile yes)
|
||||||
split = optionlog.split('FILESTDOUT ')
|
# FILEOFF (pretty on, log view off, no logfile)
|
||||||
split[0] = 'FILESTDOUT'
|
# STDOUT (pretty off, log view on, no logfile)
|
||||||
return split
|
# STDOUTOFF (pretty off, log view off, logfile yes)
|
||||||
elif optionlog.startswith('STDOUT '):
|
# FILESTDOUT (pretty off, log view on, logfile yes)
|
||||||
split = optionlog.split('STDOUT ')
|
|
||||||
split[0] = 'STDOUT'
|
if status == 'FILE':
|
||||||
return split
|
return filepath
|
||||||
else:
|
elif status in ['FILESTDOUT', 'STDOUTOFF']:
|
||||||
return optionlog
|
return [status, filepath]
|
||||||
|
elif status in ['STDOUT', 'FILEOFF']:
|
||||||
|
return status
|
||||||
|
|
||||||
def validate_int(self, value):
|
def validate_int(self, value):
|
||||||
return value.isdigit()
|
return value == "" or value.isdigit()
|
||||||
|
|
||||||
def clt_on_show(self, force = False):
|
def validate_float(self, value):
|
||||||
if self.optcltwin.winfo_ismapped() or force:
|
if value == "":
|
||||||
|
return True
|
||||||
|
try:
|
||||||
|
float(value)
|
||||||
|
return True
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def clt_on_show(self, force_remove = False, force_view = False):
|
||||||
|
if self.optcltwin.winfo_ismapped() or force_remove:
|
||||||
self.shbtnclt['text'] = 'SHOW\nCLIENT'
|
self.shbtnclt['text'] = 'SHOW\nCLIENT'
|
||||||
self.optcltwin.grid_remove()
|
self.optcltwin.grid_remove()
|
||||||
self.msgcltwin.grid_remove()
|
self.msgcltwin.grid_remove()
|
||||||
self.btncltwin.place_forget()
|
self.btncltwin.place_forget()
|
||||||
else:
|
elif not self.optcltwin.winfo_ismapped() or force_view:
|
||||||
self.shbtnclt['text'] = 'HIDE\nCLIENT'
|
self.shbtnclt['text'] = 'HIDE\nCLIENT'
|
||||||
self.optcltwin.grid()
|
self.optcltwin.grid()
|
||||||
self.msgcltwin.grid()
|
self.msgcltwin.grid()
|
||||||
|
@ -413,12 +695,12 @@ class KmsGui(tk.Tk):
|
||||||
|
|
||||||
def srv_on_start(self):
|
def srv_on_start(self):
|
||||||
if self.runbtnsrv['text'] == 'START\nSERVER':
|
if self.runbtnsrv['text'] == 'START\nSERVER':
|
||||||
|
self.on_clear([txsrv, txclt])
|
||||||
self.srv_actions_start()
|
self.srv_actions_start()
|
||||||
# wait for switch.
|
# wait for switch.
|
||||||
while not serverthread.is_running_server:
|
while not serverthread.is_running_server:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.on_clear([txsrv, txclt])
|
|
||||||
self.srv_toggle_all(on_start = True)
|
self.srv_toggle_all(on_start = True)
|
||||||
# run thread for interrupting server when an error happens.
|
# run thread for interrupting server when an error happens.
|
||||||
self.srv_eject_thread = threading.Thread(target = self.srv_eject, name = "Thread-SrvEjt")
|
self.srv_eject_thread = threading.Thread(target = self.srv_eject, name = "Thread-SrvEjt")
|
||||||
|
@ -436,20 +718,24 @@ class KmsGui(tk.Tk):
|
||||||
def srv_actions_start(self):
|
def srv_actions_start(self):
|
||||||
srv_config[srv_options['ip']['des']] = self.srvipadd.get()
|
srv_config[srv_options['ip']['des']] = self.srvipadd.get()
|
||||||
srv_config[srv_options['port']['des']] = self.prep_option(self.srvport.get())
|
srv_config[srv_options['port']['des']] = self.prep_option(self.srvport.get())
|
||||||
srv_config[srv_options['epid']['des']] = self.prep_option(self.epid.get())
|
srv_config[srv_options['epid']['des']] = self.epid.get()
|
||||||
srv_config[srv_options['lcid']['des']] = self.prep_option(self.lcid.get())
|
srv_config[srv_options['lcid']['des']] = self.prep_option(self.lcid.get())
|
||||||
srv_config[srv_options['hwid']['des']] = self.hwid.get()
|
srv_config[srv_options['hwid']['des']] = self.hwid.get()
|
||||||
srv_config[srv_options['count']['des']] = self.prep_option(self.count.get())
|
srv_config[srv_options['count']['des']] = self.prep_option(self.count.get())
|
||||||
srv_config[srv_options['activation']['des']] = self.prep_option(self.activ.get())
|
srv_config[srv_options['activation']['des']] = self.prep_option(self.activ.get())
|
||||||
srv_config[srv_options['renewal']['des']] = self.prep_option(self.renew.get())
|
srv_config[srv_options['renewal']['des']] = self.prep_option(self.renew.get())
|
||||||
srv_config[srv_options['lfile']['des']] = self.prep_logfile(self.srvfile.get())
|
srv_config[srv_options['lfile']['des']] = self.prep_logfile(self.srvfile.get(), self.chksrvfile.state())
|
||||||
|
srv_config[srv_options['asyncmsg']['des']] = self.chkvalsrvasy.get()
|
||||||
srv_config[srv_options['llevel']['des']] = self.srvlevel.get()
|
srv_config[srv_options['llevel']['des']] = self.srvlevel.get()
|
||||||
srv_config[srv_options['sql']['des']] = self.chkval.get()
|
srv_config[srv_options['lsize']['des']] = self.prep_option(self.srvsize.get())
|
||||||
|
|
||||||
## TODO.
|
srv_config[srv_options['time0']['des']] = self.prep_option(self.timeout0.get())
|
||||||
srv_config[srv_options['lsize']['des']] = 0
|
srv_config[srv_options['sql']['des']] = self.chkvalsql.get()
|
||||||
srv_config[srv_options['time']['des']] = None
|
|
||||||
|
|
||||||
|
## Redirect stdout.
|
||||||
|
gui_redirector('stdout', redirect_to = TextRedirect.Log,
|
||||||
|
redirect_conditio = (srv_config[srv_options['lfile']['des']] in ['STDOUT', 'FILESTDOUT']))
|
||||||
|
gui_redirector_setup()
|
||||||
serverqueue.put('start')
|
serverqueue.put('start')
|
||||||
|
|
||||||
def srv_actions_stop(self):
|
def srv_actions_stop(self):
|
||||||
|
@ -468,14 +754,16 @@ class KmsGui(tk.Tk):
|
||||||
if on_start:
|
if on_start:
|
||||||
self.runbtnsrv.configure(text = 'STOP\nSERVER', background = self.customcolors['red'],
|
self.runbtnsrv.configure(text = 'STOP\nSERVER', background = self.customcolors['red'],
|
||||||
foreground = self.customcolors['white'])
|
foreground = self.customcolors['white'])
|
||||||
for widget in self.allopts_srv:
|
for widget in self.storewidgets_srv:
|
||||||
widget.configure(state = 'disabled')
|
widget.configure(state = 'disabled')
|
||||||
self.runbtnclt.configure(state = 'normal')
|
self.runbtnclt.configure(state = 'normal')
|
||||||
else:
|
else:
|
||||||
self.runbtnsrv.configure(text = 'START\nSERVER', background = self.customcolors['green'],
|
self.runbtnsrv.configure(text = 'START\nSERVER', background = self.customcolors['green'],
|
||||||
foreground = self.customcolors['white'])
|
foreground = self.customcolors['white'])
|
||||||
for widget in self.allopts_srv:
|
for widget in self.storewidgets_srv:
|
||||||
widget.configure(state = 'normal')
|
widget.configure(state = 'normal')
|
||||||
|
if isinstance(widget, ListboxOfRadiobuttons):
|
||||||
|
widget.change()
|
||||||
self.runbtnclt.configure(state = 'disabled')
|
self.runbtnclt.configure(state = 'disabled')
|
||||||
|
|
||||||
def srv_toggle_state(self):
|
def srv_toggle_state(self):
|
||||||
|
@ -487,27 +775,36 @@ class KmsGui(tk.Tk):
|
||||||
self.statesrv.configure(text = txt, foreground = color)
|
self.statesrv.configure(text = txt, foreground = color)
|
||||||
|
|
||||||
def clt_on_start(self):
|
def clt_on_start(self):
|
||||||
|
if self.onlyclt:
|
||||||
|
self.on_clear([txclt])
|
||||||
|
else:
|
||||||
|
rng, add_newline = self.on_clear_setup()
|
||||||
|
self.on_clear([txsrv, txclt], clear_range = [rng, None], newline_list = [add_newline, False])
|
||||||
|
|
||||||
self.clt_actions_start()
|
self.clt_actions_start()
|
||||||
# run thread for disabling interrupt server and client, when client running.
|
# run thread for disabling interrupt server and client, when client running.
|
||||||
self.clt_eject_thread = threading.Thread(target = self.clt_eject, name = "Thread-CltEjt")
|
self.clt_eject_thread = threading.Thread(target = self.clt_eject, name = "Thread-CltEjt")
|
||||||
self.clt_eject_thread.setDaemon(True)
|
self.clt_eject_thread.setDaemon(True)
|
||||||
self.clt_eject_thread.start()
|
self.clt_eject_thread.start()
|
||||||
|
|
||||||
self.on_clear([txsrv, txclt])
|
for widget in self.storewidgets_clt + [self.runbtnsrv, self.runbtnclt]:
|
||||||
for widget in self.allopts_clt + [self.runbtnsrv, self.runbtnclt]:
|
|
||||||
widget.configure(state = 'disabled')
|
widget.configure(state = 'disabled')
|
||||||
|
|
||||||
def clt_actions_start(self):
|
def clt_actions_start(self):
|
||||||
clt_config[clt_options['ip']['des']] = self.cltipadd.get()
|
clt_config[clt_options['ip']['des']] = self.cltipadd.get()
|
||||||
clt_config[clt_options['port']['des']] = self.prep_option(self.cltport.get())
|
clt_config[clt_options['port']['des']] = self.prep_option(self.cltport.get())
|
||||||
clt_config[clt_options['mode']['des']] = self.cltmode.get()
|
clt_config[clt_options['mode']['des']] = self.cltmode.get()
|
||||||
clt_config[clt_options['cmid']['des']] = self.prep_option(self.cltcmid.get())
|
clt_config[clt_options['cmid']['des']] = self.cltcmid.get()
|
||||||
clt_config[clt_options['name']['des']] = self.prep_option(self.cltname.get())
|
clt_config[clt_options['name']['des']] = self.cltname.get()
|
||||||
|
clt_config[clt_options['lfile']['des']] = self.prep_logfile(self.cltfile.get(), self.chkcltfile.state())
|
||||||
|
clt_config[clt_options['asyncmsg']['des']] = self.chkvalcltasy.get()
|
||||||
clt_config[clt_options['llevel']['des']] = self.cltlevel.get()
|
clt_config[clt_options['llevel']['des']] = self.cltlevel.get()
|
||||||
clt_config[clt_options['lfile']['des']] = self.prep_logfile(self.cltfile.get())
|
clt_config[clt_options['lsize']['des']] = self.prep_option(self.cltsize.get())
|
||||||
|
|
||||||
## TODO.
|
## Redirect stdout.
|
||||||
clt_config[clt_options['lsize']['des']] = 0
|
gui_redirector('stdout', redirect_to = TextRedirect.Log,
|
||||||
|
redirect_conditio = (clt_config[clt_options['lfile']['des']] in ['STDOUT', 'FILESTDOUT']))
|
||||||
|
gui_redirector_setup()
|
||||||
|
|
||||||
# run client (in a thread).
|
# run client (in a thread).
|
||||||
self.clientthread = client_thread(name = "Thread-Clt")
|
self.clientthread = client_thread(name = "Thread-Clt")
|
||||||
|
@ -518,8 +815,18 @@ class KmsGui(tk.Tk):
|
||||||
def clt_eject(self):
|
def clt_eject(self):
|
||||||
while self.clientthread.is_alive():
|
while self.clientthread.is_alive():
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
for widget in self.allopts_clt + [self.runbtnsrv, self.runbtnclt]:
|
|
||||||
widget.configure(state = 'normal')
|
widgets = self.storewidgets_clt + [self.runbtnclt]
|
||||||
|
if not self.onlyclt:
|
||||||
|
widgets += [self.runbtnsrv]
|
||||||
|
|
||||||
|
for widget in widgets:
|
||||||
|
if isinstance(widget, ttk.Combobox):
|
||||||
|
widget.configure(state = 'readonly')
|
||||||
|
else:
|
||||||
|
widget.configure(state = 'normal')
|
||||||
|
if isinstance(widget, ListboxOfRadiobuttons):
|
||||||
|
widget.change()
|
||||||
|
|
||||||
def on_exit(self):
|
def on_exit(self):
|
||||||
if serverthread.is_running_server:
|
if serverthread.is_running_server:
|
||||||
|
@ -530,8 +837,38 @@ class KmsGui(tk.Tk):
|
||||||
server_terminate(serverthread, exit_thread = True)
|
server_terminate(serverthread, exit_thread = True)
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
def on_clear(self, widgetlist):
|
def on_clear_setup(self):
|
||||||
for widget in widgetlist:
|
if any(opt in ['STDOUT', 'FILESTDOUT'] for opt in srv_config[srv_options['lfile']['des']]):
|
||||||
|
if self.count_clear == 0:
|
||||||
|
self.ini = txsrv.index('end')
|
||||||
|
add_newline = False
|
||||||
|
else:
|
||||||
|
if self.count_clear == 1:
|
||||||
|
self.ini = '%s.0' %(int(self.ini[0]) - 1)
|
||||||
|
else:
|
||||||
|
self.ini = '%s.0' %(int(self.ini[0]))
|
||||||
|
add_newline = True
|
||||||
|
rng = [self.ini, 'end']
|
||||||
|
self.count_clear += 1
|
||||||
|
else:
|
||||||
|
rng, add_newline = None, False
|
||||||
|
self.count_clear = 0
|
||||||
|
|
||||||
|
return rng, add_newline
|
||||||
|
|
||||||
|
def on_clear(self, widget_list, clear_range = None, newline_list = []):
|
||||||
|
if newline_list == []:
|
||||||
|
newline_list = len(widget_list) * [False]
|
||||||
|
|
||||||
|
for num, couple in enumerate(zip(widget_list, newline_list)):
|
||||||
|
widget, add_n = couple
|
||||||
|
try:
|
||||||
|
ini, fin = clear_range[num]
|
||||||
|
except TypeError:
|
||||||
|
ini, fin = '1.0', 'end'
|
||||||
|
|
||||||
widget.configure(state = 'normal')
|
widget.configure(state = 'normal')
|
||||||
widget.delete('1.0', 'end')
|
widget.delete(ini, fin)
|
||||||
|
if add_n:
|
||||||
|
widget.insert('end', '\n')
|
||||||
widget.configure(state = 'disabled')
|
widget.configure(state = 'disabled')
|
||||||
|
|
|
@ -4,6 +4,8 @@ import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
from time import sleep
|
||||||
|
import threading
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Python 2.x imports
|
# Python 2.x imports
|
||||||
|
@ -18,7 +20,7 @@ except ImportError:
|
||||||
|
|
||||||
from pykms_Format import MsgMap, unshell_message, unformat_message
|
from pykms_Format import MsgMap, unshell_message, unformat_message
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/3221956/how-do-i-display-tooltips-in-tkinter
|
# https://stackoverflow.com/questions/3221956/how-do-i-display-tooltips-in-tkinter
|
||||||
class ToolTip(object):
|
class ToolTip(object):
|
||||||
|
@ -117,38 +119,22 @@ class ToolTip(object):
|
||||||
tw.destroy()
|
tw.destroy()
|
||||||
self.tw = None
|
self.tw = None
|
||||||
|
|
||||||
##--------------------------------------------------------------------------------------------------------------------------------------------------------
|
##-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
# https://stackoverflow.com/questions/2914603/segmentation-fault-while-redirecting-sys-stdout-to-tkinter-text-widget
|
|
||||||
# https://stackoverflow.com/questions/7217715/threadsafe-printing-across-multiple-processes-python-2-x
|
|
||||||
# https://stackoverflow.com/questions/3029816/how-do-i-get-a-thread-safe-print-in-python-2-6
|
|
||||||
# https://stackoverflow.com/questions/20303291/issue-with-redirecting-stdout-to-tkinter-text-widget-with-threads
|
|
||||||
|
|
||||||
class TextRedirect(object):
|
class TextRedirect(object):
|
||||||
class StdoutRedirect(object):
|
class Pretty(object):
|
||||||
tag_num = 0
|
|
||||||
|
|
||||||
grpmsg = unformat_message([MsgMap[1], MsgMap[7], MsgMap[12], MsgMap[20]])
|
grpmsg = unformat_message([MsgMap[1], MsgMap[7], MsgMap[12], MsgMap[20]])
|
||||||
arrows = [ item[0] for item in grpmsg ]
|
arrows = [ item[0] for item in grpmsg ]
|
||||||
clt_msg_nonewline = [ item[1] for item in grpmsg ]
|
clt_msg_nonewline = [ item[1] for item in grpmsg ]
|
||||||
arrows = list(set(arrows))
|
arrows = list(set(arrows))
|
||||||
lenarrow = len(arrows[0])
|
lenarrow = len(arrows[0])
|
||||||
srv_msg_nonewline = [ item[0] for item in unformat_message([MsgMap[2], MsgMap[5], MsgMap[13], MsgMap[18]]) ]
|
srv_msg_nonewline = [ item[0] for item in unformat_message([MsgMap[2], MsgMap[5], MsgMap[13], MsgMap[18]]) ]
|
||||||
terminator = unformat_message([MsgMap[21]])[0][0]
|
msg_align = [ msg[0].replace('\t', '').replace('\n', '') for msg in unformat_message([MsgMap[-2], MsgMap[-4]]) ]
|
||||||
msg_align = [ msg[0].replace('\t', '').replace('\n', '') for msg in unformat_message([MsgMap[-2], MsgMap[-4]])]
|
|
||||||
newlinecut = [-1, -2, -4, -5]
|
|
||||||
|
|
||||||
def __init__(self, srv_text_space, clt_text_space, customcolors, str_to_print, where):
|
def __init__(self, srv_text_space, clt_text_space, customcolors):
|
||||||
self.srv_text_space = srv_text_space
|
self.srv_text_space = srv_text_space
|
||||||
self.clt_text_space = clt_text_space
|
self.clt_text_space = clt_text_space
|
||||||
self.customcolors = customcolors
|
self.customcolors = customcolors
|
||||||
self.str_to_print = str_to_print
|
|
||||||
self.where = where
|
|
||||||
self.textbox_do()
|
|
||||||
|
|
||||||
def textbox_finish(self, message):
|
|
||||||
if message == self.terminator:
|
|
||||||
TextRedirect.StdoutRedirect.tag_num = 0
|
|
||||||
TextRedirect.StdoutRedirect.newlinecut = [-1, -2, -4, -5]
|
|
||||||
|
|
||||||
def textbox_write(self, tag, message, color, extras):
|
def textbox_write(self, tag, message, color, extras):
|
||||||
widget = self.textbox_choose(message)
|
widget = self.textbox_choose(message)
|
||||||
|
@ -159,14 +145,15 @@ class TextRedirect(object):
|
||||||
self.textbox_color(tag, widget, color, self.customcolors['black'], extras)
|
self.textbox_color(tag, widget, color, self.customcolors['black'], extras)
|
||||||
widget.after(100, widget.see('end'))
|
widget.after(100, widget.see('end'))
|
||||||
widget.configure(state = 'disabled')
|
widget.configure(state = 'disabled')
|
||||||
self.textbox_finish(message)
|
|
||||||
|
|
||||||
def textbox_choose(self, message):
|
def textbox_choose(self, message):
|
||||||
if self.where == "srv":
|
if any(item.startswith('logsrv') for item in [message, self.str_to_print]):
|
||||||
self.srv_text_space.focus_set()
|
self.srv_text_space.focus_set()
|
||||||
|
self.where = "srv"
|
||||||
return self.srv_text_space
|
return self.srv_text_space
|
||||||
elif self.where == "clt":
|
elif any(item.startswith('logclt') for item in [message, self.str_to_print]):
|
||||||
self.clt_text_space.focus_set()
|
self.clt_text_space.focus_set()
|
||||||
|
self.where = "clt"
|
||||||
return self.clt_text_space
|
return self.clt_text_space
|
||||||
|
|
||||||
def textbox_color(self, tag, widget, forecolor = 'white', backcolor = 'black', extras = []):
|
def textbox_color(self, tag, widget, forecolor = 'white', backcolor = 'black', extras = []):
|
||||||
|
@ -209,8 +196,8 @@ class TextRedirect(object):
|
||||||
# horizontal align.
|
# horizontal align.
|
||||||
if msg_unformat in self.msg_align:
|
if msg_unformat in self.msg_align:
|
||||||
msg_strip = message.lstrip('\n')
|
msg_strip = message.lstrip('\n')
|
||||||
message = '\n' * (len(message) - len(msg_strip) + TextRedirect.StdoutRedirect.newlinecut[0]) + msg_strip
|
message = '\n' * (len(message) - len(msg_strip) + TextRedirect.Pretty.newlinecut[0]) + msg_strip
|
||||||
TextRedirect.StdoutRedirect.newlinecut.pop(0)
|
TextRedirect.Pretty.newlinecut.pop(0)
|
||||||
|
|
||||||
count = Counter(message)
|
count = Counter(message)
|
||||||
countab = (count['\t'] if count['\t'] != 0 else 1)
|
countab = (count['\t'] if count['\t'] != 0 else 1)
|
||||||
|
@ -218,26 +205,50 @@ class TextRedirect(object):
|
||||||
return message
|
return message
|
||||||
|
|
||||||
def textbox_do(self):
|
def textbox_do(self):
|
||||||
msgs, TextRedirect.StdoutRedirect.tag_num = unshell_message(self.str_to_print, TextRedirect.StdoutRedirect.tag_num)
|
msgs, TextRedirect.Pretty.tag_num = unshell_message(self.str_to_print, TextRedirect.Pretty.tag_num)
|
||||||
for tag in msgs:
|
for tag in msgs:
|
||||||
self.textbox_write(tag, msgs[tag]['text'], self.customcolors[msgs[tag]['color']], msgs[tag]['extra'])
|
self.textbox_write(tag, msgs[tag]['text'], self.customcolors[msgs[tag]['color']], msgs[tag]['extra'])
|
||||||
|
|
||||||
class StderrRedirect(StdoutRedirect):
|
def flush(self):
|
||||||
def __init__(self, srv_text_space, clt_text_space, customcolors):
|
pass
|
||||||
|
|
||||||
|
def write(self, string):
|
||||||
|
if string != '\n':
|
||||||
|
self.str_to_print = string
|
||||||
|
self.textbox_do()
|
||||||
|
|
||||||
|
class Stderr(Pretty):
|
||||||
|
def __init__(self, srv_text_space, clt_text_space, customcolors, side):
|
||||||
self.srv_text_space = srv_text_space
|
self.srv_text_space = srv_text_space
|
||||||
self.clt_text_space = clt_text_space
|
self.clt_text_space = clt_text_space
|
||||||
self.customcolors = customcolors
|
self.customcolors = customcolors
|
||||||
|
self.side = side
|
||||||
self.tag_err = 'STDERR'
|
self.tag_err = 'STDERR'
|
||||||
self.xfont = tkFont.Font(font = self.srv_text_space['font'])
|
self.xfont = tkFont.Font(font = self.srv_text_space['font'])
|
||||||
|
|
||||||
|
def textbox_choose(self, message):
|
||||||
|
if self.side == "srv":
|
||||||
|
return self.srv_text_space
|
||||||
|
elif self.side == "clt":
|
||||||
|
return self.clt_text_space
|
||||||
|
|
||||||
def write(self, string):
|
def write(self, string):
|
||||||
self.textbox_color(self.tag_err, self.srv_text_space, self.customcolors['red'], self.customcolors['black'])
|
widget = self.textbox_choose(string)
|
||||||
|
self.textbox_color(self.tag_err, widget, self.customcolors['red'], self.customcolors['black'])
|
||||||
self.srv_text_space.configure(state = 'normal')
|
self.srv_text_space.configure(state = 'normal')
|
||||||
self.srv_text_space.insert('end', string, self.tag_err)
|
self.srv_text_space.insert('end', string, self.tag_err)
|
||||||
self.srv_text_space.see('end')
|
self.srv_text_space.see('end')
|
||||||
self.srv_text_space.configure(state = 'disabled')
|
self.srv_text_space.configure(state = 'disabled')
|
||||||
|
|
||||||
##-------------------------------------------------------------------------------------------------------------------------------------------------------
|
class Log(Pretty):
|
||||||
|
def textbox_format(self, message):
|
||||||
|
if message.startswith('logsrv'):
|
||||||
|
message = message.replace('logsrv ', '')
|
||||||
|
if message.startswith('logclt'):
|
||||||
|
message = message.replace('logclt ', '')
|
||||||
|
return message + '\n'
|
||||||
|
|
||||||
|
##-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
class TextDoubleScroll(tk.Frame):
|
class TextDoubleScroll(tk.Frame):
|
||||||
def __init__(self, master, **kwargs):
|
def __init__(self, master, **kwargs):
|
||||||
""" Initialize.
|
""" Initialize.
|
||||||
|
@ -245,8 +256,8 @@ class TextDoubleScroll(tk.Frame):
|
||||||
- vertical scrollbar
|
- vertical scrollbar
|
||||||
- text widget
|
- text widget
|
||||||
"""
|
"""
|
||||||
self.master = master
|
|
||||||
tk.Frame.__init__(self, master)
|
tk.Frame.__init__(self, master)
|
||||||
|
self.master = master
|
||||||
|
|
||||||
self.textbox = tk.Text(self.master, **kwargs)
|
self.textbox = tk.Text(self.master, **kwargs)
|
||||||
self.sizegrip = ttk.Sizegrip(self.master)
|
self.sizegrip = ttk.Sizegrip(self.master)
|
||||||
|
@ -278,43 +289,237 @@ class TextDoubleScroll(tk.Frame):
|
||||||
""" Return the "frame" useful to place inner controls. """
|
""" Return the "frame" useful to place inner controls. """
|
||||||
return self.textbox
|
return self.textbox
|
||||||
|
|
||||||
##--------------------------------------------------------------------------------------------------------------------------------------------------
|
##-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
def custom_background(window):
|
def custom_background(window):
|
||||||
|
# first level canvas.
|
||||||
allwidgets = window.grid_slaves(0,0)[0].grid_slaves() + window.grid_slaves(0,0)[0].place_slaves()
|
allwidgets = window.grid_slaves(0,0)[0].grid_slaves() + window.grid_slaves(0,0)[0].place_slaves()
|
||||||
widgets = [ widget for widget in allwidgets if widget.winfo_class() == 'Canvas']
|
widgets_alphalow = [ widget for widget in allwidgets if widget.winfo_class() == 'Canvas']
|
||||||
|
widgets_alphahigh = []
|
||||||
|
# sub-level canvas.
|
||||||
|
for side in ["Srv", "Clt"]:
|
||||||
|
widgets_alphahigh.append(window.pagewidgets[side]["BtnWin"])
|
||||||
|
for position in ["Left", "Right"]:
|
||||||
|
widgets_alphahigh.append(window.pagewidgets[side]["AniWin"][position])
|
||||||
|
for pagename in window.pagewidgets[side]["PageWin"].keys():
|
||||||
|
widgets_alphalow.append(window.pagewidgets[side]["PageWin"][pagename])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PIL import Image, ImageTk
|
from PIL import Image, ImageTk
|
||||||
|
|
||||||
# Open Image.
|
# Open Image.
|
||||||
img = Image.open(os.path.dirname(os.path.abspath( __file__ )) + "/pykms_Keys.gif")
|
img = Image.open(os.path.dirname(os.path.abspath( __file__ )) + "/graphics/pykms_Keys.gif")
|
||||||
|
img = img.convert('RGBA')
|
||||||
# Resize image.
|
# Resize image.
|
||||||
img.resize((window.winfo_width(), window.winfo_height()), Image.ANTIALIAS)
|
img.resize((window.winfo_width(), window.winfo_height()), Image.ANTIALIAS)
|
||||||
# Put semi-transparent background chunks.
|
# Put semi-transparent background chunks.
|
||||||
window.backcrops = []
|
window.backcrops_alphalow, window.backcrops_alphahigh = ([] for _ in range(2))
|
||||||
|
|
||||||
for widget in widgets:
|
def cutter(master, image, widgets, crops, alpha):
|
||||||
x, y, w, h = window.get_position(widget)
|
for widget in widgets:
|
||||||
cropped = img.crop((x, y, x + w, y + h))
|
x, y, w, h = master.get_position(widget)
|
||||||
cropped.putalpha(24)
|
cropped = image.crop((x, y, x + w, y + h))
|
||||||
window.backcrops.append(ImageTk.PhotoImage(cropped))
|
cropped.putalpha(alpha)
|
||||||
|
crops.append(ImageTk.PhotoImage(cropped))
|
||||||
|
# Not in same loop to prevent reference garbage.
|
||||||
|
for crop, widget in zip(crops, widgets):
|
||||||
|
widget.create_image(1, 1, image = crop, anchor = 'nw')
|
||||||
|
|
||||||
# Not in same loop to prevent reference garbage.
|
cutter(window, img, widgets_alphalow, window.backcrops_alphalow, 36)
|
||||||
for crop, widget in zip(window.backcrops, widgets):
|
cutter(window, img, widgets_alphahigh, window.backcrops_alphahigh, 96)
|
||||||
widget.create_image(1, 1, image = crop, anchor = 'nw')
|
|
||||||
|
|
||||||
# Put semi-transparent background overall.
|
# Put semi-transparent background overall.
|
||||||
img.putalpha(96)
|
img.putalpha(128)
|
||||||
window.backimg = ImageTk.PhotoImage(img)
|
window.backimg = ImageTk.PhotoImage(img)
|
||||||
window.masterwin.create_image(1, 1, image = window.backimg, anchor = 'nw')
|
window.masterwin.create_image(1, 1, image = window.backimg, anchor = 'nw')
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
for widget in widgets:
|
for widget in widgets_alphalow + widgets_alphahigh:
|
||||||
widget.configure(background = window.customcolors['lavender'])
|
widget.configure(background = window.customcolors['lavender'])
|
||||||
|
|
||||||
# Hide client.
|
# Hide client.
|
||||||
window.clt_on_show(force = True)
|
window.clt_on_show(force_remove = True)
|
||||||
# Show Gui.
|
# Show Gui.
|
||||||
window.deiconify()
|
window.deiconify()
|
||||||
|
|
||||||
##---------------------------------------------------------------------------------------------------------------------------------------------------------
|
##-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
class Animation(object):
|
||||||
|
def __init__(self, gifpath, master, widget, loop = False):
|
||||||
|
from PIL import Image, ImageTk, ImageSequence
|
||||||
|
|
||||||
|
self.master = master
|
||||||
|
self.widget = widget
|
||||||
|
self.loop = loop
|
||||||
|
self.cancelid = None
|
||||||
|
self.flagstop = False
|
||||||
|
self.index = 0
|
||||||
|
self.frames = []
|
||||||
|
|
||||||
|
img = Image.open(gifpath)
|
||||||
|
size = img.size
|
||||||
|
for frame in ImageSequence.Iterator(img):
|
||||||
|
static_img = ImageTk.PhotoImage(frame.convert('RGBA'))
|
||||||
|
try:
|
||||||
|
static_img.delay = int(frame.info['duration'])
|
||||||
|
except KeyError:
|
||||||
|
static_img.delay = 100
|
||||||
|
self.frames.append(static_img)
|
||||||
|
|
||||||
|
self.widget.configure(width = size[0], height = size[1])
|
||||||
|
self.initialize()
|
||||||
|
|
||||||
|
def initialize(self):
|
||||||
|
self.widget.configure(image = self.frames[0])
|
||||||
|
self.widget.image = self.frames[0]
|
||||||
|
|
||||||
|
def deanimate(self):
|
||||||
|
while not self.flagstop:
|
||||||
|
pass
|
||||||
|
self.flagstop = False
|
||||||
|
self.index = 0
|
||||||
|
self.widget.configure(relief = "raised")
|
||||||
|
|
||||||
|
def animate(self):
|
||||||
|
frame = self.frames[self.index]
|
||||||
|
self.widget.configure(image = frame, relief = "sunken")
|
||||||
|
self.index += 1
|
||||||
|
self.cancelid = self.master.after(frame.delay, self.animate)
|
||||||
|
if self.index == len(self.frames):
|
||||||
|
if self.loop:
|
||||||
|
self.index = 0
|
||||||
|
else:
|
||||||
|
self.stop()
|
||||||
|
|
||||||
|
def start(self, event = None):
|
||||||
|
if str(self.widget['state']) != 'disabled':
|
||||||
|
if self.cancelid is None:
|
||||||
|
if not self.loop:
|
||||||
|
self.btnani_thread = threading.Thread(target = self.deanimate, name = "Thread-BtnAni")
|
||||||
|
self.btnani_thread.setDaemon(True)
|
||||||
|
self.btnani_thread.start()
|
||||||
|
self.cancelid = self.master.after(self.frames[0].delay, self.animate)
|
||||||
|
|
||||||
|
def stop(self, event = None):
|
||||||
|
if self.cancelid:
|
||||||
|
self.master.after_cancel(self.cancelid)
|
||||||
|
self.cancelid = None
|
||||||
|
self.flagstop = True
|
||||||
|
self.initialize()
|
||||||
|
|
||||||
|
|
||||||
|
def custom_pages(window, side):
|
||||||
|
buttons = window.pagewidgets[side]["BtnAni"]
|
||||||
|
labels = window.pagewidgets[side]["LblAni"]
|
||||||
|
|
||||||
|
for position in buttons.keys():
|
||||||
|
buttons[position].config(anchor = "center",
|
||||||
|
font = window.btnwinfont,
|
||||||
|
background = window.customcolors['white'],
|
||||||
|
activebackground = window.customcolors['white'],
|
||||||
|
borderwidth = 2)
|
||||||
|
|
||||||
|
try:
|
||||||
|
anibtn = Animation(os.path.dirname(os.path.abspath( __file__ )) + "/graphics/pykms_Keyhole_%s.gif" %position,
|
||||||
|
window, buttons[position], loop = False)
|
||||||
|
anilbl = Animation(os.path.dirname(os.path.abspath( __file__ )) + "/graphics/pykms_Arrow_%s.gif" %position,
|
||||||
|
window, labels[position], loop = True)
|
||||||
|
|
||||||
|
def animationwait(master, button, btn_animation, lbl_animation):
|
||||||
|
while btn_animation.cancelid:
|
||||||
|
pass
|
||||||
|
sleep(1)
|
||||||
|
x, y = master.winfo_pointerxy()
|
||||||
|
if master.winfo_containing(x, y) == button:
|
||||||
|
lbl_animation.start()
|
||||||
|
|
||||||
|
def animationcombo(master, button, btn_animation, lbl_animation):
|
||||||
|
wait_thread = threading.Thread(target = animationwait,
|
||||||
|
args = (master, button, btn_animation, lbl_animation),
|
||||||
|
name = "Thread-WaitAni")
|
||||||
|
wait_thread.setDaemon(True)
|
||||||
|
wait_thread.start()
|
||||||
|
lbl_animation.stop()
|
||||||
|
btn_animation.start()
|
||||||
|
|
||||||
|
buttons[position].bind("<ButtonPress>", lambda event, anim1 = anibtn, anim2 = anilbl,
|
||||||
|
bt = buttons[position], win = window:
|
||||||
|
animationcombo(win, bt, anim1, anim2))
|
||||||
|
buttons[position].bind("<Enter>", anilbl.start)
|
||||||
|
buttons[position].bind("<Leave>", anilbl.stop)
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
buttons[position].config(activebackground = window.customcolors['blue'],
|
||||||
|
foreground = window.customcolors['blue'])
|
||||||
|
labels[position].config(background = window.customcolors['lavender'])
|
||||||
|
|
||||||
|
if position == "Left":
|
||||||
|
buttons[position].config(text = '<<')
|
||||||
|
elif position == "Right":
|
||||||
|
buttons[position].config(text = '>>')
|
||||||
|
|
||||||
|
##-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
class ListboxOfRadiobuttons(tk.Frame):
|
||||||
|
def __init__(self, master, radios, font, changed, **kwargs):
|
||||||
|
tk.Frame.__init__(self, master)
|
||||||
|
|
||||||
|
self.master = master
|
||||||
|
self.radios = radios
|
||||||
|
self.font = font
|
||||||
|
self.changed = changed
|
||||||
|
|
||||||
|
self.scrollv = tk.Scrollbar(self, orient = "vertical")
|
||||||
|
self.textbox = tk.Text(self, yscrollcommand = self.scrollv.set, **kwargs)
|
||||||
|
self.scrollv.config(command = self.textbox.yview)
|
||||||
|
# layout.
|
||||||
|
self.scrollv.pack(side = "right", fill = "y")
|
||||||
|
self.textbox.pack(side = "left", fill = "both", expand = True)
|
||||||
|
# create radiobuttons.
|
||||||
|
self.radiovar = tk.StringVar()
|
||||||
|
self.radiovar.set('FILE')
|
||||||
|
self.create()
|
||||||
|
|
||||||
|
def create(self):
|
||||||
|
self.rdbtns = []
|
||||||
|
for n, nameradio in enumerate(self.radios):
|
||||||
|
rdbtn = tk.Radiobutton(self, text = nameradio, value = nameradio, variable = self.radiovar,
|
||||||
|
font = self.font, indicatoron = 0, width = 15,
|
||||||
|
borderwidth = 3, selectcolor = 'yellow', command = self.change)
|
||||||
|
self.textbox.window_create("end", window = rdbtn)
|
||||||
|
# to force one checkbox per line
|
||||||
|
if n != len(self.radios) - 1:
|
||||||
|
self.textbox.insert("end", "\n")
|
||||||
|
self.rdbtns.append(rdbtn)
|
||||||
|
self.textbox.configure(state = "disabled")
|
||||||
|
|
||||||
|
def change(self):
|
||||||
|
st = self.state()
|
||||||
|
for widget, default in self.changed:
|
||||||
|
wclass = widget.winfo_class()
|
||||||
|
if st in ['STDOUT', 'FILEOFF']:
|
||||||
|
if wclass == 'Entry':
|
||||||
|
widget.delete(0, 'end')
|
||||||
|
widget.configure(state = "disabled")
|
||||||
|
elif wclass == 'TCombobox':
|
||||||
|
if st == 'STDOUT':
|
||||||
|
widget.set(default)
|
||||||
|
widget.configure(state = "readonly")
|
||||||
|
elif st == 'FILEOFF':
|
||||||
|
widget.set('')
|
||||||
|
widget.configure(state = "disabled")
|
||||||
|
elif st in ['FILE', 'FILESTDOUT', 'STDOUTOFF']:
|
||||||
|
if wclass == 'Entry':
|
||||||
|
widget.configure(state = "normal")
|
||||||
|
widget.delete(0, 'end')
|
||||||
|
widget.insert('end', default)
|
||||||
|
widget.xview_moveto(1)
|
||||||
|
elif wclass == 'TCombobox':
|
||||||
|
widget.configure(state = "readonly")
|
||||||
|
widget.set(default)
|
||||||
|
elif wclass == 'Button':
|
||||||
|
widget.configure(state = "normal")
|
||||||
|
|
||||||
|
def configure(self, state):
|
||||||
|
for rb in self.rdbtns:
|
||||||
|
rb.configure(state = state)
|
||||||
|
|
||||||
|
def state(self):
|
||||||
|
return self.radiovar.get()
|
||||||
|
|
|
@ -6,9 +6,9 @@ import logging
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
from pykms_Format import ColorExtraMap, pretty_printer
|
from pykms_Format import ColorExtraMap, ShellMessage, pretty_printer
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/2183233/how-to-add-a-custom-loglevel-to-pythons-logging-facility
|
# https://stackoverflow.com/questions/2183233/how-to-add-a-custom-loglevel-to-pythons-logging-facility
|
||||||
# https://stackoverflow.com/questions/17558552/how-do-i-add-custom-field-to-python-log-format-string
|
# https://stackoverflow.com/questions/17558552/how-do-i-add-custom-field-to-python-log-format-string
|
||||||
|
@ -86,23 +86,104 @@ class LevelFormatter(logging.Formatter):
|
||||||
formatter = self.formatters.get(record.levelno, self.default_fmt)
|
formatter = self.formatters.get(record.levelno, self.default_fmt)
|
||||||
return formatter.format(record)
|
return formatter.format(record)
|
||||||
|
|
||||||
|
# based on https://github.com/jruere/multiprocessing-logging (license LGPL-3.0)
|
||||||
|
from multiprocessing import Queue as MPQueue
|
||||||
|
try:
|
||||||
|
# Python 2.x imports
|
||||||
|
import Queue as Queue
|
||||||
|
except ImportError:
|
||||||
|
# Python 3.x imports
|
||||||
|
import queue as Queue
|
||||||
|
import threading
|
||||||
|
|
||||||
|
class MultiProcessingLogHandler(logging.Handler):
|
||||||
|
def __init__(self, name, handler = None):
|
||||||
|
super(MultiProcessingLogHandler, self).__init__()
|
||||||
|
self.queue = MPQueue(-1)
|
||||||
|
if handler is None:
|
||||||
|
handler = logging.StreamHandler()
|
||||||
|
self.handler = handler
|
||||||
|
self.name = handler.name
|
||||||
|
|
||||||
|
self.setLevel(self.handler.level)
|
||||||
|
self.setFormatter(self.handler.formatter)
|
||||||
|
self.filters = self.handler.filters
|
||||||
|
|
||||||
|
self.is_closed = False
|
||||||
|
self.receive_thread = threading.Thread(target = self.receive, name = name)
|
||||||
|
self.receive_thread.daemon = True
|
||||||
|
self.receive_thread.start()
|
||||||
|
|
||||||
|
def setFormatter(self, fmt):
|
||||||
|
super(MultiProcessingLogHandler, self).setFormatter(fmt)
|
||||||
|
self.handler.setFormatter(fmt)
|
||||||
|
|
||||||
|
def emit(self, record):
|
||||||
|
try:
|
||||||
|
if record.args:
|
||||||
|
record.msg = record.msg %record.args
|
||||||
|
record.args = None
|
||||||
|
if record.exc_info:
|
||||||
|
dummy = self.format(record)
|
||||||
|
record.exc_info = None
|
||||||
|
self.queue.put_nowait(record)
|
||||||
|
except (KeyboardInterrupt, SystemExit):
|
||||||
|
raise
|
||||||
|
except:
|
||||||
|
self.handleError(record)
|
||||||
|
|
||||||
|
def receive(self):
|
||||||
|
while not (self.is_closed and self.queue.empty()):
|
||||||
|
try:
|
||||||
|
record = self.queue.get(timeout = 0.2)
|
||||||
|
self.handler.emit(record)
|
||||||
|
except (KeyboardInterrupt, SystemExit):
|
||||||
|
raise
|
||||||
|
except EOFError:
|
||||||
|
break
|
||||||
|
except Queue.Empty:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
logging.exception('Error in log handler.')
|
||||||
|
self.queue.close()
|
||||||
|
self.queue.join_thread()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
if not self.is_closed:
|
||||||
|
self.is_closed = True
|
||||||
|
self.receive_thread.join(5.0)
|
||||||
|
self.handler.close()
|
||||||
|
super(MultiProcessingLogHandler, self).close()
|
||||||
|
|
||||||
|
|
||||||
def logger_create(log_obj, config, mode = 'a'):
|
def logger_create(log_obj, config, mode = 'a'):
|
||||||
# Create new level.
|
# Create new level.
|
||||||
add_logging_level('MINI', logging.CRITICAL + 10)
|
add_logging_level('MINI', logging.CRITICAL + 10)
|
||||||
|
log_handlers = []
|
||||||
|
|
||||||
# Configure visualization.
|
# Configure visualization.
|
||||||
log_handlers = []
|
if any(opt in ['STDOUT', 'FILESTDOUT', 'STDOUTOFF'] for opt in config['logfile']):
|
||||||
if any(i in ['STDOUT', 'FILESTDOUT'] for i in config['logfile']):
|
if any(opt in ['STDOUT', 'FILESTDOUT'] for opt in config['logfile']):
|
||||||
# (Only STDOUT) or (logfile and STDOUT)
|
# STDOUT or FILESTDOUT.
|
||||||
log_handlers.append(logging.StreamHandler(sys.stdout))
|
hand_stdout = logging.StreamHandler(sys.stdout)
|
||||||
if 'FILESTDOUT' in config['logfile']:
|
hand_stdout.name = 'LogStdout'
|
||||||
log_handlers.append(RotatingFileHandler(filename = config['logfile'][1], mode = mode, maxBytes = int(config['logsize'] * 1024 * 512),
|
log_handlers.append(hand_stdout)
|
||||||
backupCount = 1, encoding = None, delay = 0))
|
if any(opt in ['STDOUTOFF', 'FILESTDOUT'] for opt in config['logfile']):
|
||||||
|
# STDOUTOFF or FILESTDOUT.
|
||||||
|
hand_rotate = RotatingFileHandler(filename = config['logfile'][1], mode = mode, maxBytes = int(config['logsize'] * 1024 * 512),
|
||||||
|
backupCount = 1, encoding = None, delay = 0)
|
||||||
|
hand_rotate.name = 'LogRotate'
|
||||||
|
log_handlers.append(hand_rotate)
|
||||||
|
elif 'FILEOFF' in config['logfile']:
|
||||||
|
hand_null = logging.FileHandler(os.devnull)
|
||||||
|
hand_null.name = 'LogNull'
|
||||||
|
log_handlers.append(hand_null)
|
||||||
else:
|
else:
|
||||||
# Only logfile.
|
# FILE.
|
||||||
log_handlers.append(RotatingFileHandler(filename = config['logfile'][0], mode = mode, maxBytes = int(config['logsize'] * 1024 * 512),
|
hand_rotate = RotatingFileHandler(filename = config['logfile'][0], mode = mode, maxBytes = int(config['logsize'] * 1024 * 512),
|
||||||
backupCount = 1, encoding = None, delay = 0))
|
backupCount = 1, encoding = None, delay = 0)
|
||||||
|
hand_rotate.name = 'LogRotate'
|
||||||
|
log_handlers.append(hand_rotate)
|
||||||
|
|
||||||
# Configure formattation.
|
# Configure formattation.
|
||||||
try:
|
try:
|
||||||
|
@ -110,43 +191,56 @@ def logger_create(log_obj, config, mode = 'a'):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
levelnames = logging._levelNames
|
levelnames = logging._levelNames
|
||||||
levelnum = [k for k in levelnames if k != 0]
|
levelnum = [k for k in levelnames if k != 0]
|
||||||
frmt0 = '%(asctime)s %(levelname)-8s %(message)s'
|
|
||||||
frmt1 = '[%(asctime)s] [%(levelname)-8s] %(host)s %(status)s %(product)s %(message)s'
|
|
||||||
levelformdict = {}
|
|
||||||
for num in levelnum:
|
|
||||||
if num != logging.CRITICAL + 10:
|
|
||||||
levelformdict[num] = frmt0
|
|
||||||
else:
|
|
||||||
levelformdict[num] = frmt1
|
|
||||||
|
|
||||||
# Set level and format.
|
frmt_gen = '%(asctime)s %(levelname)-8s %(message)s'
|
||||||
levelformdictcopy = levelformdict.copy()
|
frmt_std = '%(name)s %(asctime)s %(levelname)-8s %(message)s'
|
||||||
|
frmt_min = '[%(asctime)s] [%(levelname)-8s] %(host)s %(status)s %(product)s %(message)s'
|
||||||
|
|
||||||
|
def apply_formatter(levelnum, formats, handler, color = False):
|
||||||
|
levelformdict = {}
|
||||||
|
for num in levelnum:
|
||||||
|
if num != logging.CRITICAL + 10:
|
||||||
|
levelformdict[num] = formats[0]
|
||||||
|
else:
|
||||||
|
levelformdict[num] = formats[1]
|
||||||
|
handler.setFormatter(LevelFormatter(levelformdict, color = color))
|
||||||
|
return handler
|
||||||
|
|
||||||
|
# Clear old handlers.
|
||||||
|
if log_obj.handlers:
|
||||||
|
log_obj.handlers = []
|
||||||
|
|
||||||
for log_handler in log_handlers:
|
for log_handler in log_handlers:
|
||||||
log_handler.setLevel(config['loglevel'])
|
log_handler.setLevel(config['loglevel'])
|
||||||
if log_handler.__class__.__name__ == 'StreamHandler':
|
if log_handler.name in ['LogStdout']:
|
||||||
log_handler.setFormatter(LevelFormatter(levelformdict, color = True))
|
log_handler = apply_formatter(levelnum, (frmt_std, frmt_min), log_handler, color = True)
|
||||||
elif log_handler.__class__.__name__ == 'RotatingFileHandler':
|
elif log_handler.name in ['LogRotate']:
|
||||||
log_handler.setFormatter(LevelFormatter(levelformdictcopy, color = False))
|
log_handler = apply_formatter(levelnum, (frmt_gen, frmt_min), log_handler)
|
||||||
|
# Attach.
|
||||||
|
if config['asyncmsg']:
|
||||||
|
log_obj.addHandler(MultiProcessingLogHandler('Thread-AsyncMsg{0}'.format(log_handler.name), handler = log_handler))
|
||||||
|
else:
|
||||||
|
log_obj.addHandler(log_handler)
|
||||||
|
|
||||||
# Attach.
|
|
||||||
log_obj.setLevel(config['loglevel'])
|
log_obj.setLevel(config['loglevel'])
|
||||||
[ log_obj.addHandler(log_handler) for log_handler in log_handlers ]
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def check_logfile(optionlog, defaultlog, where):
|
def check_logfile(optionlog, defaultlog, where):
|
||||||
if not isinstance(optionlog, list):
|
if not isinstance(optionlog, list):
|
||||||
optionlog = [optionlog]
|
optionlog = [optionlog]
|
||||||
|
|
||||||
lenopt = len(optionlog)
|
lenopt = len(optionlog)
|
||||||
msg_dir = "{reverse}{red}{bold}argument logfile: invalid directory: '%s'. Exiting...{end}"
|
msg_dir = "{reverse}{red}{bold}argument `-F/--logfile`: invalid directory: '%s'. Exiting...{end}"
|
||||||
msg_long = "{reverse}{red}{bold}argument logfile: too much arguments. Exiting...{end}"
|
msg_long = "{reverse}{red}{bold}argument `-F/--logfile`: too much arguments. Exiting...{end}"
|
||||||
msg_log = "{reverse}{red}{bold}argument logfile: not a log file, invalid extension: '%s'. Exiting...{end}"
|
msg_log = "{reverse}{red}{bold}argument `-F/--logfile`: not a log file, invalid extension: '%s'. Exiting...{end}"
|
||||||
|
|
||||||
def checkdir(path):
|
def checkdir(path):
|
||||||
filename = os.path.basename(path)
|
filename = os.path.basename(path)
|
||||||
pathname = os.path.dirname(path)
|
pathname = os.path.dirname(path)
|
||||||
if not os.path.isdir(pathname):
|
if not os.path.isdir(pathname):
|
||||||
|
if path.count('/') == 0:
|
||||||
|
pathname = filename
|
||||||
pretty_printer(put_text = msg_dir %pathname, where = where, to_exit = True)
|
pretty_printer(put_text = msg_dir %pathname, where = where, to_exit = True)
|
||||||
elif not filename.lower().endswith('.log'):
|
elif not filename.lower().endswith('.log'):
|
||||||
pretty_printer(put_text = msg_log %filename, where = where, to_exit = True)
|
pretty_printer(put_text = msg_log %filename, where = where, to_exit = True)
|
||||||
|
@ -154,7 +248,7 @@ def check_logfile(optionlog, defaultlog, where):
|
||||||
if lenopt > 2:
|
if lenopt > 2:
|
||||||
pretty_printer(put_text = msg_long, where = where, to_exit = True)
|
pretty_printer(put_text = msg_long, where = where, to_exit = True)
|
||||||
|
|
||||||
if 'FILESTDOUT' in optionlog:
|
if (any(opt in ['FILESTDOUT', 'STDOUTOFF'] for opt in optionlog)):
|
||||||
if lenopt == 1:
|
if lenopt == 1:
|
||||||
# add default logfile.
|
# add default logfile.
|
||||||
optionlog.append(defaultlog)
|
optionlog.append(defaultlog)
|
||||||
|
@ -164,12 +258,13 @@ def check_logfile(optionlog, defaultlog, where):
|
||||||
else:
|
else:
|
||||||
if lenopt == 2:
|
if lenopt == 2:
|
||||||
pretty_printer(put_text = msg_long, where = where, to_exit = True)
|
pretty_printer(put_text = msg_long, where = where, to_exit = True)
|
||||||
elif lenopt == 1 and 'STDOUT' not in optionlog:
|
elif lenopt == 1 and (any(opt not in ['STDOUT', 'FILEOFF'] for opt in optionlog)):
|
||||||
# check directory path.
|
# check directory path.
|
||||||
checkdir(optionlog[0])
|
checkdir(optionlog[0])
|
||||||
|
|
||||||
return optionlog
|
return optionlog
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Valid language identifiers to be used in the EPID (see "kms.c" in vlmcsd)
|
# Valid language identifiers to be used in the EPID (see "kms.c" in vlmcsd)
|
||||||
ValidLcid = [1025, 1026, 1027, 1028, 1029,
|
ValidLcid = [1025, 1026, 1027, 1028, 1029,
|
||||||
|
@ -208,21 +303,20 @@ def check_lcid(lcid, log_obj):
|
||||||
fixlcid = next(k for k, v in locale.windows_locale.items() if v == locale.getdefaultlocale()[0])
|
fixlcid = next(k for k, v in locale.windows_locale.items() if v == locale.getdefaultlocale()[0])
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
fixlcid = 1033
|
fixlcid = 1033
|
||||||
pretty_printer(log_obj = log_obj,
|
pretty_printer(log_obj = log_obj, put_text = "{reverse}{yellow}{bold}LCID '%s' auto-fixed with LCID '%s'{end}" %(lcid, fixlcid))
|
||||||
put_text = "{reverse}{yellow}{bold}LCID %s auto-fixed with LCID %s{end}" %(lcid, fixlcid))
|
|
||||||
return fixlcid
|
return fixlcid
|
||||||
return lcid
|
return lcid
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class KmsException(Exception):
|
class KmsParserException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class KmsParser(argparse.ArgumentParser):
|
class KmsParser(argparse.ArgumentParser):
|
||||||
def error(self, message):
|
def error(self, message):
|
||||||
raise KmsException(message)
|
raise KmsParserException(message)
|
||||||
|
|
||||||
class KmsHelper(object):
|
class KmsParserHelp(object):
|
||||||
def replace(self, parser, replace_epilog_with):
|
def replace(self, parser, replace_epilog_with):
|
||||||
text = parser.format_help().splitlines()
|
text = parser.format_help().splitlines()
|
||||||
help_list = []
|
help_list = []
|
||||||
|
@ -255,7 +349,126 @@ class KmsHelper(object):
|
||||||
print(parser_base.epilog + '\n')
|
print(parser_base.epilog + '\n')
|
||||||
parser_base.exit()
|
parser_base.exit()
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------------------------------------------------------------------
|
def kms_parser_get(parser):
|
||||||
|
zeroarg, onearg = ([] for _ in range(2))
|
||||||
|
act = vars(parser)['_actions']
|
||||||
|
for i in range(len(act)):
|
||||||
|
if act[i].option_strings not in ([], ['-h', '--help']):
|
||||||
|
if isinstance(act[i], argparse._StoreAction):
|
||||||
|
onearg.append(act[i].option_strings)
|
||||||
|
else:
|
||||||
|
zeroarg.append(act[i].option_strings)
|
||||||
|
return zeroarg, onearg
|
||||||
|
|
||||||
|
def kms_parser_check_optionals(userarg, zeroarg, onearg, msg = 'optional py-kms server', exclude_opt_len = []):
|
||||||
|
"""
|
||||||
|
For optionals arguments:
|
||||||
|
Don't allow duplicates,
|
||||||
|
Don't allow abbreviations,
|
||||||
|
Don't allow joining and not existing arguments,
|
||||||
|
Checks length values passed to arguments.
|
||||||
|
"""
|
||||||
|
zeroarg = [item for sublist in zeroarg for item in sublist]
|
||||||
|
onearg = [item for sublist in onearg for item in sublist]
|
||||||
|
allarg = zeroarg + onearg
|
||||||
|
|
||||||
|
def is_abbrev(allarg, arg_to_check):
|
||||||
|
for opt in allarg:
|
||||||
|
if len(opt) > 2 and opt[2] == arg_to_check[2]:
|
||||||
|
for indx in range(-1, -len(opt), -1):
|
||||||
|
if opt[:indx] == arg_to_check:
|
||||||
|
raise KmsParserException("%s argument `%s` abbreviation not allowed for `%s`" %(msg, arg_to_check, opt))
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Check abbreviations, joining, not existing.
|
||||||
|
for arg in userarg:
|
||||||
|
if arg not in allarg:
|
||||||
|
if arg.startswith('-'):
|
||||||
|
if arg == '--' or arg[:2] != '--' or not is_abbrev(allarg, arg):
|
||||||
|
raise KmsParserException("unrecognized %s arguments: `%s`" %(msg, arg))
|
||||||
|
|
||||||
|
# Check duplicates.
|
||||||
|
founds = [i for i in userarg if i in allarg]
|
||||||
|
dup = [item for item in set(founds) if founds.count(item) > 1]
|
||||||
|
if dup != []:
|
||||||
|
raise KmsParserException("%s argument `%s` appears several times" %(msg, ', '.join(dup)))
|
||||||
|
|
||||||
|
# Check length.
|
||||||
|
elem = None
|
||||||
|
for found in founds:
|
||||||
|
if found not in exclude_opt_len:
|
||||||
|
pos = userarg.index(found)
|
||||||
|
try:
|
||||||
|
if found in zeroarg:
|
||||||
|
elem = userarg[pos + 1]
|
||||||
|
num = "zero arguments,"
|
||||||
|
elif found in onearg:
|
||||||
|
elem = userarg[pos + 2]
|
||||||
|
num = "one argument,"
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if elem and elem not in allarg:
|
||||||
|
raise KmsParserException("%s argument `" %msg + found + "`:" + " expected " + num + " unrecognized: '%s'" %elem)
|
||||||
|
|
||||||
|
def kms_parser_check_positionals(config, parse_method, arguments = None, msg = 'positional py-kms server'):
|
||||||
|
try:
|
||||||
|
if arguments:
|
||||||
|
config.update(vars(parse_method(arguments)))
|
||||||
|
else:
|
||||||
|
config.update(vars(parse_method()))
|
||||||
|
except KmsParserException as e:
|
||||||
|
e = str(e)
|
||||||
|
if e.startswith('argument'):
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
raise KmsParserException("unrecognized %s arguments: '%s'" %(msg, e.split(': ')[1]))
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
def proper_none(dictionary):
|
||||||
|
for key in dictionary.keys():
|
||||||
|
dictionary[key] = None if dictionary[key] == 'None' else dictionary[key]
|
||||||
|
|
||||||
|
def check_setup(config, options, logger, where):
|
||||||
|
# 'None'--> None.
|
||||||
|
proper_none(config)
|
||||||
|
|
||||||
|
# Check logfile.
|
||||||
|
config['logfile'] = check_logfile(config['logfile'], options['lfile']['def'], where = where)
|
||||||
|
|
||||||
|
# Check logsize (py-kms Gui).
|
||||||
|
if config['logsize'] == "":
|
||||||
|
if any(opt in ['STDOUT', 'FILEOFF'] for opt in config['logfile']):
|
||||||
|
# set a recognized size never used.
|
||||||
|
config['logsize'] = 0
|
||||||
|
else:
|
||||||
|
pretty_printer(put_text = "{reverse}{red}{bold}argument `-S/--logsize`: invalid with: '%s'. Exiting...{end}" %config['logsize'],
|
||||||
|
where = where, to_exit = True)
|
||||||
|
|
||||||
|
# Check loglevel (py-kms Gui).
|
||||||
|
if config['loglevel'] == "":
|
||||||
|
# set a recognized level never used.
|
||||||
|
config['loglevel'] = 'ERROR'
|
||||||
|
|
||||||
|
# Setup hidden / asynchronous messages.
|
||||||
|
hidden = ['STDOUT', 'FILESTDOUT', 'STDOUTOFF']
|
||||||
|
view_flag = (False if any(opt in hidden for opt in config['logfile']) else True)
|
||||||
|
if where == 'srv':
|
||||||
|
ShellMessage.viewsrv = view_flag
|
||||||
|
ShellMessage.asyncmsgsrv = config['asyncmsg']
|
||||||
|
elif where == 'clt':
|
||||||
|
ShellMessage.viewclt = view_flag
|
||||||
|
ShellMessage.asyncmsgclt = config['asyncmsg']
|
||||||
|
|
||||||
|
# Create log.
|
||||||
|
logger_create(logger, config, mode = 'a')
|
||||||
|
|
||||||
|
# Check port.
|
||||||
|
if (config['port'] == "") or (not 1 <= config['port'] <= 65535):
|
||||||
|
pretty_printer(log_obj = logger.error, where = where, to_exit = True,
|
||||||
|
put_text = "{reverse}{red}{bold}Port number '%s' is invalid. Enter between 1 - 65535. Exiting...{end}" %config['port'])
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# http://joshpoley.blogspot.com/2011/09/hresults-user-0x004.html (slerror.h)
|
# http://joshpoley.blogspot.com/2011/09/hresults-user-0x004.html (slerror.h)
|
||||||
ErrorCodes = {
|
ErrorCodes = {
|
||||||
|
|
|
@ -27,12 +27,13 @@ except ImportError:
|
||||||
import pykms_RpcBind, pykms_RpcRequest
|
import pykms_RpcBind, pykms_RpcRequest
|
||||||
from pykms_RpcBase import rpcBase
|
from pykms_RpcBase import rpcBase
|
||||||
from pykms_Dcerpc import MSRPCHeader
|
from pykms_Dcerpc import MSRPCHeader
|
||||||
from pykms_Misc import logger_create, check_logfile, check_lcid
|
from pykms_Misc import check_setup, check_lcid
|
||||||
from pykms_Misc import KmsParser, KmsException, KmsHelper
|
from pykms_Misc import KmsParser, KmsParserException, KmsParserHelp
|
||||||
from pykms_Format import enco, deco, ShellMessage, pretty_printer
|
from pykms_Misc import kms_parser_get, kms_parser_check_optionals, kms_parser_check_positionals
|
||||||
|
from pykms_Format import enco, deco, pretty_printer
|
||||||
from Etrigan import Etrigan, Etrigan_parser, Etrigan_check, Etrigan_job
|
from Etrigan import Etrigan, Etrigan_parser, Etrigan_check, Etrigan_job
|
||||||
|
|
||||||
srv_version = "py-kms_2020-02-02"
|
srv_version = "py-kms_2020-07-01"
|
||||||
__license__ = "The Unlicense"
|
__license__ = "The Unlicense"
|
||||||
__author__ = u"Matteo ℱan <SystemRage@protonmail.com>"
|
__author__ = u"Matteo ℱan <SystemRage@protonmail.com>"
|
||||||
__url__ = "https://github.com/SystemRage/py-kms"
|
__url__ = "https://github.com/SystemRage/py-kms"
|
||||||
|
@ -148,12 +149,15 @@ class server_thread(threading.Thread):
|
||||||
# Create and run server.
|
# Create and run server.
|
||||||
self.server = server_create()
|
self.server = server_create()
|
||||||
self.server.pykms_serve()
|
self.server.pykms_serve()
|
||||||
except SystemExit as e:
|
except (SystemExit, Exception) as e:
|
||||||
self.eject = True
|
self.eject = True
|
||||||
if not self.with_gui:
|
if not self.with_gui:
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
continue
|
if isinstance(e, SystemExit):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
##---------------------------------------------------------------------------------------------------------------------------------------------------------
|
##---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -168,30 +172,30 @@ srv_options = {
|
||||||
'lcid' : {'help' : 'Use this option to manually specify an LCID for use with randomly generated ePIDs. Default is \"1033\" (en-us)',
|
'lcid' : {'help' : 'Use this option to manually specify an LCID for use with randomly generated ePIDs. Default is \"1033\" (en-us)',
|
||||||
'def' : 1033, 'des' : "lcid"},
|
'def' : 1033, 'des' : "lcid"},
|
||||||
'count' : {'help' : 'Use this option to specify the current client count. A number >=25 is required to enable activation of client OSes; \
|
'count' : {'help' : 'Use this option to specify the current client count. A number >=25 is required to enable activation of client OSes; \
|
||||||
for server OSes and Office >=5', 'def' : None, 'des' : "CurrentClientCount"},
|
for server OSes and Office >=5', 'def' : None, 'des' : "clientcount"},
|
||||||
'activation' : {'help' : 'Use this option to specify the activation interval (in minutes). Default is \"120\" minutes (2 hours).',
|
'activation' : {'help' : 'Use this option to specify the activation interval (in minutes). Default is \"120\" minutes (2 hours).',
|
||||||
'def' : 120, 'des': "VLActivationInterval"},
|
'def' : 120, 'des': "activation"},
|
||||||
'renewal' : {'help' : 'Use this option to specify the renewal interval (in minutes). Default is \"10080\" minutes (7 days).',
|
'renewal' : {'help' : 'Use this option to specify the renewal interval (in minutes). Default is \"10080\" minutes (7 days).',
|
||||||
'def' : 1440 * 7, 'des' : "VLRenewalInterval"},
|
'def' : 1440 * 7, 'des' : "renewal"},
|
||||||
'sql' : {'help' : 'Use this option to store request information from unique clients in an SQLite database. Desactivated by default.',
|
'sql' : {'help' : 'Use this option to store request information from unique clients in an SQLite database. Desactivated by default.',
|
||||||
'def' : False, 'des' : "sqlite"},
|
'def' : False, 'des' : "sqlite"},
|
||||||
'hwid' : {'help' : 'Use this option to specify a HWID. The HWID must be an 16-character string of hex characters. \
|
'hwid' : {'help' : 'Use this option to specify a HWID. The HWID must be an 16-character string of hex characters. \
|
||||||
The default is \"364F463A8863D35F\" or type \"RANDOM\" to auto generate the HWID.', 'def' : "364F463A8863D35F", 'des' : "hwid"},
|
The default is \"364F463A8863D35F\" or type \"RANDOM\" to auto generate the HWID.', 'def' : "364F463A8863D35F", 'des' : "hwid"},
|
||||||
'time' : {'help' : 'Max time (in seconds) for server to generate an answer. If \"None\" (default) serve forever.', 'def' : None, 'des' : "timeout"},
|
'time0' : {'help' : 'Maximum inactivity time (in seconds) after which the connection with the client is closed. If \"None\" (default) serve forever.',
|
||||||
|
'def' : None, 'des' : "timeoutidle"},
|
||||||
|
'asyncmsg' : {'help' : 'Prints pretty / logging messages asynchronously. Desactivated by default.',
|
||||||
|
'def' : False, 'des' : "asyncmsg"},
|
||||||
'llevel' : {'help' : 'Use this option to set a log level. The default is \"ERROR\".', 'def' : "ERROR", 'des' : "loglevel",
|
'llevel' : {'help' : 'Use this option to set a log level. The default is \"ERROR\".', 'def' : "ERROR", 'des' : "loglevel",
|
||||||
'choi' : ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "MINI"]},
|
'choi' : ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "MINI"]},
|
||||||
'lfile' : {'help' : 'Use this option to set an output log file. The default is \"pykms_logserver.log\". Type \"STDOUT\" to view \
|
'lfile' : {'help' : 'Use this option to set an output log file. The default is \"pykms_logserver.log\". \
|
||||||
log info on stdout. Type \"FILESTDOUT\" to combine previous actions.',
|
Type \"STDOUT\" to view log info on stdout. Type \"FILESTDOUT\" to combine previous actions. \
|
||||||
|
Use \"STDOUTOFF\" to disable stdout messages. Use \"FILEOFF\" if you not want to create logfile.',
|
||||||
'def' : os.path.join('.', 'pykms_logserver.log'), 'des' : "logfile"},
|
'def' : os.path.join('.', 'pykms_logserver.log'), 'des' : "logfile"},
|
||||||
'lsize' : {'help' : 'Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.', 'def' : 0, 'des': "logsize"},
|
'lsize' : {'help' : 'Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.', 'def' : 0, 'des': "logsize"},
|
||||||
}
|
}
|
||||||
|
|
||||||
def server_options():
|
def server_options():
|
||||||
try:
|
server_parser = KmsParser(description = srv_description, epilog = 'version: ' + srv_version, add_help = False)
|
||||||
server_parser = KmsParser(description = srv_description, epilog = 'version: ' + srv_version, add_help = False, allow_abbrev = False)
|
|
||||||
except TypeError:
|
|
||||||
server_parser = KmsParser(description = srv_description, epilog = 'version: ' + srv_version, add_help = False)
|
|
||||||
|
|
||||||
server_parser.add_argument("ip", nargs = "?", action = "store", default = srv_options['ip']['def'], help = srv_options['ip']['help'], type = str)
|
server_parser.add_argument("ip", nargs = "?", action = "store", default = srv_options['ip']['def'], help = srv_options['ip']['help'], type = str)
|
||||||
server_parser.add_argument("port", nargs = "?", action = "store", default = srv_options['port']['def'], help = srv_options['port']['help'], type = int)
|
server_parser.add_argument("port", nargs = "?", action = "store", default = srv_options['port']['def'], help = srv_options['port']['help'], type = int)
|
||||||
server_parser.add_argument("-e", "--epid", action = "store", dest = srv_options['epid']['des'], default = srv_options['epid']['def'],
|
server_parser.add_argument("-e", "--epid", action = "store", dest = srv_options['epid']['des'], default = srv_options['epid']['def'],
|
||||||
|
@ -199,88 +203,117 @@ def server_options():
|
||||||
server_parser.add_argument("-l", "--lcid", action = "store", dest = srv_options['lcid']['des'], default = srv_options['lcid']['def'],
|
server_parser.add_argument("-l", "--lcid", action = "store", dest = srv_options['lcid']['des'], default = srv_options['lcid']['def'],
|
||||||
help = srv_options['lcid']['help'], type = int)
|
help = srv_options['lcid']['help'], type = int)
|
||||||
server_parser.add_argument("-c", "--client-count", action = "store", dest = srv_options['count']['des'] , default = srv_options['count']['def'],
|
server_parser.add_argument("-c", "--client-count", action = "store", dest = srv_options['count']['des'] , default = srv_options['count']['def'],
|
||||||
help = srv_options['count']['help'], type = int)
|
help = srv_options['count']['help'], type = str)
|
||||||
server_parser.add_argument("-a", "--activation-interval", action = "store", dest = srv_options['activation']['des'],
|
server_parser.add_argument("-a", "--activation-interval", action = "store", dest = srv_options['activation']['des'],
|
||||||
default = srv_options['activation']['def'], help = srv_options['activation']['help'], type = int)
|
default = srv_options['activation']['def'], help = srv_options['activation']['help'], type = int)
|
||||||
server_parser.add_argument("-r", "--renewal-interval", action = "store", dest = srv_options['renewal']['des'], default = srv_options['renewal']['def'],
|
server_parser.add_argument("-r", "--renewal-interval", action = "store", dest = srv_options['renewal']['des'],
|
||||||
help = srv_options['renewal']['help'], type = int)
|
default = srv_options['renewal']['def'], help = srv_options['renewal']['help'], type = int)
|
||||||
server_parser.add_argument("-s", "--sqlite", action = "store_const", dest = srv_options['sql']['des'], const = True, default = srv_options['sql']['def'],
|
server_parser.add_argument("-s", "--sqlite", action = "store_true", dest = srv_options['sql']['des'],
|
||||||
help = srv_options['sql']['help'])
|
default = srv_options['sql']['def'], help = srv_options['sql']['help'])
|
||||||
server_parser.add_argument("-w", "--hwid", action = "store", dest = srv_options['hwid']['des'], default = srv_options['hwid']['def'],
|
server_parser.add_argument("-w", "--hwid", action = "store", dest = srv_options['hwid']['des'], default = srv_options['hwid']['def'],
|
||||||
help = srv_options['hwid']['help'], type = str)
|
help = srv_options['hwid']['help'], type = str)
|
||||||
server_parser.add_argument("-t", "--timeout", action = "store", dest = srv_options['time']['des'], default = srv_options['time']['def'],
|
server_parser.add_argument("-t0", "--timeout-idle", action = "store", dest = srv_options['time0']['des'], default = srv_options['time0']['def'],
|
||||||
help = srv_options['time']['help'], type = int)
|
help = srv_options['time0']['help'], type = str)
|
||||||
|
server_parser.add_argument("-y", "--async-msg", action = "store_true", dest = srv_options['asyncmsg']['des'],
|
||||||
|
default = srv_options['asyncmsg']['def'], help = srv_options['asyncmsg']['help'])
|
||||||
server_parser.add_argument("-V", "--loglevel", action = "store", dest = srv_options['llevel']['des'], choices = srv_options['llevel']['choi'],
|
server_parser.add_argument("-V", "--loglevel", action = "store", dest = srv_options['llevel']['des'], choices = srv_options['llevel']['choi'],
|
||||||
default = srv_options['llevel']['def'], help = srv_options['llevel']['help'], type = str)
|
default = srv_options['llevel']['def'], help = srv_options['llevel']['help'], type = str)
|
||||||
server_parser.add_argument("-F", "--logfile", nargs = "+", action = "store", dest = srv_options['lfile']['des'], default = srv_options['lfile']['def'],
|
server_parser.add_argument("-F", "--logfile", nargs = "+", action = "store", dest = srv_options['lfile']['des'],
|
||||||
help = srv_options['lfile']['help'], type = str)
|
default = srv_options['lfile']['def'], help = srv_options['lfile']['help'], type = str)
|
||||||
server_parser.add_argument("-S", "--logsize", action = "store", dest = srv_options['lsize']['des'], default = srv_options['lsize']['def'],
|
server_parser.add_argument("-S", "--logsize", action = "store", dest = srv_options['lsize']['des'], default = srv_options['lsize']['def'],
|
||||||
help = srv_options['lsize']['help'], type = float)
|
help = srv_options['lsize']['help'], type = float)
|
||||||
|
|
||||||
server_parser.add_argument("-h", "--help", action = "help", help = "show this help message and exit")
|
server_parser.add_argument("-h", "--help", action = "help", help = "show this help message and exit")
|
||||||
|
|
||||||
try:
|
daemon_parser = KmsParser(description = "daemon options inherited from Etrigan", add_help = False)
|
||||||
daemon_parser = KmsParser(description = "daemon options inherited from Etrigan", add_help = False, allow_abbrev = False)
|
|
||||||
except TypeError:
|
|
||||||
daemon_parser = KmsParser(description = "daemon options inherited from Etrigan", add_help = False)
|
|
||||||
|
|
||||||
daemon_subparser = daemon_parser.add_subparsers(dest = "mode")
|
daemon_subparser = daemon_parser.add_subparsers(dest = "mode")
|
||||||
try:
|
|
||||||
etrigan_parser = daemon_subparser.add_parser("etrigan", add_help = False, allow_abbrev = False)
|
etrigan_parser = daemon_subparser.add_parser("etrigan", add_help = False)
|
||||||
except TypeError:
|
|
||||||
etrigan_parser = daemon_subparser.add_parser("etrigan", add_help = False)
|
|
||||||
etrigan_parser.add_argument("-g", "--gui", action = "store_const", dest = 'gui', const = True, default = False,
|
etrigan_parser.add_argument("-g", "--gui", action = "store_const", dest = 'gui', const = True, default = False,
|
||||||
help = "Enable py-kms GUI usage.")
|
help = "Enable py-kms GUI usage.")
|
||||||
etrigan_parser = Etrigan_parser(parser = etrigan_parser)
|
etrigan_parser = Etrigan_parser(parser = etrigan_parser)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "-h" in sys.argv[1:]:
|
userarg = sys.argv[1:]
|
||||||
KmsHelper().printer(parsers = [server_parser, daemon_parser, etrigan_parser])
|
|
||||||
|
# Run help.
|
||||||
|
if any(arg in ["-h", "--help"] for arg in userarg):
|
||||||
|
KmsParserHelp().printer(parsers = [server_parser, daemon_parser, etrigan_parser])
|
||||||
|
|
||||||
|
# Get stored arguments.
|
||||||
|
pykmssrv_zeroarg, pykmssrv_onearg = kms_parser_get(server_parser)
|
||||||
|
etrigan_zeroarg, etrigan_onearg = kms_parser_get(etrigan_parser)
|
||||||
|
pykmssrv_zeroarg += ['etrigan'] # add subparser
|
||||||
|
|
||||||
# Set defaults for config.
|
# Set defaults for config.
|
||||||
# case: python3 pykms_Server.py
|
# example case:
|
||||||
|
# python3 pykms_Server.py
|
||||||
srv_config.update(vars(server_parser.parse_args([])))
|
srv_config.update(vars(server_parser.parse_args([])))
|
||||||
# Eventually set daemon values for config.
|
|
||||||
if 'etrigan' in sys.argv[1:]:
|
|
||||||
if 'etrigan' == sys.argv[1]:
|
|
||||||
# case: python3 pykms_Server.py etrigan start --daemon_optionals
|
|
||||||
srv_config.update(vars(daemon_parser.parse_args(sys.argv[1:])))
|
|
||||||
elif 'etrigan' == sys.argv[2]:
|
|
||||||
# case: python3 pykms_Server.py 1.2.3.4 etrigan start --daemon_optionals
|
|
||||||
srv_config['ip'] = sys.argv[1]
|
|
||||||
srv_config.update(vars(daemon_parser.parse_args(sys.argv[2:])))
|
|
||||||
else:
|
|
||||||
# case: python3 pykms_Server.py 1.2.3.4 1234 --main_optionals etrigan start --daemon_optionals
|
|
||||||
knw_args, knw_extras = server_parser.parse_known_args()
|
|
||||||
# fix for logfile option (at the end) that catchs etrigan parser options.
|
|
||||||
if 'etrigan' in knw_args.logfile:
|
|
||||||
indx = knw_args.logfile.index('etrigan')
|
|
||||||
for num, elem in enumerate(knw_args.logfile[indx:]):
|
|
||||||
knw_extras.insert(num, elem)
|
|
||||||
knw_args.logfile = knw_args.logfile[:indx]
|
|
||||||
|
|
||||||
# continue parsing.
|
try:
|
||||||
if len(knw_extras) > 0 and knw_extras[0] in ['etrigan']:
|
# Eventually set daemon options for dict server config.
|
||||||
daemon_parser.parse_args(knw_extras, namespace = knw_args)
|
pos = sys.argv[1:].index('etrigan')
|
||||||
srv_config.update(vars(knw_args))
|
# example cases:
|
||||||
else:
|
# python3 pykms_Server.py etrigan start
|
||||||
# Update dict config.
|
# python3 pykms_Server.py etrigan start --daemon_optionals
|
||||||
# case: python3 pykms_Server.py 1.2.3.4 1234 --main_optionals
|
# python3 pykms_Server.py 1.2.3.4 etrigan start
|
||||||
knw_args, knw_extras = server_parser.parse_known_args()
|
# python3 pykms_Server.py 1.2.3.4 etrigan start --daemon_optionals
|
||||||
if knw_extras != []:
|
# python3 pykms_Server.py 1.2.3.4 1234 etrigan start
|
||||||
raise KmsException("unrecognized arguments: %s" %' '.join(knw_extras))
|
# python3 pykms_Server.py 1.2.3.4 1234 etrigan start --daemon_optionals
|
||||||
else:
|
# python3 pykms_Server.py --pykms_optionals etrigan start
|
||||||
srv_config.update(vars(knw_args))
|
# python3 pykms_Server.py --pykms_optionals etrigan start --daemon_optionals
|
||||||
|
# python3 pykms_Server.py 1.2.3.4 --pykms_optionals etrigan start
|
||||||
|
# python3 pykms_Server.py 1.2.3.4 --pykms_optionals etrigan start --daemon_optionals
|
||||||
|
# python3 pykms_Server.py 1.2.3.4 1234 --pykms_optionals etrigan start
|
||||||
|
# python3 pykms_Server.py 1.2.3.4 1234 --pykms_optionals etrigan start --daemon_optionals
|
||||||
|
|
||||||
except KmsException as e:
|
kms_parser_check_optionals(userarg[0:pos], pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = ['-F', '--logfile'])
|
||||||
|
kms_parser_check_positionals(srv_config, server_parser.parse_args, arguments = userarg[0:pos])
|
||||||
|
kms_parser_check_optionals(userarg[pos:], etrigan_zeroarg, etrigan_onearg, msg = 'optional etrigan')
|
||||||
|
kms_parser_check_positionals(srv_config, daemon_parser.parse_args, arguments = userarg[pos:], msg = 'positional etrigan')
|
||||||
|
|
||||||
|
except ValueError:
|
||||||
|
# Update pykms options for dict server config.
|
||||||
|
# example cases:
|
||||||
|
# python3 pykms_Server.py 1.2.3.4
|
||||||
|
# python3 pykms_Server.py 1.2.3.4 --pykms_optionals
|
||||||
|
# python3 pykms_Server.py 1.2.3.4 1234
|
||||||
|
# python3 pykms_Server.py 1.2.3.4 1234 --pykms_optionals
|
||||||
|
# python3 pykms_Server.py --pykms_optionals
|
||||||
|
|
||||||
|
kms_parser_check_optionals(userarg, pykmssrv_zeroarg, pykmssrv_onearg, exclude_opt_len = ['-F', '--logfile'])
|
||||||
|
kms_parser_check_positionals(srv_config, server_parser.parse_args)
|
||||||
|
|
||||||
|
except KmsParserException as e:
|
||||||
pretty_printer(put_text = "{reverse}{red}{bold}%s. Exiting...{end}" %str(e), to_exit = True)
|
pretty_printer(put_text = "{reverse}{red}{bold}%s. Exiting...{end}" %str(e), to_exit = True)
|
||||||
|
|
||||||
|
|
||||||
|
class Etrigan_Check(Etrigan_check):
|
||||||
|
def emit_opt_err(self, msg):
|
||||||
|
pretty_printer(put_text = "{reverse}{red}{bold}%s{end}" %msg, to_exit = True)
|
||||||
|
|
||||||
|
class Etrigan(Etrigan):
|
||||||
|
def emit_message(self, message, to_exit = False):
|
||||||
|
if not self.mute:
|
||||||
|
pretty_printer(put_text = "{reverse}{green}{bold}%s{end}" %message)
|
||||||
|
if to_exit:
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
def emit_error(self, message, to_exit = True):
|
||||||
|
if not self.mute:
|
||||||
|
pretty_printer(put_text = "{reverse}{red}{bold}%s{end}" %message, to_exit = True)
|
||||||
|
|
||||||
def server_daemon():
|
def server_daemon():
|
||||||
if 'etrigan' in srv_config.values():
|
if 'etrigan' in srv_config.values():
|
||||||
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pykms_config.pickle')
|
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pykms_config.pickle')
|
||||||
|
|
||||||
if srv_config['operation'] in ['stop', 'restart', 'status'] and len(sys.argv[1:]) > 2:
|
if srv_config['operation'] in ['stop', 'restart', 'status'] and len(sys.argv[1:]) > 2:
|
||||||
pretty_printer(put_text = "{reverse}{red}{bold}too much arguments. Exiting...{end}", to_exit = True)
|
pretty_printer(put_text = "{reverse}{red}{bold}too much arguments with etrigan '%s'. Exiting...{end}" %srv_config['operation'],
|
||||||
|
to_exit = True)
|
||||||
|
|
||||||
|
# Check file arguments.
|
||||||
|
Etrigan_Check().checkfile(srv_config['etriganpid'], '--etrigan-pid', '.pid')
|
||||||
|
Etrigan_Check().checkfile(srv_config['etriganlog'], '--etrigan-log', '.log')
|
||||||
|
|
||||||
if srv_config['gui']:
|
if srv_config['gui']:
|
||||||
pass
|
pass
|
||||||
|
@ -311,14 +344,8 @@ def server_daemon():
|
||||||
Etrigan_job(srv_config['operation'], serverdaemon)
|
Etrigan_job(srv_config['operation'], serverdaemon)
|
||||||
|
|
||||||
def server_check():
|
def server_check():
|
||||||
# Check logfile.
|
# Setup and some checks.
|
||||||
srv_config['logfile'] = check_logfile(srv_config['logfile'], srv_options['lfile']['def'], where = "srv")
|
check_setup(srv_config, srv_options, loggersrv, where = "srv")
|
||||||
|
|
||||||
# Setup hidden or not messages.
|
|
||||||
ShellMessage.view = ( False if any(i in ['STDOUT', 'FILESTDOUT'] for i in srv_config['logfile']) else True )
|
|
||||||
|
|
||||||
# Create log.
|
|
||||||
logger_create(loggersrv, srv_config, mode = 'a')
|
|
||||||
|
|
||||||
# Random HWID.
|
# Random HWID.
|
||||||
if srv_config['hwid'] == "RANDOM":
|
if srv_config['hwid'] == "RANDOM":
|
||||||
|
@ -361,14 +388,30 @@ def server_check():
|
||||||
else:
|
else:
|
||||||
srv_config['dbSupport'] = True
|
srv_config['dbSupport'] = True
|
||||||
|
|
||||||
# Check port.
|
|
||||||
if not 1 <= srv_config['port'] <= 65535:
|
# Check other specific server options.
|
||||||
pretty_printer(log_obj = loggersrv.error, to_exit = True,
|
list_dest = ['clientcount', 'timeoutidle']
|
||||||
put_text = "{red}{bold}Port number '%s' is invalid. Enter between 1 - 65535. Exiting...{end}" %srv_config['port'])
|
list_opt = ['-c/--client-count', '-t0/--timeout-idle']
|
||||||
|
|
||||||
|
if serverthread.with_gui:
|
||||||
|
list_dest += ['activation', 'renewal']
|
||||||
|
list_opt += ['-a/--activation-interval', '-r/--renewal-interval']
|
||||||
|
|
||||||
|
for dest, opt in zip(list_dest, list_opt):
|
||||||
|
value = srv_config[dest]
|
||||||
|
if (value is not None) and (not isinstance(value, int)):
|
||||||
|
pretty_printer(log_obj = loggersrv.error, to_exit = True,
|
||||||
|
put_text = "{reverse}{red}{bold}argument `%s`: invalid with: '%s'. Exiting...{end}" %(opt, value))
|
||||||
|
|
||||||
def server_create():
|
def server_create():
|
||||||
server = KeyServer((srv_config['ip'], srv_config['port']), kmsServerHandler)
|
try:
|
||||||
server.timeout = srv_config['timeout']
|
server = KeyServer((srv_config['ip'], srv_config['port']), kmsServerHandler)
|
||||||
|
except (socket.gaierror, socket.error) as e:
|
||||||
|
pretty_printer(log_obj = loggersrv.error, to_exit = True,
|
||||||
|
put_text = "{reverse}{red}{bold}Connection failed '%s:%d': %s. Exiting...{end}" %(srv_config['ip'],
|
||||||
|
srv_config['port'],
|
||||||
|
str(e)))
|
||||||
|
server.timeout = srv_config['timeoutidle']
|
||||||
loggersrv.info("TCP server listening at %s on port %d." % (srv_config['ip'], srv_config['port']))
|
loggersrv.info("TCP server listening at %s on port %d." % (srv_config['ip'], srv_config['port']))
|
||||||
loggersrv.info("HWID: %s" % deco(binascii.b2a_hex(srv_config['hwid']), 'utf-8').upper())
|
loggersrv.info("HWID: %s" % deco(binascii.b2a_hex(srv_config['hwid']), 'utf-8').upper())
|
||||||
return server
|
return server
|
||||||
|
@ -423,20 +466,8 @@ def server_main_terminal():
|
||||||
def server_with_gui():
|
def server_with_gui():
|
||||||
import pykms_GuiBase
|
import pykms_GuiBase
|
||||||
|
|
||||||
width = 950
|
|
||||||
height = 660
|
|
||||||
|
|
||||||
root = pykms_GuiBase.KmsGui()
|
root = pykms_GuiBase.KmsGui()
|
||||||
root.title(pykms_GuiBase.gui_description + ' ' + pykms_GuiBase.gui_version)
|
root.title(pykms_GuiBase.gui_description + ' (' + pykms_GuiBase.gui_version + ')')
|
||||||
# Main window initial position.
|
|
||||||
## https://stackoverflow.com/questions/14910858/how-to-specify-where-a-tkinter-window-opens
|
|
||||||
ws = root.winfo_screenwidth()
|
|
||||||
hs = root.winfo_screenheight()
|
|
||||||
x = (ws / 2) - (width / 2)
|
|
||||||
y = (hs / 2) - (height / 2)
|
|
||||||
root.geometry('+%d+%d' %(x, y))
|
|
||||||
# disable maximize button.
|
|
||||||
root.resizable(0, 0)
|
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
|
||||||
def server_main_no_terminal():
|
def server_main_no_terminal():
|
||||||
|
@ -446,7 +477,7 @@ def server_main_no_terminal():
|
||||||
|
|
||||||
class kmsServerHandler(socketserver.BaseRequestHandler):
|
class kmsServerHandler(socketserver.BaseRequestHandler):
|
||||||
def setup(self):
|
def setup(self):
|
||||||
loggersrv.info("Connection accepted: %s:%d" % (self.client_address[0], self.client_address[1]))
|
loggersrv.info("Connection accepted: %s:%d" %(self.client_address[0], self.client_address[1]))
|
||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
while True:
|
while True:
|
||||||
|
@ -496,7 +527,7 @@ class kmsServerHandler(socketserver.BaseRequestHandler):
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
self.request.close()
|
self.request.close()
|
||||||
loggersrv.info("Connection closed: %s:%d" % (self.client_address[0], self.client_address[1]))
|
loggersrv.info("Connection closed: %s:%d" %(self.client_address[0], self.client_address[1]))
|
||||||
|
|
||||||
|
|
||||||
serverqueue = Queue.Queue(maxsize = 0)
|
serverqueue = Queue.Queue(maxsize = 0)
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
Welcome to the _py-kms_ wiki !!
|
||||||
|
|
||||||
|
## How To Use
|
||||||
|
|
||||||
|
- [User Manual](https://github.com/SystemRage/py-kms/wiki/Manual)
|
||||||
|
- [Understanding KMS](https://github.com/SystemRage/py-kms/wiki/Manual#understanding-key-management-service)
|
||||||
|
- [About GVLK Keys](https://github.com/SystemRage/py-kms/wiki/Manual#about-gvlk-keys)
|
||||||
|
- [SLMGR and OSPP Commands](https://github.com/SystemRage/py-kms/wiki/Manual#slmgr-and-ospp-commands)
|
||||||
|
- [py-kms Usage](https://github.com/SystemRage/py-kms/wiki/Manual#py-kms-usage)
|
||||||
|
- [server.py Manual Start](https://github.com/SystemRage/py-kms/wiki/Manual#how-to-run-serverpy-manually)
|
||||||
|
- [server.py Auto Start](https://github.com/SystemRage/py-kms/wiki/Manual#how-to-run-serverpy-automatically-at-start)
|
||||||
|
- [server.py Options](https://github.com/SystemRage/py-kms/wiki/Manual#serverpy-options)
|
||||||
|
- [client.py Options](https://github.com/SystemRage/py-kms/wiki/Manual#clientpy-options)
|
||||||
|
- [Activation Procedure](https://github.com/SystemRage/py-kms/wiki/Manual#activation-procedure)
|
||||||
|
- [Windows](https://github.com/SystemRage/py-kms/wiki/Manual#windows)
|
||||||
|
- [Office](https://github.com/SystemRage/py-kms/wiki/Manual#office)
|
||||||
|
- [Supported Products](https://github.com/SystemRage/py-kms/wiki/Manual#supported-products)
|
||||||
|
- [Documentation](https://github.com/SystemRage/py-kms/wiki/Manual#documentation)
|
||||||
|
|
||||||
|
## GVLK Keys
|
||||||
|
|
||||||
|
- [Windows GVLK Keys](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys)
|
||||||
|
- [Windows Server 2019](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-server-2019)
|
||||||
|
- [Windows Server 2016](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-server-2016)
|
||||||
|
- [Windows 10](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-10)
|
||||||
|
- [Windows Server 2012 R2](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-server-2012-r2)
|
||||||
|
- [Windows 8.1](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-81)
|
||||||
|
- [Windows Server 2012](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-server-2012)
|
||||||
|
- [Windows 8](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-8)
|
||||||
|
- [Windows Server 2008 R2](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-server-2008-r2)
|
||||||
|
- [Windows 7](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-7)
|
||||||
|
- [Windows Server 2008](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-server-2008)
|
||||||
|
- [Windows Vista](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-vista)
|
||||||
|
- [Windows Previews](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys#windows-previews)
|
||||||
|
|
||||||
|
- [Office GVLK Keys](https://github.com/SystemRage/py-kms/wiki/Office-GVLK-Keys)
|
||||||
|
- [Office 2019](https://github.com/SystemRage/py-kms/wiki/Office-GVLK-Keys#office-2019)
|
||||||
|
- [Office 2016](https://github.com/SystemRage/py-kms/wiki/Office-GVLK-Keys#office-2016)
|
||||||
|
- [Office 2013](https://github.com/SystemRage/py-kms/wiki/Office-GVLK-Keys#office-2013)
|
||||||
|
- [Office 2010](https://github.com/SystemRage/py-kms/wiki/Office-GVLK-Keys#office-2010)
|
|
@ -0,0 +1,631 @@
|
||||||
|
## 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 client–server topology. KMS client locate KMS server by using DNS or a static configuration, then contact it by using Remote Procedure Call ( RPC ) and tries to activate against it.
|
||||||
|
KMS can activate both physical computers and virtual machines, but a network must meet or exceed the activation threshold ( minimum number of computers that KMS requires ). For activation, KMS clients on the network need to install a KMS client key ( General Volume License Key, GVLK ), so the product no longer asks Microsoft server but a user–defined server ( the KMS server ) which usually resides in a company’s intranet.
|
||||||
|
|
||||||
|
_py-kms_ is a free open source KMS server emulator written in python, while Microsoft gives their KMS server only to corporations that signed a Select contract. Furthermore _py-kms_ never refuses activation since is without restrictions, while the Microsoft KMS server only activates the products the customer has paid for.
|
||||||
|
|
||||||
|
_py-kms_ supports KMS protocol versions 4, 5 and 6.
|
||||||
|
Although _py-kms_ does neither require an activation key nor any payment, it is not meant to run illegal copies of Windows. Its purpose is to ensure that owners of legal copies can use their software without restrictions,
|
||||||
|
e.g. if you buy a new computer or motherboard and your key will be refused activation from Microsoft servers due to hardware changes.
|
||||||
|
|
||||||
|
Activation with _py-kms_ is achieved with the following steps:
|
||||||
|
1. Run _py-kms_ on a computer in the network ( this is KMS server or local host ).
|
||||||
|
2. Install the product on client ( or said remote host, which is the computer sending data to local host ) and enter the GVLK.
|
||||||
|
3. Configure the client to use the KMS server.
|
||||||
|
|
||||||
|
Note that KMS activations are valid for 180 days, the activation validity interval, or 30 / 45 days with consumer-only products. To remain activated, KMS client computers must renew their activation by connecting to the KMS server at least once every 180 days.
|
||||||
|
For this to work, should be to guarantee that a KMS server is always reachable for the clients on the network.
|
||||||
|
To remember you can't activate Windows 8.1 ( and above ) on a KMS server hosted on the same machine ( the KMS server must be a different computer than the client ).
|
||||||
|
|
||||||
|
## About GVLK keys
|
||||||
|
The GVLK keys for products sold via volume license contracts ( renewal every 180 days ) are published on Microsoft’s Technet web site.
|
||||||
|
|
||||||
|
* Windows: https://technet.microsoft.com/en-us/library/jj612867.aspx
|
||||||
|
|
||||||
|
* Office 2010: https://technet.microsoft.com/en-us/library/ee624355(v=office.14).aspx#section2_3
|
||||||
|
|
||||||
|
* Office 2013: https://technet.microsoft.com/en-us/library/dn385360.aspx
|
||||||
|
|
||||||
|
* Office 2016: https://technet.microsoft.com/it-it/library/dn385360(v=office.16).aspx
|
||||||
|
|
||||||
|
There are also not official keys for consumer-only versions of Windows that require
|
||||||
|
activation renewal every 45 days ( Windows 8.1 ) or 30 days ( Windows 8 ).
|
||||||
|
More complete and well defined lists are available [here](https://github.com/SystemRage/py-kms/wiki/Windows-GVLK-Keys) and [here](https://github.com/SystemRage/py-kms/wiki/Office-GVLK-Keys).
|
||||||
|
|
||||||
|
## SLMGR and OSPP commands
|
||||||
|
The software License Manager ( ```slmgr.vbs``` ) is a Visual Basic script used to configure and retrieve Volume Activation information. The script can be run locally or remotely on the target computer, using the Windows-based script host ( ```wscript.exe``` ) or the command-based script host ( ```cscript.exe``` ), and administrators can specify which script engine to use. If no script engine is specified, SLMGR runs using the default script engine ( note: it's recommended the cscript.exe script engine that resides in the system32 directory ).
|
||||||
|
The Software Licensing Service must be restarted for any changes to take effect. To restart it, can be used the Microsoft Management Console ( MMC ) Services or running the following command:
|
||||||
|
|
||||||
|
```net stop sppsvc && net start sppsvc```
|
||||||
|
|
||||||
|
The _SLMGR_ requires at least one parameter. If the script is run without any parameters, it displays Help information. The general syntax of ```slmgr.vbs``` is as follows ( using the ```cscript.exe``` as the script engine ):
|
||||||
|
|
||||||
|
```
|
||||||
|
cscript slmgr.vbs /parameter
|
||||||
|
cscript slmgr.vbs [ComputerName] [User] [Password] [Option]
|
||||||
|
```
|
||||||
|
where command line options are:
|
||||||
|
```
|
||||||
|
[ComputerName] Name of a remote computer ( default is local computer ).
|
||||||
|
[User] Account with the required privilege on the remote computer.
|
||||||
|
[Password] Password for the account with required privileges on the remote compute.
|
||||||
|
[Option] Options are shown in the table below.
|
||||||
|
```
|
||||||
|
|
||||||
|
Following tables lists _SLMGR_ more relevant options and a brief description of each. Most of the parameters configure the KMS host.
|
||||||
|
|
||||||
|
<table width="700" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="250">
|
||||||
|
<col span="1" width="450">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Global options</th><th>Description</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>/ipk <<i>ProductKey</i>></td>
|
||||||
|
<td>Attempts to install a 5×5 <i>ProductKey</i> for Windows or other application identified by the <i>ProductKey</i>. If the key is valid, this is installed. If a key is already installed, it's silently replaced.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/ato [<i>ActivationID</i>]</td>
|
||||||
|
<td>Prompts Windows to attempt online activation, for retail and volume systems with KMS host key. Specifying the <i>ActivationID</i> parameter isolates the effects of the option to the edition associated with that value.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/dli [<i>ActivationID</i> | <i>All</i>]</td>
|
||||||
|
<td>Display license information. Specifying the <i>ActivationID</i> parameter displays the license information for the specified edition associated with that <i>ActivationID</i>. Specifying <i>All</i> will display all applicable installed products’ license information. Useful for retrieve the current KMS activation count from the KMS host.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/dlv [<i>ActivationID</i> | <i>All</i>]</td>
|
||||||
|
<td>Display detailed license information.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/xpr [<i>ActivationID</i>]</td>
|
||||||
|
<td>Display the activation expiration date for the current license state.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table width="700" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="250">
|
||||||
|
<col span="1" width="450">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Advanced options</th><th>Description</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>/cpky</td>
|
||||||
|
<td>Some servicing operations require the product key to be available in the registry during Out-of-Box Experience ( OOBE ) operations. So this option removes the product key from the registry to prevent from being stolen by malicious code.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/ilc <<i>LicenseFile</i>></td>
|
||||||
|
<td>Installs the <i>LicenseFile</i> specified by the required parameter.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/rilc</td>
|
||||||
|
<td>Reinstalls all licenses stored in <i>%SystemRoot%\system32\oem</i> and <i>%SystemRoot%\System32\spp\tokens</i>.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/rearm</td>
|
||||||
|
<td>Resets the activation timers.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/rearm-app <<i>ApplicationID</i>></td>
|
||||||
|
<td>Resets the licensing status of the specified application.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/rearm-sku <<i>ApplicationID</i>></td>
|
||||||
|
<td>Resets the licensing status of the specified <i>SKU</i>.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/upk [<i>ActivationID</i>]</td>
|
||||||
|
<td>Uninstalls the product key of the current Windows edition. After a restart, the system will be in an unlicensed state unless a new product key is installed.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/dti [<i>ActivationID</i>]</td>
|
||||||
|
<td>Displays installation ID for offline activation of the KMS host for Windows ( default ) or the application that is identified when its <i>ActivationID</i> is provided.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/atp [<i>ConfirmationID</i>][<i>ActivationID</i>]</td>
|
||||||
|
<td>Activate product with user-provided <i>ConfirmationID</i>.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table width="750" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="250">
|
||||||
|
<col span="1" width="450">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>KMS client options</th><th>Description</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>/skms <<i>Name</i>[:<i>Port</i>] | : <i>port</i>> [<i>ActivationID</i>]</td>
|
||||||
|
<td>Specifies the name and the port of the KMS host computer to contact. Setting this value disables auto-detection of the KMS host. If the KMS host uses IPv6 only, the address must be specified in the format [<i>hostname</i>]:<i>port</i>.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/skms-domain <<i>FQDN</i>> [<i>ActivationID</i>]</td>
|
||||||
|
<td>Sets the specific DNS domain in which all KMS SRV records can be found. This setting has no effect if the specific single KMS host is set with the /skms option. Use this option, especially in disjoint namespace environments, to force KMS to ignore the DNS suffix search list and look for KMS host records in the specified DNS domain instead. </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/ckms [<i>ActivationID</i>]</td>
|
||||||
|
<td>Removes the specified KMS hostname, address, and port information from the registry and restores KMS auto-discovery behavior.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/skhc</td>
|
||||||
|
<td>Enables KMS host caching ( default ), which blocks the use of DNS priority and weight after the initial discovery of a working KMS host. If the system can no longer contact the working KMS host, discovery will be attempted again.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/ckhc</td>
|
||||||
|
<td>Disables KMS host caching. This setting instructs the client to use DNS auto-discovery each time it attempts KMS activation ( recommended when using priority and weight ).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/sai <<i>ActivationInterval</i>></td>
|
||||||
|
<td>Changes how often a KMS client attempts to activate itself when it cannot find a KMS host. Replace <i>ActivationInterval</i> with a number of minutes between 15 minutes an 30 days. The default setting is 120.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/sri <<i>RenewalInterval</i>></td>
|
||||||
|
<td>Changes how often a KMS client attempts to renew its activation by contacting a KMS host. Replace <i>RenewalInterval</i> with a number of minutes between 15 minutes an 30 days. The default setting is 10080 ( 7 days ).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/sprt <<i>PortNumber</i>></td>
|
||||||
|
<td>Sets the TCP communications port on a KMS host. It replaces PortNumber with the TCP port number to use. The default setting is 1688.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/sdns</td>
|
||||||
|
<td>Enables automatic DNS publishing by the KMS host.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/cdns</td>
|
||||||
|
<td>Disables automatic DNS publishing by a KMS host.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/spri</td>
|
||||||
|
<td>Sets the priority of KMS host processes to <i>Normal</i>.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/cpri</td>
|
||||||
|
<td>Set the KMS priority to <i>Low</i>.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/act-type [<i>ActivationType</i>] [<i>ActivationID<i/>]</td>
|
||||||
|
<td>Sets a value in the registry that limits volume activation to a single type. <i>ActivationType</i> 1 limits activation to active directory only; 2 limits it to KMS activation; 3 to token-based activation. The 0 option allows any activation type and is the default value.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
The Office Software Protection Platform script ( ```ospp.vbs``` ) can help you to configure and test volume license editions of Office client products.
|
||||||
|
You must open a command prompt by using administrator permissions and navigate to the folder that contains the script. The script is located in the folder of Office installation ( ```\Office14``` for Office 2010, ```\Office15``` for Office 2013, ```\Office16``` for Office 2016 ):
|
||||||
|
|
||||||
|
```%installdir%\Program Files\Microsoft Office\Office15```.
|
||||||
|
|
||||||
|
If you are running 32-bit Office on a 64-bit operating system, the script is located in the folder:
|
||||||
|
|
||||||
|
```%installdir%\Program Files (x86)\Microsoft Office\Office15```.
|
||||||
|
|
||||||
|
Running _OSPP_ requires the ```cscript.exe``` script engine. To see the Help file, type the following command, and then press ENTER:
|
||||||
|
|
||||||
|
```cscript ospp.vbs /?```.
|
||||||
|
|
||||||
|
The general syntax is as follows:
|
||||||
|
|
||||||
|
```cscript ospp.vbs [Option:Value] [ComputerName] [User] [Password]```,
|
||||||
|
|
||||||
|
where command line options are:
|
||||||
|
```
|
||||||
|
[Option:Value] Specifies the option and Value to use to activate a product, install or uninstall a product key, install and display license information, set KMS host name and port, and remove KMS host. The options and values are listed in the tables below.
|
||||||
|
[ComputerName] Name of the remote computer. If a computer name is not provided, the local computer is used.
|
||||||
|
[User] Account that has the required permission on the remote computer.
|
||||||
|
[Password] Password for the account. If a user account and password are not provided, the current credentials are used.
|
||||||
|
```
|
||||||
|
|
||||||
|
<table width="750" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="250">
|
||||||
|
<col span="1" width="450">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Global options</th><th>Description</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>/act</td>
|
||||||
|
<td>Activates installed Office product keys.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/inpkey:<<i>ProductKey</i>></td>
|
||||||
|
<td>Installs a <i>ProductKey</i> ( replaces existing key ) with a user-provided <i>ProductKey</i>.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/unpkey:<<i>ProductKey</i>></td>
|
||||||
|
<td>Uninstalls an installed <i>ProductKey</i> with the last five digits of the <i>ProductKey</i> to uninstall ( as displayed by the /dstatus option ).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/inslic:<<i>LicenseFile</i>></td>
|
||||||
|
<td>Installs a <i>LicenseFile</i> with user-provided path of the .xrm-ms license.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/dstatus</td>
|
||||||
|
<td>Displays license information for installed product keys.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/dstatusall</td>
|
||||||
|
<td>Displays license information for all installed licenses.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/dhistoryacterr</td>
|
||||||
|
<td>Displays the failure history for MAK / Retail activation.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/dinstid</td>
|
||||||
|
<td>Displays Installation ID for offline activation.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/actcid:<<i>ConfirmationID</i>></td>
|
||||||
|
<td>Activates product with user-provided <i>ConfirmationID</i>.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/rearm</td>
|
||||||
|
<td>Resets the licensing status for all installed Office product keys.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/rearm:<<i>ApplicationID</i>></td>
|
||||||
|
<td>Resets the licensing status for an Office license with a user-provided <i>SKUID</i> value. Use this option with the <i>SKUID</i> value specified by using the /dstatus option if you have run out of rearms and have activated Office through KMS or Active Directory-based activation to gain an additional rearm.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/ddescr:<<i>ErrorCode</i>></td>
|
||||||
|
<td>Displays the description for a user-provided <i>ErrorCode</i>.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table width="750" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="250">
|
||||||
|
<col span="1" width="450">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>KMS client options</th><th>Description</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>/dhistorykms</td>
|
||||||
|
<td>Displays KMS client activation history.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/dcmid</td>
|
||||||
|
<td>Displays KMS client computer ID ( CMID )</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/sethst:<<i>HostName</i>></td>
|
||||||
|
<td>Sets a KMS host name with a user-provided <i>HostName</i>.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/setprt:<<i>Port</i>></td>
|
||||||
|
<td>Sets a KMS port with a user-provided <i>Port</i> number.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/remhst</td>
|
||||||
|
<td>Removes KMS hostname ( sets port to default ).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/cachst:<<i>Value</i>></td>
|
||||||
|
<td>Allows or denies KMS host caching. Parameter <i>Value</i> can be TRUE or FALSE.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/actype:<<i>Value</i>></td>
|
||||||
|
<td>( Windows 8 and later only ) Sets volume activation type. Parameter <i>Value</i> can be: 1 ( for Active Directory-based ), 2 ( for KMS ), 0 ( for both ).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/skms-domain:<<i>Value</i>></td>
|
||||||
|
<td>( Windows 8 and later only ) Sets the specific DNS domain in which all KMS SRV records can be found. This setting has no effect if the specific single KMS host is set by the /sethst option. Parameter <i>Value</i> is the Fully Qualified Domain Name ( FQDN ).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>/ckms-domain</td>
|
||||||
|
<td>( Windows 8 and later only ) Clears the specific DNS domain in which all KMS SRV records can be found. The specific KMS host is used if it is set by the /sethst option. Otherwise, auto-discovery of the KMS host is used.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## py-kms Usage
|
||||||
|
|
||||||
|
#### _How to run pykms_Server.py manually_.
|
||||||
|
***
|
||||||
|
A Linux user with ```ifconfig``` command can get his KMS IP ( Windows users can try ```ipconfig /all```).
|
||||||
|
```
|
||||||
|
user@user ~ $ ifconfig
|
||||||
|
eth0 Link encap: Ethernet HWaddr xx:xx:xx:xx.....
|
||||||
|
inet addr: 192.168.1.102 Bcast 192.168.1.255 Mask: 255.255.255.0
|
||||||
|
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
|
||||||
|
RX Packets: 6 errors: 0 dropped, etc.. 0
|
||||||
|
TX packets: 3 errors:0, etc.. 0
|
||||||
|
colisions: 0 txqueuelen: 1000
|
||||||
|
RX bytes: 1020 TX Bytes: 708
|
||||||
|
|
||||||
|
lo Link encap: Local Loopback
|
||||||
|
inet addr: 127.0.0.1 Mask 255.0.0.0
|
||||||
|
UP Loopback running MTU: 65536 Metric: 1
|
||||||
|
RX packets 4: errors: 0 etc 0
|
||||||
|
TX packets 4: errors: 0 etc 0
|
||||||
|
```
|
||||||
|
In the example above is 192.168.1.102, so is valid:
|
||||||
|
|
||||||
|
```user@user ~/path/to/folder/py-kms $ python 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>```.
|
||||||
|
|
||||||
|
#### _How to run pykms_Server.py automatically at start_.
|
||||||
|
***
|
||||||
|
If you are running a Linux distro that is using ```upstart```, you can simply manage a daemon that runs as a background process.
|
||||||
|
|
||||||
|
```sudo nano /etc/init/py-kms.conf```
|
||||||
|
|
||||||
|
Then add the following ( changing where necessary ) and save file:
|
||||||
|
```
|
||||||
|
description "py-kms"
|
||||||
|
author "SystemRage"
|
||||||
|
env PYTHON_HOME=/<dir>
|
||||||
|
env PATH=$PYTHON_HOME:$PATH
|
||||||
|
start on runlevel [2345]
|
||||||
|
stop on runlevel [016]
|
||||||
|
chdir /home/user/path/to/py-kms
|
||||||
|
exec $PYTHON_HOME/bin/python pykms_Server.py <server address> <server port> -v DEBUG --logfile /var/log/pykms_logserver.log
|
||||||
|
respawn
|
||||||
|
```
|
||||||
|
Confirm that it looks ok with: ```init-checkconf /etc/init/py-kms.conf``` and reload configuration: ```initctl reload-configuration```
|
||||||
|
|
||||||
|
Now reboot the machine ```sudo reboot``` and when you boot up your system, you can see the log file stating that your daemon is running :
|
||||||
|
|
||||||
|
```cat /var/log/pykms_logserver.log```.
|
||||||
|
|
||||||
|
Finally a few commands useful for the status of your daemon:
|
||||||
|
* restart --> this will stop, then start a service: ```sudo service py-kms restart```
|
||||||
|
* start --> this will start a service, if it's not running: ```sudo service py-kms start```
|
||||||
|
* stop --> this will stop a service, if it's running: ```sudo service py-kms stop```
|
||||||
|
* status --> this will display the status of a service: ```sudo service py-kms status```
|
||||||
|
|
||||||
|
According to OS that you are running, you can also create a daemon with ```systemd``` or ```SysV```.
|
||||||
|
|
||||||
|
If you are using Windows, to run _pykms_Server.py_ as service you need to install [pywin32](https://sourceforge.net/projects/pywin32/) then you can create a file for example named _kms-winservice.py_ and put into it this code:
|
||||||
|
|
||||||
|
```
|
||||||
|
import win32serviceutil
|
||||||
|
import win32service
|
||||||
|
import win32event
|
||||||
|
import servicemanager
|
||||||
|
import socket
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
class AppServerSvc (win32serviceutil.ServiceFramework):
|
||||||
|
_svc_name_ = "py-kms"
|
||||||
|
_svc_display_name_ = "py-kms"
|
||||||
|
_proc = None
|
||||||
|
_cmd = ["C:\Windows\Python27\python.exe", "C:\Windows\Python27\py-kms\pykms_Server.py"]
|
||||||
|
|
||||||
|
def __init__(self,args):
|
||||||
|
win32serviceutil.ServiceFramework.__init__(self,args)
|
||||||
|
self.hWaitStop = win32event.CreateEvent(None,0,0,None)
|
||||||
|
socket.setdefaulttimeout(60)
|
||||||
|
|
||||||
|
def SvcStop(self):
|
||||||
|
self.killproc()
|
||||||
|
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
|
||||||
|
win32event.SetEvent(self.hWaitStop)
|
||||||
|
|
||||||
|
def SvcDoRun(self):
|
||||||
|
servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE,
|
||||||
|
servicemanager.PYS_SERVICE_STARTED,
|
||||||
|
(self._svc_name_,''))
|
||||||
|
self.main()
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
self._proc = subprocess.Popen(self._cmd)
|
||||||
|
self._proc.wait()
|
||||||
|
|
||||||
|
def killproc(self):
|
||||||
|
self._proc.kill()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
win32serviceutil.HandleCommandLine(AppServerSvc)
|
||||||
|
```
|
||||||
|
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_, changing startup type from "manual" to "auto". Finally "Start" the service.
|
||||||
|
If this approach fails, you can try to use the [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/).
|
||||||
|
|
||||||
|
#### _pykms_Server.py Options_.
|
||||||
|
***
|
||||||
|
Follows a list of usable parameters:
|
||||||
|
|
||||||
|
ip <IPADDRESS>
|
||||||
|
Instructs py-kms to listen on IPADDRESS ( can be an hostname too ). If this option is
|
||||||
|
not specified, IPADDRESS 0.0.0.0 is used.
|
||||||
|
|
||||||
|
port <PORT>
|
||||||
|
Define TCP PORT the KMS service is listening on. Default is 1688.
|
||||||
|
|
||||||
|
-e or --epid <EPID>
|
||||||
|
Use EPID as Windows EPID.
|
||||||
|
Enhanced Privacy ID ( EPID ) is a cryptographic scheme for providing anonymous signatures.
|
||||||
|
If no EPID is specified, a random EPID will be generated.
|
||||||
|
|
||||||
|
-l or --lcid <LCID>
|
||||||
|
Do not randomize the locale ID part of the EPID and use LCID instead.
|
||||||
|
The Language Code Identifier ( LCID ) describes localizable information in Windows.
|
||||||
|
This structure is used to identify specific languages for the purpose of customizing
|
||||||
|
software for particular languages and cultures. For example, it can specify the way dates,
|
||||||
|
times, and numbers are formatted as strings. It can also specify paper sizes and
|
||||||
|
preferred sort order based on language elements.
|
||||||
|
The LCID must be specified as a decimal number ( example: 1049 for "Russian - Russia" ).
|
||||||
|
By default py-kms generates a valid locale ID but this may lead to a value which is
|
||||||
|
unlikely to occur in your country. You may want to select the locale ID of your country instead.
|
||||||
|
See
|
||||||
|
https://msdn.microsoft.com/en-us/library/cc233982.aspx
|
||||||
|
for a list of valid LCIDs. Note that some of them are not recognized by .NET Framework 4.0.
|
||||||
|
If an EPID is manually specified, this setting is ignored.
|
||||||
|
Default is a fixed LCID of 1033 ( English - US ).
|
||||||
|
|
||||||
|
-w or --hwid <HWID>
|
||||||
|
Use specified HWID for all products.
|
||||||
|
Hardware Identification is a security measure used by Microsoft upon the activation of
|
||||||
|
the Windows operating system. As part of the Product Activation system, a unique
|
||||||
|
HWID number is generated when the operating system is first installed. The HWID identifies
|
||||||
|
the hardware components that the system is utilizing, and this number is communicated to Microsoft.
|
||||||
|
Every 10 days and at every reboot the operating system will generate another HWID number and
|
||||||
|
compare it to the original to make sure that the operating system is still running on the same device.
|
||||||
|
If the two HWID numbers differ too much then the operating system will shut down until Microsoft
|
||||||
|
reactivates the product. The theory behind HWID is to ensure that the operating system is not being
|
||||||
|
used on any device other than the one for which it was purchased and registered.
|
||||||
|
|
||||||
|
HWID must be an 16-character string of hex characters that are interpreted as a series of 8 bytes
|
||||||
|
( big endian ). Default is "364F463A8863D35F". To auto generate the HWID, type "random".
|
||||||
|
|
||||||
|
-c or --client-count <CLIENTCOUNT>
|
||||||
|
Use this flag to specify the current CLIENTCOUNT. Default is None. Remember that a number >=25 is
|
||||||
|
required to enable activation of client OSes while for server OSes and Office >=5.
|
||||||
|
|
||||||
|
-a or --activation-interval <ACTIVATIONINTERVAL>
|
||||||
|
Instructs clients to retry activation every ACTIVATIONINTERVAL minutes if it was unsuccessful,
|
||||||
|
e.g. because it could not reach the server. The default is 120 minutes ( 2 hours ).
|
||||||
|
|
||||||
|
-r or --renewal-interval <RENEWALINTERVAL>
|
||||||
|
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.
|
||||||
|
|
||||||
|
-t or --timeout <TIMEOUT>
|
||||||
|
Disconnect clients after time of inactivity ( in seconds ). The default is 30 seconds.
|
||||||
|
|
||||||
|
-V or --loglevel <{CRITICAL, ERROR, WARNING, INFO, DEBUG, MINI}>
|
||||||
|
Activate verbose logging. Use this flag to set a loglevel. The default is ERROR.
|
||||||
|
|
||||||
|
( example: user@user ~/path/to/folder/py-kms $ python pykms_Server.py -V INFO
|
||||||
|
produces in "pykms_logserver.log" these initial messages:
|
||||||
|
Mon, 12 Jun 2017 22:09:00 INFO TCP server listening at 0.0.0.0 on port 1688.
|
||||||
|
Mon, 12 Jun 2017 22:09:00 INFO HWID: 364F463A8863D35F )
|
||||||
|
|
||||||
|
-F or --logfile <LOGFILE>
|
||||||
|
Create a "LOGFILE.log" logging file. The default is named "pykms_logserver.log".
|
||||||
|
|
||||||
|
( example: user@user ~/path/to/folder/py-kms $ python pykms_Server.py 192.168.1.102 8080
|
||||||
|
-F ~/path/to/folder/py-kms/newfile.log -V INFO -w random
|
||||||
|
produces in "newfile.log" these initial messages:
|
||||||
|
Mon, 12 Jun 2017 22:09:00 INFO TCP server listening at 192.168.1.102 on port 8080.
|
||||||
|
Mon, 12 Jun 2017 22:09:00 INFO HWID: 58C4F4E53AE14224 )
|
||||||
|
|
||||||
|
-S or --logsize <MAXSIZE>
|
||||||
|
Use this flag to set a maximum size ( in MB ) to the output log file. Desactivated by default.
|
||||||
|
|
||||||
|
#### _pykms_Client.py Options_.
|
||||||
|
***
|
||||||
|
If something does not work, it may have the cause that _py-kms_ server does not work correctly. You can test this with the KMS client _pykms_Client.py_, running on the same machine where you started _pykms_Server.py_.
|
||||||
|
For example ( in separated bash windows ) run these commands:
|
||||||
|
```
|
||||||
|
user@user ~/path/to/folder/py-kms $ python pykms_Server.py -V DEBUG
|
||||||
|
user@user ~/path/to/folder/py-kms $ python pykms_Client.py 0.0.0.0 1688 -V DEBUG
|
||||||
|
```
|
||||||
|
or if you want better specify:
|
||||||
|
```
|
||||||
|
user@user ~/path/to/folder/py-kms $ python pykms_Server.py YOUR_IPADDRESS 1688 -V DEBUG
|
||||||
|
user@user ~/path/to/folder/py-kms $ python pykms_Client.py YOUR_IPADDRESS 1688 -V DEBUG
|
||||||
|
```
|
||||||
|
You can also put further parameters as defined below:
|
||||||
|
|
||||||
|
ip <IPADDRESS>
|
||||||
|
Define IPADDRESS ( or hostname ) of py-kms' KMS Server. This parameter is always required.
|
||||||
|
|
||||||
|
port <PORT>
|
||||||
|
Define TCP PORT the KMS service is listening on. Default is 1688.
|
||||||
|
|
||||||
|
-m or --mode <PRODUCTNAME>
|
||||||
|
Use this flag to manually specify a Microsoft PRODUCTNAME for testing the KMS server.
|
||||||
|
The default is Windows81.
|
||||||
|
|
||||||
|
-c or --cmid <CMID>
|
||||||
|
Use this flag to manually specify a CMID to use. If no CMID is specified, a random one
|
||||||
|
will be generated.
|
||||||
|
The Microsoft KMS host machine identifies KMS clients with a unique Client Machine ID
|
||||||
|
( CMID, example: ae3a27d1-b73a-4734-9878-70c949815218 ). For a KMS client to successfully
|
||||||
|
activate, the KMS server needs to meet a threshold, which is a minimum count for KMS clients.
|
||||||
|
Once a KMS server records a count which meets or exceeds threshold, KMS clients will begin to
|
||||||
|
activate successfully. Each unique CMID recorded by KMS server adds towards the count threshold
|
||||||
|
for KMS clients. This are retained by the KMS server for a maximum of 30 days after the
|
||||||
|
last activation request with that CMID. Note that duplicate CMID only impacts on KMS server
|
||||||
|
machine count of client machines. Once KMS server meets minimum threshold, KMS clients will
|
||||||
|
activate regardless of CMID being unique for a subset of specific machines or not.
|
||||||
|
|
||||||
|
-n or --name <MACHINENAME>
|
||||||
|
Use this flag to manually specify an ASCII MACHINENAME to use. If no MACHINENAME is specified
|
||||||
|
a random one will be generated.
|
||||||
|
|
||||||
|
-V or --loglevel <{CRITICAL, ERROR, WARNING, INFO, DEBUG, MINI}>
|
||||||
|
Activate verbose logging. Use this flag to set a loglevel. The default is ERROR.
|
||||||
|
|
||||||
|
-F of --logfile <LOGFILE>
|
||||||
|
Create a "LOGFILE.log" logging file. The default is named "pykms_logclient.log".
|
||||||
|
|
||||||
|
-S or --logsize <MAXSIZE>
|
||||||
|
Use this flag to set a maximum size ( in MB ) to the output log file. Desactivated by default.
|
||||||
|
|
||||||
|
## Activation Procedure
|
||||||
|
Briefly the product asks for a key during installation, so it needs to enter the GVLK. Then 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 45 ) days.
|
||||||
|
|
||||||
|
#### _Windows_
|
||||||
|
***
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
0. Run a Command Prompt as Administrator ( you are directly in ```C:\Windows\System32``` path ).
|
||||||
|
|
||||||
|
```//nologo``` option of ```cscript``` needs only to hide startup logo.
|
||||||
|
|
||||||
|
1. This is facoltative, it's for unistalling existing product key.
|
||||||
|
2. Then put your product's GVLK.
|
||||||
|
3. Set connection parameters.
|
||||||
|
4. Try online activation, but... if that fails with error ```0xC004F074``` you’ll 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 ( with now traffic on 1688 enabled ).
|
||||||
|
6. View license informations ( facoltative ).
|
||||||
|
|
||||||
|
#### _Office_
|
||||||
|
***
|
||||||
|
Note that you’ll have to install a volume license ( VL ) version of Office. Office versions downloaded from MSDN and / or Technet are non-VL.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
0. Run a Command Prompt as Administrator and navigate to Office folder ```cd C:\ProgramFiles\Microsoft Office\OfficeXX``` (64-bit path) or ```cd C:\ProgramFiles(x86)\Microsoft Office\OfficeXX``` (32-bit path), where XX = 14 for Office 2010, 15 for Office 2013, 16 for Office 2016 or Office 2019.
|
||||||
|
1. As you can see, running ```/dstatus```, my Office is expiring ( 14 days remaining ).
|
||||||
|
2. Only for example, let's go to uninstall this product.
|
||||||
|
3. This is confirmed running ```/dstatus``` again.
|
||||||
|
4. Now i put my product's GVLK ( and you your key ).
|
||||||
|
5. Set the connection parameter KMS server address.
|
||||||
|
6. Set the connection parameter KMS server port.
|
||||||
|
7. Activate installed Office product key.
|
||||||
|
8. View license informations ( in my case product is now licensed and remaining grace 180 days as expected ).
|
||||||
|
|
||||||
|
## Supported Products
|
||||||
|
Note that it is possible to activate all versions in the VL ( Volume License ) channel, so long as you provide the proper key to let Windows know that it should be activating against a KMS server. KMS activation can't be used for Retail channel products, however you can install a VL product key specific to your edition of Windows even if it was installed as Retail. This effectively converts Retail installation to VL channel and will allow you to activate from a KMS server. This is not valid for Office's products, so Office, Project and Visio must be volume license versions. Newer version may work as long as the KMS protocol does not change.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
* <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
|
||||||
|
* <sup>[4]</sup> https://forums.mydigitallife.net/threads/kms-activate-windows-8-1-en-pro-and-office-2013.49686
|
||||||
|
* <sup>[5]</sup> https://github.com/myanaloglife/py-kms
|
||||||
|
* <sup>[6]</sup> https://github.com/Wind4/vlmcsd
|
||||||
|
* <sup>[7]</sup> https://github.com/ThunderEX/py-kms
|
||||||
|
* <sup>[8]</sup> https://github.com/CNMan/balala/blob/master/pkconfig.csv
|
||||||
|
* <sup>[9]</sup> http://www.level7techgroup.com/docs/kms_overview.pdf
|
||||||
|
* <sup>[10]</sup> https://www.dell.com/support/article/it/it/itbsdt1/sln266176/windows-server-using-the-key-management-service-kms-for-activation-of-volume-licensed-systems?lang=en
|
||||||
|
* <sup>[11]</sup> https://social.technet.microsoft.com/Forums/en-US/c3331743-cba2-4d92-88aa-9633ac74793a/office-2010-kms-current-count-remain-at-10?forum=officesetupdeployprevious
|
||||||
|
* <sup>[12]</sup> https://betawiki.net/wiki/Microsoft_Windows
|
||||||
|
* <sup>[13]</sup> https://thecollectionbook.info/builds/windows
|
||||||
|
* <sup>[14]</sup> https://www.betaarchive.com/forum/viewtopic.php%3Ft%3D29131+&cd=10&hl=it&ct=clnk&gl=it
|
||||||
|
* <sup>[15]</sup> https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=12&cad=rja&uact=8&ved=2ahUKEwjmvZihtOHeAhVwyoUKHSjeD5Q4ChAWMAF6BAgHEAI&url=ftp%3A%2F%2Flynas.ittc.vu.lt%2Fpub%2FMicrosoft%2FWindows%2520Vista%2FWindows%2520Vista_Volume_Activation_2.0%2FWindows%2520Vista%2520Volume%2520Activation%2FWindows%2520Vista_Volume_Activation_2.0%2Fvolume%2520activation%25202%25200%2520step-by-step%2520guide.doc&usg=AOvVaw3kqhCu3xT-3r416DRGUUs_
|
||||||
|
* <sup>[16]</sup> https://www.itprotoday.com/windows-78/volume-activation-server-2008
|
||||||
|
* <sup>[17]</sup> https://docs.microsoft.com/en-us/windows-server/get-started-19/activation-19
|
||||||
|
* <sup>[18]</sup> https://docs.microsoft.com/en-us/windows-server/get-started/windows-server-release-info
|
||||||
|
* <sup>[19]</sup> https://support.microsoft.com/en-us/help/13853/windows-lifecycle-fact-sheet
|
|
@ -0,0 +1,136 @@
|
||||||
|
### _Office 2019_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Professional Plus 2019 [C2R]</td><td>VQ9DP-NVHPH-T9HJC-J9PDT-KTQRG</td></tr>
|
||||||
|
<tr><td>Professional Plus 2019</td><td>NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP</td></tr>
|
||||||
|
<tr><td>Standard 2019</td><td>6NWWJ-YQWMR-QKGCB-6TMB3-9D9HK</td></tr>
|
||||||
|
<tr><td>Project Professional 2019 [C2R]</td><td>XM2V9-DN9HH-QB449-XDGKC-W2RMW</td></tr>
|
||||||
|
<tr><td>Project Professional 2019</td><td>B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B</td></tr>
|
||||||
|
<tr><td>Project Standard 2019</td><td>C4F7P-NCP8C-6CQPT-MQHV9-JXD2M</td></tr>
|
||||||
|
<tr><td>Visio Professional 2019 [C2R]</td><td>N2CG9-YD3YK-936X4-3WR82-Q3X4H </td></tr>
|
||||||
|
<tr><td>Visio Professional 2019</td><td>9BGNQ-K37YR-RQHF2-38RQ3-7VCBB</td></tr>
|
||||||
|
<tr><td>Visio Standard 2019</td><td>7TQNQ-K3YQQ-3PFH7-CCPPM-X4VQ2</td></tr>
|
||||||
|
<tr><td>Access 2019</td><td>9N9PT-27V4Y-VJ2PD-YXFMF-YTFQT</td></tr>
|
||||||
|
<tr><td>Excel 2019</td><td>TMJWT-YYNMB-3BKTF-644FC-RVXBD</td></tr>
|
||||||
|
<tr><td>Outlook 2019</td><td>7HD7K-N4PVK-BHBCQ-YWQRW-XW4VK</td></tr>
|
||||||
|
<tr><td>PowerPoint 2019</td><td>RRNCX-C64HY-W2MM7-MCH9G-TJHMQ</td></tr>
|
||||||
|
<tr><td>Publisher 2019</td><td>G2KWX-3NW6P-PY93R-JXK2T-C9Y9V</td></tr>
|
||||||
|
<tr><td>Skype for Business 2019</td><td>NCJ33-JHBBY-HTK98-MYCV8-HMKHJ</td></tr>
|
||||||
|
<tr><td>Word 2019</td><td>PBX3G-NWMT6-Q7XBW-PYJGG-WXD33</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Office 2016_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Professional Plus 2016</td><td>XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99</td></tr>
|
||||||
|
<tr><td>Standard 2016</td><td>JNRGM-WHDWX-FJJG3-K47QV-DRTFM</td></tr>
|
||||||
|
<tr><td>Project Professional 2016</td><td>YG9NW-3K39V-2T3HJ-93F3Q-G83KT</td></tr>
|
||||||
|
<tr><td>Project Professional 2016 [C2R]</td><td>WGT24-HCNMF-FQ7XH-6M8K7-DRTW9</td></tr>
|
||||||
|
<tr><td>Project Standard 2016</td><td>GNFHQ-F6YQM-KQDGJ-327XX-KQBVC</td></tr>
|
||||||
|
<tr><td>Project Standard 2016 [C2R]</td><td>D8NRQ-JTYM3-7J2DX-646CT-6836M</td></tr>
|
||||||
|
<tr><td>Visio Professional 2016</td><td>PD3PC-RHNGV-FXJ29-8JK7D-RJRJK</td></tr>
|
||||||
|
<tr><td>Visio Professional 2016 [C2R]</td><td>69WXN-MBYV6-22PQG-3WGHK-RM6XC</td></tr>
|
||||||
|
<tr><td>Visio Standard 2016</td><td>7WHWN-4T7MP-G96JF-G33KR-W8GF4</td></tr>
|
||||||
|
<tr><td>Visio Standard 2016 [C2R]</td><td>NY48V-PPYYH-3F4PX-XJRKJ-W4423</td></tr>
|
||||||
|
<tr><td>Access 2016</td><td>GNH9Y-D2J4T-FJHGG-QRVH7-QPFDW</td></tr>
|
||||||
|
<tr><td>Excel 2016</td><td>9C2PK-NWTVB-JMPW8-BFT28-7FTBF</td></tr>
|
||||||
|
<tr><td>Mondo 2016</td><td>HFTND-W9MK4-8B7MJ-B6C4G-XQBR2</td></tr>
|
||||||
|
<tr><td>Mondo Retail 2016</td><td>DMTCJ-KNRKX-26982-JYCKT-P7KB6</td></tr>
|
||||||
|
<tr><td>OneNote 2016</td><td>DR92N-9HTF2-97XKM-XW2WJ-XW3J6</td></tr>
|
||||||
|
<tr><td>Outlook 2016</td><td>R69KK-NTPKF-7M3Q4-QYBHW-6MT9B</td></tr>
|
||||||
|
<tr><td>PowerPoint 2016</td><td>J7MQP-HNJ4Y-WJ7YM-PFYGF-BY6C6</td></tr>
|
||||||
|
<tr><td>Publisher 2016</td><td>F47MM-N3XJP-TQXJ9-BP99D-8K837</td></tr>
|
||||||
|
<tr><td>Skype for Business 2016</td><td>869NQ-FJ69K-466HW-QYCP2-DDBV6</td></tr>
|
||||||
|
<tr><td>Word 2016</td><td>WXY84-JN2Q9-RBCCQ-3Q3J3-3PFJ6</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Office 2013_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Professional Plus 2013 [Preview]</td><td>PGD67-JN23K-JGVWV-KTHP4-GXR9G</td></tr>
|
||||||
|
<tr><td>Professional Plus 2013</td><td>YC7DK-G2NP3-2QQC3-J6H88-GVGXT</td></tr>
|
||||||
|
<tr><td>Standard 2013</td><td>KBKQT-2NMXY-JJWGP-M62JB-92CD4</td></tr>
|
||||||
|
<tr><td>Project Professional 2013 [Preview]</td><td>NFKVM-DVG7F-TYWYR-3RPHY-F872K</td></tr>
|
||||||
|
<tr><td>Project Professional 2013</td><td>FN8TT-7WMH6-2D4X9-M337T-2342K</td></tr>
|
||||||
|
<tr><td>Project Standard 2013 [Preview]</td><td>N89QF-GGB8J-BKD28-C4V28-W4XTK</td></tr>
|
||||||
|
<tr><td>Project Standard 2013</td><td>6NTH3-CW976-3G3Y2-JK3TX-8QHTT</td></tr>
|
||||||
|
<tr><td>Visio Professional 2013 [Preview]</td><td>B3C7Q-D6NH2-2VRFW-HHWDG-FVQB6</td></tr>
|
||||||
|
<tr><td>Visio Professional 2013</td><td>C2FG9-N6J68-H8BTJ-BW3QX-RM3B3</td></tr>
|
||||||
|
<tr><td>Visio Standard 2013 [Preview]</td><td>9MKNF-J9XQ6-JV4XB-FJQPY-43F43</td></tr>
|
||||||
|
<tr><td>Visio Standard 2013</td><td>J484Y-4NKBF-W2HMG-DBMJC-PGWR7</td></tr>
|
||||||
|
<tr><td>Access 2013 [Preview]</td><td>DJBH8-RGN7Q-836KD-DMP3M-DM9MF</td></tr>
|
||||||
|
<tr><td>Access 2013</td><td>NG2JY-H4JBT-HQXYP-78QH9-4JM2D</td></tr>
|
||||||
|
<tr><td>Excel 2013 [Preview]</td><td>Q3BNP-3WXDT-GG8HF-24KMW-HMDBK</td></tr>
|
||||||
|
<tr><td>Excel 2013</td><td>VGPNG-Y7HQW-9RHP7-TKPV3-BG7GB</td></tr>
|
||||||
|
<tr><td>OneNote 2013 [Preview]</td><td>VYNYX-8GPBC-7FQMD-D6B7B-7MDFD</td></tr>
|
||||||
|
<tr><td>OneNote 2013</td><td>TGN6P-8MMBC-37P2F-XHXXK-P34VW</td></tr>
|
||||||
|
<tr><td>Outlook 2013 [Preview]</td><td>X2KNB-FRRG2-WXDPH-739DM-DM9RH</td></tr>
|
||||||
|
<tr><td>Outlook 2013</td><td>QPN8Q-BJBTJ-334K3-93TGY-2PMBT</td></tr>
|
||||||
|
<tr><td>PowerPoint 2013 [Preview]</td><td>B8CT8-BTNFQ-XQXBK-BFWV8-HMDFQ</td></tr>
|
||||||
|
<tr><td>PowerPoint 2013</td><td>4NT99-8RJFH-Q2VDH-KYG2C-4RD4F</td></tr>
|
||||||
|
<tr><td>Publisher 2013 [Preview]</td><td>NB67P-J8XP4-XDK9B-V73VH-M4CKR</td></tr>
|
||||||
|
<tr><td>Publisher 2013</td><td>PN2WF-29XG2-T9HJ7-JQPJR-FCXK4</td></tr>
|
||||||
|
<tr><td>InfoPath 2013 (Preview)</td><td>7KPJJ-N8TT7-CK3KR-QTV98-YPVXQ</td></tr>
|
||||||
|
<tr><td>InfoPath 2013</td><td>DKT8B-N7VXH-D963P-Q4PHY-F8894</td></tr>
|
||||||
|
<tr><td>Lync 2013 [Preview]</td><td>XNVD3-RYC7T-7R6BT-WX6CF-8BYH7</td></tr>
|
||||||
|
<tr><td>Lync 2013</td><td>2MG3G-3BNTT-3MFW9-KDQW3-TCK7R</td></tr>
|
||||||
|
<tr><td>Word 2013 [Preview]</td><td>JBGD4-3JNG7-JWWGV-CR6TP-DC62Q</td></tr>
|
||||||
|
<tr><td>Word 2013</td><td>6Q7VD-NX8JD-WJ2VH-88V73-4GBJ7</td></tr>
|
||||||
|
<tr><td>Mondo 2013 [Preview]</td><td>GCGCN-6FJRM-TR9Q3-BGMWJ-78KQV</td></tr>
|
||||||
|
<tr><td>Mondo 2013</td><td>42QTK-RN8M7-J3C4G-BBGYM-88CYV</td></tr>
|
||||||
|
<tr><td>Mondo 2013 Retail</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>SharePoint Workspace (Groove) 2013 [Preview]</td><td>WVCGG-NK4FG-7XKXM-BD4WF-3C624</td></tr>
|
||||||
|
<tr><td>SharePoint Workspace (Groove) 2013</td><td>H7R7V-WPNXQ-WCYYC-76BGV-VT7GH</td></tr>
|
||||||
|
<tr><td>SharePoint Designer (Frontpage) 2013 Retail [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>SharePoint Designer (Frontpage) 2013 Retail</td><td>GYJRG-NMYMF-VGBM4-T3QD4-842DW</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Office 2010_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Professional Plus 2010</td><td>VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB</td></tr>
|
||||||
|
<tr><td>Standard 2010</td><td>V7QKV-4XVVR-XYV4D-F7DFM-8R6BM</td></tr>
|
||||||
|
<tr><td>Project Professional 2010</td><td>YGX6F-PGV49-PGW3J-9BTGG-VHKC6</td></tr>
|
||||||
|
<tr><td>Project Standard 2010</td><td>4HP3K-88W3F-W2K3D-6677X-F9PGB</td></tr>
|
||||||
|
<tr><td>Visio Professional 2010</td><td>7MCW8-VRQVK-G677T-PDJCM-Q8TCP</td></tr>
|
||||||
|
<tr><td>Visio Standard 2010</td><td>767HD-QGMWX-8QTDB-9G3R2-KHFGJ</td></tr>
|
||||||
|
<tr><td>Visio Premium 2010</td><td>D9DWC-HPYVV-JGF4P-BTWQB-WX8BJ</td></tr>
|
||||||
|
<tr><td>Access 2010</td><td>V7Y44-9T38C-R2VJK-666HK-T7DDX</td></tr>
|
||||||
|
<tr><td>Excel 2010</td><td>H62QG-HXVKF-PP4HP-66KMR-CW9BM</td></tr>
|
||||||
|
<tr><td>OneNote 2010</td><td>Q4Y4M-RHWJM-PY37F-MTKWH-D3XHX</td></tr>
|
||||||
|
<tr><td>Outlook 2010</td><td>7YDC2-CWM8M-RRTJC-8MDVC-X3DWQ</td></tr>
|
||||||
|
<tr><td>PowerPoint 2010</td><td>RC8FX-88JRY-3PF7C-X8P67-P4VTT</td></tr>
|
||||||
|
<tr><td>Publisher 2010</td><td>BFK7F-9MYHM-V68C7-DRQ66-83YTP</td></tr>
|
||||||
|
<tr><td>InfoPath 2010</td><td>K96W8-67RPQ-62T9Y-J8FQJ-BT37T</td></tr>
|
||||||
|
<tr><td>SharePoint Workspace (Groove) 2010</td><td>QYYW6-QP4CB-MBV6G-HYMCJ-4T3J4</td></tr>
|
||||||
|
<tr><td>Word 2010</td><td>HVHB3-C6FV7-KQX9W-YQG79-CRY7T</td></tr>
|
||||||
|
<tr><td>Small Business Basics 2010</td><td>D6QFG-VBYP2-XQHM7-J97RH-VVRCK</td></tr>
|
||||||
|
<tr><td>Starter 2010 Retail</td><td>VXHHB-W7HBD-7M342-RJ7P8-CHBD6</td></tr>
|
||||||
|
<tr><td>SharePoint Designer (Frontpage) 2010 Retail</td><td>H48K6-FB4Y6-P83GH-9J7XG-HDKKX</td></tr>
|
||||||
|
<tr><td>Office Mondo 1 2010</td><td>YBJTT-JG6MD-V9Q7P-DBKXJ-38W9R</td></tr>
|
||||||
|
<tr><td>Office Mondo 2 2010</td><td>7TC2V-WXF6P-TD7RT-BQRXR-B8K32</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -0,0 +1,338 @@
|
||||||
|
### _Windows Server 2019_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows Server 2019 Datacenter</td><td>WMDGN-G9PQG-XVVXX-R3X43-63DFG</td></tr>
|
||||||
|
<tr><td>Windows Server 2019 Standard</td><td>N69G4-B89J2-4G8F4-WWYCC-J464C</td></tr>
|
||||||
|
<tr><td>Windows Server 2019 Essentials</td><td>WVDHN-86M7X-466P6-VHXV7-YY726</td></tr>
|
||||||
|
<tr><td>Windows Server 2019 Azure Core</td><td>FDNH6-VW9RW-BXPJ7-4XTYG-239TB</td></tr>
|
||||||
|
<tr><td>Windows Server 2019 Datacenter Semi-Annual Channel (v.1809)</td><td>6NMRW-2C8FM-D24W7-TQWMY-CWH2D</td></tr>
|
||||||
|
<tr><td>Windows Server 2019 Standard Semi-Annual Channel (v.1809)</td><td>N2KJX-J94YW-TQVFB-DG9YT-724CC</td></tr>
|
||||||
|
<tr><td>Windows Server 2019 ARM64</td><td>GRFBW-QNDC4-6QBHG-CCK3B-2PR88</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows Server 2016_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows Server 2016 Standard Semi-Annual Channel (v.1803)</td><td>PTXN8-JFHJM-4WC78-MPCBR-9W4KR</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Datacenter Semi-Annual Channel (v.1803)</td><td>2HXDN-KRXHB-GPYC7-YCKFJ-7FVDG</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Datacenter Semi-Annual Channel (v.1709)</td><td>6Y6KB-N82V8-D8CQV-23MJW-BWTG6</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Standard Semi-Annual Channel (v.1709)</td><td>DPCNP-XQFKJ-BJF7R-FRC8D-GF6G4</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 ARM64</td><td>K9FYF-G6NCK-73M32-XMVPY-F9DRR</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Datacenter</td><td>CB7KF-BWN84-R7R2Y-793K2-8XDDG</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Standard</td><td>WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Essentials</td><td>JCKRF-N37P4-C2D82-9YXRT-4M63B</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Cloud Storage</td><td>QN4C6-GBJD2-FB422-GHWJK-GJG2R</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Azure Core</td><td>VP34G-4NPPG-79JTQ-864T4-R3MQX<br /> WNCYY-GFBH2-M4WTT-XQ2FP-PG2K9</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows 10_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows 10 Professional Workstation</td><td>NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional Workstation N</td><td>9FNHH-K3HBT-3W4TD-6383H-6XYWF</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise G</td><td>YYVX9-NTFWV-6MDM3-9PT4T-4M68B</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise G N</td><td>44RPN-FTY23-9VTTB-MP9BX-T84FV</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise LTSC 2019</td><td>M7XTQ-FN8P6-TTKYV-9D4CC-J462D</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise LTSC 2019 N</td><td>92NFX-8DJQP-P6BBQ-THF9C-7CG2H</td></tr>
|
||||||
|
<tr><td>Windows 10 Remote Server</td><td>7NBT4-WGBQX-MP4H7-QXFF8-YP3KX</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise for Remote Sessions</td><td>CPWHC-NT2C7-VYW78-DHDB2-PG3GK</td></tr>
|
||||||
|
<tr><td>Windows 10 S (Lean)</td><td>NBTWJ-3DR69-3C4V8-C26MC-GQ9M6</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional</td><td>W269N-WFGWX-YVC9B-4J6C9-T83GX</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional N</td><td>MH37W-N47XK-V7XM9-C7227-GCQG9 <br /> HMNWJ-V69R6-B2CDC-8P7VT-2373K</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional Education</td><td>6TP4R-GNPTD-KYYHQ-7B7DP-J447Y</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional Education N</td><td>YVWGF-BXNMC-HTQYQ-CPQ99-66QFC</td></tr>
|
||||||
|
<tr><td>Windows 10 Education</td><td>NW6C2-QMPVW-D7KKK-3GKT6-VCFB2 <br /> F48BJ-8NX82-MRVY9-PF8BW-HMHY2</td></tr>
|
||||||
|
<tr><td>Windows 10 Education N</td><td>2WH4N-8QGBV-H22JP-CT43Q-MDWWJ <br /> PPWGW-8NW9C-J77Q9-8WHB9-QV64W</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise</td><td>NPPR9-FWDCX-D2C8J-H872K-2YT43 <br /> 96YNV-9X4RP-2YYKB-RMQH4-6Q72D <br /> TN6CM-KCVXP-VVP8X-YVCF7-R9BDH <br /> 3PMKQ-YNVGT-HFJGG-2F4FQ-9D6T7</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise N</td><td>DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4 <br /> WGGHN-J84D6-QYCPR-T7PJ7-X766F</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise S</td><td>H76BG-QBNM7-73XY9-V6W2T-684BJ</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise S N</td><td>X4R4B-NV6WD-PKTVK-F98BH-4C2J8</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise 2015 LTSB</td><td>WNMTR-4C88C-JK8YV-HQ7T2-76DF9</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise 2015 LTSB N</td><td>2F77B-TNFGY-69QQF-B8YKP-D69TJ <br /> RW7WN-FMT44-KRGBK-G44WK-QV7YK</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise 2016 LTSB</td><td>DCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise 2016 LTSB N</td><td>QFFDN-GRT3P-VKWWX-X7T3R-8B639</td></tr>
|
||||||
|
<tr><td>Windows 10 Home <br /> Windows 10 Core</td><td>TX9XD-98N7V-6WMQ6-BX7FG-H8Q99 <br /> 33QT6-RCNYF-DXB4F-DGP7B-7MHX9</td></tr>
|
||||||
|
<tr><td>Windows 10 Home N <br /> Windows 10 Core N</td><td>3KHY7-WNT83-DGQKR-F7HPR-844BM <br /> CP4KF-NG6TC-9K6QF-P6GTT-H8RBM</td></tr>
|
||||||
|
<tr><td>Windows 10 Home Single Language <br /> Windows 10 Core Single Language</td><td>7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH <br /> 9HGRW-NH2CQ-XQHJD-YCRWB-6VJV7 <br /> 4NX46-6DHCG-MR3PH-9FMCX-3RQ3G</td></tr>
|
||||||
|
<tr><td>Windows 10 Home Country Specific <br /> Windows 10 Core Country Specific</td><td>PVMJN-6DFY6-9CCP6-7BKTT-D3WVR <br /> JN9HR-MH7K4-DBPDD-TFTXF-Q9MMF</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows Server 2012 R2_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows Server 2012 R2 Standard</td><td>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 R2 Datacenter</td><td>W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 R2 Essentials</td><td>KNC87-3J2TX-XB4WP-VCPJV-M4FWM</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 R2 Cloud Storage</td><td>3NPTF-33KPT-GGBPR-YX76B-39KDD</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows 8.1_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows 8.1 Professional</td><td>GCRJD-8NW9H-F2CDX-CCM8D-9D6T9</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Professional N</td><td>HMCNV-VVBFX-7HMBH-CTY9B-B4FXY</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Professional WMC</td><td>789NJ-TQK6T-6XTH8-J39CJ-J8D3P</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Enterprise</td><td>MHF9N-XY6XB-WVXMC-BTDCT-MKKG7 <br /> FHQNR-XYXYC-8PMHT-TV4PH-DRQ3H</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Enterprise N</td><td>TT4HM-HN7YT-62K67-RGRQJ-JFFXW <br /> NDRDJ-3YBP2-8WTKD-CK7VB-HT8KW</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Embedded Industry Automotive</td><td>VHXM3-NR6FT-RY6RT-CK882-KW2CJ</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Embedded Industry Enterprise</td><td>FNFKF-PWTVT-9RC8H-32HB2-JB34X</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Embedded Industry Professional</td><td>NMMPB-38DD4-R2823-62W8D-VXKJB</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core</td><td>M9Q9P-WNJJT-6PXPY-DWX8H-6XWKK</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core N</td><td>7B9N3-D94CG-YTVHR-QBPX3-RJP64</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core Single Language</td><td>BB6NG-PQ82V-VRDPW-8XVD2-V8P66</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core Country Specific</td><td>NCTT7-2RGK8-WMHRF-RY7YQ-JTXG3</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core ARM</td><td>XYTND-K6QKT-K2MRH-66RTM-43JKP</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core Connected</td><td>3PY8R-QHNP9-W7XQD-G6DPH-3J2C9</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core Connected N</td><td>Q6HTR-N24GM-PMJFP-69CD8-2GXKR</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core Connected Country Specific</td><td>R962J-37N87-9VVK2-WJ74P-XTMHR</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Core Connected Single Language</td><td>KF37N-VDV38-GRRTV-XH8X6-6F3BB</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Professional Student</td><td>MX3RK-9HNGX-K3QKC-6PJ3F-W8D7B</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Professional Student N</td><td>TNFGH-2R6PB-8XM3K-QYHX2-J4296</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows Server 2012_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows Server 2012 <br /> Windows 8 Core</td><td>BN3D2-R7TKB-3YPBD-8DRP2-27GG4</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 N <br /> Windows 8 Core N</td><td>8N2M2-HWPGY-7PGT9-HGDD8-GVGGY</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 Single Language <br /> Windows 8 Core Single Language</td><td>2WN2H-YGCQR-KFX6K-CD6TF-84YXQ</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 Country Specific <br /> Windows 8 Core Country Specific</td><td>4K36P-JN4VD-GDC6V-KDT89-DYFKP</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 Standard</td><td>XC9B7-NBPP2-83J2H-RHMBY-92BT4</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 MultiPoint Standard</td><td>HM7DN-YVMH3-46JC3-XYTG7-CYQJJ</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 MultiPoint Premium</td><td>XNH6W-2V9GX-RGJ4K-Y8X6F-QGJ2G</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 Datacenter</td><td>48HP8-DN98B-MYWDG-T2DCC-8W83P</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows 8_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows 8 Professional</td><td>NG4HW-VH26C-733KW-K6F98-J8CK4</td></tr>
|
||||||
|
<tr><td>Windows 8 Professional N</td><td>XCVCF-2NXM9-723PB-MHCB7-2RYQQ</td></tr>
|
||||||
|
<tr><td>Windows 8 Professional WMC</td><td>GNBB8-YVD74-QJHX6-27H4K-8QHDG <br /> NQ3PX-BBY8Y-RRHMM-TBHFW-PJ866</td></tr>
|
||||||
|
<tr><td>Windows 8 Enterprise</td><td>32JNW-9KQ84-P47T8-D8GGY-CWCK7 <br /> 8M9BN-YB7W9-YV3VJ-7WMGG-MKH3V</td></tr>
|
||||||
|
<tr><td>Windows 8 Enterprise N</td><td>JMNMF-RHW7P-DMY6X-RF3DR-X2BQT <br /> NCVKH-RB9D4-R86X8-GB8WG-4M2K6</td></tr>
|
||||||
|
<tr><td>Windows 8 Embedded Industry Professional</td><td>JVPDN-TBWJW-PD94V-QYKJ2-KWYQM <br /> RYXVT-BNQG7-VD29F-DBMRY-HT73M</td></tr>
|
||||||
|
<tr><td>Windows 8 Embedded Industry Enterprise</td><td>NKB3R-R2F8T-3XCDP-7Q2KW-XWYQ2</td></tr>
|
||||||
|
<tr><td>Windows 8 Core <br /> Windows Server 2012</td><td>BN3D2-R7TKB-3YPBD-8DRP2-27GG4</td></tr>
|
||||||
|
<tr><td>Windows 8 Core N <br /> Windows Server 2012 N</td><td>8N2M2-HWPGY-7PGT9-HGDD8-GVGGY</td></tr>
|
||||||
|
<tr><td>Windows 8 Core Single Language <br /> Windows Server 2012 Single Language</td><td>2WN2H-YGCQR-KFX6K-CD6TF-84YXQ</td></tr>
|
||||||
|
<tr><td>Windows 8 Core Country Specific <br /> Windows Server 2012 Country Specific</td><td>4K36P-JN4VD-GDC6V-KDT89-DYFKP</td></tr>
|
||||||
|
<tr><td>Windows 8 Core ARM</td><td>DXHJF-N9KQX-MFPVR-GHGQK-Y7RKV</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows Server 2008 R2_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows MultiPoint Server 2010</td><td>736RG-XDKJK-V34PF-BHK87-J6X3K</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 R2 Web</td><td>6TPJF-RBVHG-WBW2R-86QPH-6RTM4</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 R2 HPC edition</td><td>TT8MH-CG224-D3D7Q-498W2-9QCTX</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 R2 Standard</td><td>YC6KT-GKW9T-YTKYR-T4X34-R7VHC</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 R2 Enterprise</td><td>489J6-VHDMP-X63PK-3K798-CPX3Y</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 R2 Datacenter</td><td>74YFP-3QFB3-KQT8W-PMXWJ-7M648</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 R2 for Itanium-based Systems</td><td>GT63C-RJFQ3-4GMB6-BRFB9-CB83V</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows 7_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows 7 Professional</td><td>FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4 <br /> MYKDJ-XV4CV-M2D3P-KDVY4-MPTW8</td></tr>
|
||||||
|
<tr><td>Windows 7 Professional N</td><td>MRPKT-YTG23-K7D7T-X2JMM-QY7MG</td></tr>
|
||||||
|
<tr><td>Windows 7 Professional E</td><td>W82YF-2Q76Y-63HXB-FGJG9-GF7QX</td></tr>
|
||||||
|
<tr><td>Windows 7 Enterprise</td><td>33PXH-7Y6KF-2VJC9-XBBR8-HVTHH</td></tr>
|
||||||
|
<tr><td>Windows 7 Enterprise N</td><td>YDRBP-3D83W-TY26F-D46B2-XCKRJ</td></tr>
|
||||||
|
<tr><td>Windows 7 Enterprise E</td><td>C29WB-22CC8-VJ326-GHFJW-H9DH4</td></tr>
|
||||||
|
<tr><td>Windows 7 Embedded POSReady</td><td>YBYF6-BHCR3-JPKRB-CDW7B-F9BK4</td></tr>
|
||||||
|
<tr><td>Windows 7 Embedded ThinPC</td><td>73KQT-CD9G6-K7TQG-66MRP-CQ22C</td></tr>
|
||||||
|
<tr><td>Windows 7 Embedded Standard</td><td>XGY72-BRBBT-FF8MH-2GG8H-W7KCW</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows Server 2008_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows Server 2008 Web</td><td>WYR28-R7TFJ-3X2YQ-YCY4H-M249D</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 Standard</td><td>TM24T-X9RMF-VWXK6-X8JC9-BFGM2</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 Standard without Hyper-V</td><td>W7VD6-7JFBR-RX26B-YKQ3Y-6FFFJ</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 Enterprise</td><td>YQGMW-MPWTJ-34KDK-48M3W-X4Q6V</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 Enterprise without Hyper-V</td><td>39BXF-X8Q23-P2WWT-38T2F-G3FPG</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 HPC edition (Computer Cluster)</td><td>RCTX3-KWVHP-BR6TB-RB6DM-6X7HP</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 Datacenter</td><td>7M67G-PC374-GR742-YH8V4-TCBY3</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 Datacenter without Hyper-V</td><td>22XQ2-VRXRG-P8D42-K34TD-G3QQC</td></tr>
|
||||||
|
<tr><td>Windows Server 2008 for Itanium-Based Systems</td><td>4DWFP-JF3DJ-B7DTH-78FJB-PDRHK</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows Vista_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows Vista Business</td><td>YFKBB-PQJJV-G996G-VWGXY-2V3X8</td></tr>
|
||||||
|
<tr><td>Windows Vista Business N</td><td>HMBQG-8H2RH-C77VX-27R82-VMQBT</td></tr>
|
||||||
|
<tr><td>Windows Vista Enterprise</td><td>VKK3X-68KWM-X2YGT-QR4M6-4BWMV</td></tr>
|
||||||
|
<tr><td>Windows Vista Enterprise N</td><td>VTC42-BM838-43QHV-84HX6-XJXKV</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
### _Windows Previews_
|
||||||
|
<table width="650" cellspacing="0" cellpadding="0">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" width="300">
|
||||||
|
<col span="1" width="350">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr><th>Product</th><th>GVLK</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Windows Server 2019 Datacenter [Preview]</td><td>6XBNX-4JQGW-QX6QG-74P76-72V67</td></tr>
|
||||||
|
<tr><td>Windows Server 2019 Standard [Preview]</td><td>MFY9F-XBN2F-TYFMP-CCV49-RMYVH</td></tr>
|
||||||
|
<tr><td>Windows 10 Home / Core [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Home / Core Country Specific [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Home / Core N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Home / Core Single Language [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Home / Core [Technical Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Education [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Education N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise [Preview]</td><td>QNMXX-GCD3W-TCCT4-872RV-G6P4J</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise 2015 LTSB [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise 2015 LTSB N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Enterprise N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional [Preview]</td><td>XQHPH-N4D9W-M8P96-DPDFP-TMVPY</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional WMC [Pre-Release]</td><td>NKPM6-TCVPT-3HRFX-Q4H9B-QJ34Y <br /> 328NF-RTPQT-84J4Q-V44B8-78R2B</td></tr>
|
||||||
|
<tr><td>Windows 10 IoT Core [Pre-Release]</td><td>7NX88-X6YM3-9Q3YT-CCGBF-KBVQF <br /> NHY4C-KCMKV-V9K9M-7R43T-KTP64</td></tr>
|
||||||
|
<tr><td>Windows 10 Core Connected [Pre-Release]</td><td>DJMYQ-WN6HG-YJ2YX-82JDB-CWFCW <br /> QBWKP-NFVG3-CYGTT-724CF-FCYPW</td></tr>
|
||||||
|
<tr><td>Windows 10 Core Connected N [Pre-Release]</td><td>JQNT7-W63G4-WX4QX-RD9M9-6CPKM <br /> TKDDW-N77V2-WXKMG-QY6WQ-WQJXM</td></tr>
|
||||||
|
<tr><td>Windows 10 Core Connected Single Language [Pre-Release]</td><td>QQMNF-GPVQ6-BFXGG-GWRCX-7XKT7 <br /> RQ2MN-RKR94-P86YQ-TM76X-P3667</td></tr>
|
||||||
|
<tr><td>Windows 10 Core Connected Country Specific [Pre-Release]</td><td>FTNXM-J4RGP-MYQCV-RVM8R-TVH24 <br /> TNPJK-GCKPR-4WX4C-HCJHT-HFRC4</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional S [Pre-Release]</td><td>3NF4D-GF9GY-63VKH-QRC3V-7QW8P <br /> NFDD9-FX3VM-DYCKP-B8HT8-D9M2C</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional S N [Pre-Release]</td><td>KNDJ3-GVHWT-3TV4V-36K8Y-PR4PF <br /> 8Q36Y-N2F39-HRMHT-4XW33-TCQR4</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional Student [Pre-Release]</td><td>YNXW3-HV3VB-Y83VG-KPBXM-6VH3Q <br /> N6X24-448X6-HYV8Y-8XQ3V-DRRDQ</td></tr>
|
||||||
|
<tr><td>Windows 10 Professional Student N [Pre-Release]</td><td>8G9XJ-GN6PJ-GW787-MVV7G-GMR99 <br /> XHGFB-WNK7Q-BG8VG-BG2KQ-KKWX9</td></tr>
|
||||||
|
<tr><td>Windows 10 PPIPro [Pre-Release (build 15063)]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 8 Core / Server 2012 [RC]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 8 Core / Server 2012 Country Specific [RC]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 8 Core / Server 2012 N [RC]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 8 Core / Server 2012 Single Language [RC]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 8 Core ARM64 [RC]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 8 Embedded Industry Professional [Beta]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 8 Embedded Industry Enterprise [Beta]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Enterprise [Preview]</td><td>2MP7K-98NK8-WPVF3-Q2WDG-VMD98</td></tr>
|
||||||
|
<tr><td>Windows 8.1 Professional (Blue) [Preview]</td><td>MTWNQ-CKDHJ-3HXW9-Q2PFX-WB2HQ</td></tr>
|
||||||
|
<tr><td>Windows 8 Professional WMC [RC]</td><td>MY4N9-TGH34-4X4VY-8FG2T-RRDPV</td></tr>
|
||||||
|
<tr><td>Windows 8.x [Preview]</td><td>MPWP3-DXNP9-BRD79-W8WFP-3YFJ6</td></tr>
|
||||||
|
<tr><td>Windows 8.x ARM64 [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Core Connected [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Core Connected N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Core Connected Country Specific [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Core Connected Single Language [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Professional Student [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Professional Student N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Embedded Industry Professional [Beta]</td><td>XY4TQ-CXNVJ-YCT73-HH6R7-R897X</td></tr>
|
||||||
|
<tr><td>Windows Next Embedded Industry Enterprise [Beta]</td><td>XCNC9-BPK3C-KCCMD-FTDTC-KWY4G <br /> WN3XP-M9YFD-JRJ84-4J9FB-QJY4G</td></tr>
|
||||||
|
<tr><td>Windows Next Embedded Industry Automotive [Beta]</td><td>GN2X2-KXTK6-P92FR-VBB9G-PDJFP <br /> 434XB-NH62H-JG7RG-P3KMD-XHHJC</td></tr>
|
||||||
|
<tr><td>Windows Server Next MultiPoint Standard [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Server Next MultiPoint Premium [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Server Next Enterprise [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Server Next Standard [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Server Next Web [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Server Next HPC Edition [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Server Next HI [Preview]</td><td>7VX4N-3VDHQ-VYGHB-JXJVP-9QB26</td></tr>
|
||||||
|
<tr><td>Enterprise ProdKey3 Win 9984 DLA/Bypass NQR Test</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Server 2012 R2 Essentials [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Server 2016 Datacenter [Preview]</td><td>VRDD2-NVGDP-K7QG8-69BR4-TVFHB</td></tr>
|
||||||
|
<tr><td>Windows Vista Business [Preview 1]</td><td>XQYF4-QVCMY-YXQRD-9QPV8-3YP9V</td></tr>
|
||||||
|
<tr><td>Windows Vista Business [Preview 2]</td><td>YVT36-YVCP2-J97GQ-7T22R-RWV8P</td></tr>
|
||||||
|
<tr><td>Windows Vista Business N [Preview]</td><td>HGBJ9-RWD6M-6HDGW-6T2XD-JQ66F</td></tr>
|
||||||
|
<tr><td>Windows Vista Enterprise [Preview 1]</td><td>3JHG3-Y66GP-B7F3K-JFVX2-VBH7K</td></tr>
|
||||||
|
<tr><td>Windows Vista Enterprise [Beta-2 build 5384]</td><td>MF9PG-RQK7R-26BPJ-TWFYK-RHXCM</td></tr>
|
||||||
|
<tr><td>Windows Vista Enterprise N [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Longhorn Web [Preview]</td><td>MDRCM-4WKCW-J93FF-J9Q48-M6KBB</td></tr>
|
||||||
|
<tr><td>Windows Longhorn HPC Edition [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Longhorn Standard [Preview]</td><td>Q37JX-P3HHB-GKRH2-PDBKG-GGXPW</td></tr>
|
||||||
|
<tr><td>Windows Longhorn Enterprise [Preview]</td><td>7KYMQ-R788Q-4RF69-KTWKM-92PFJ</td></tr>
|
||||||
|
<tr><td>Windows Longhorn Datacenter [Preview]</td><td>HR8VD-7DHG2-48378-M9D73-28F4T</td></tr>
|
||||||
|
<tr><td>Windows Longhorn for Itanium Systems [Preview]</td><td>CWV9H-PHGPW-V93WV-QBQV9-8V336</td></tr>
|
||||||
|
<tr><td>Windows 7 Business [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Business N [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Enterprise [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Enterprise N [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Server Web [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Server Standard [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Server Standard without Hyper-V [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Server Enterprise [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Server Enterprise without Hyper-V [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Server Datacenter [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Server Datacenter without Hyper-V [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows 7 Server for Itanium Systems [Preview]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Education [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Education N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Professional [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Professional N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Enterprise N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Enterprise [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Enterprise S [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Enterprise S N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Professional S [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
<tr><td>Windows Next Professional S N [Pre-Release]</td><td>?????-?????-?????-?????-?????</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
Loading…
Reference in New Issue