Merge pull request #20 from 6ec123321/master

Docker py-kms with sqlite-web (https://github.com/coleifer/sqlite-web)
This commit is contained in:
Matteo ℱan 2019-04-15 23:34:51 +02:00 committed by GitHub
commit 30a815b929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 406 additions and 0 deletions

111
docker-py2-kms/Dockerfile Normal file
View file

@ -0,0 +1,111 @@
# Use Alpine Linux
FROM alpine:3.8
# Maintainer
#MAINTAINER Artur Petrov <artur@phpchain.ru>
# EN: Variables
# RU: Переменные
# EN: IP-address
# RU: IP-адрес
ENV IP 0.0.0.0
# The IP address to listen on. The default is "0.0.0.0" (all interfaces).
# EN: TCP-port
# RU: TCP-порт
ENV PORT 1688
# The network port to listen on. The default is "1688".
# EN: ePID
# RU: ePID
ENV EPID ""
# Use this flag to manually specify an ePID to use. If no ePID is specified, a random ePID will be generated.
# EN: lcid
# RU: lcid
ENV LCID 1033
# Use this flag to manually specify an LCID for use with randomly generated ePIDs. Default is 1033 (en-us).
# EN: the current client count
# RU: текущий счётчик запросов на активацию продуктов от Microsoft
ENV CLIENT_COUNT 26
# Use this flag to specify the current client count. Default is 26.
# A number >=25 is required to enable activation of client OSes; for server OSes and Office >=5.
# EN: the activation interval (in minutes)
# RU: интервал активации (в минутах)
ENV ACTIVATION_INTERVAL 120
# Use this flag to specify the activation interval (in minutes). Default is 120 minutes (2 hours).
# EN: the renewal interval (in minutes)
# RU: интервал обновления (в минутах)
ENV RENEWAL_INTERVAL 10080
# Use this flag to specify the renewal interval (in minutes). Default is 10080 minutes (7 days).
# EN: Use SQLITE
# RU: Использовать РСУБД SQLITE
ENV SQLITE false
# Use this flag to store request information from unique clients in an SQLite database.
# EN: hwid
# RU: hwid
ENV HWID 364F463A8863D35F
# Use this flag 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.
# EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
# RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
ENV LOGLEVEL ERROR
# Use this flag to set a Loglevel. The default is "ERROR".
# EN: log file
# RU: Лог-файл
ENV LOGFILE /var/log/pykms_server.log
# Use this flag to set an output Logfile. The default is "/var/log/pykms_server.log".
# EN: Startup script
# RU: Скрипт автозапуска
COPY start.sh /usr/bin/start.sh
# EN: Software installation
# RU: Установка программного обеспечения
RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --update \
bash \
git \
python2 \
py2-argparse \
py2-tz \
py2-pysqlite \
py2-flask \
py2-pygments \
py2-pip && \
# EN: Clone git-repo
# RU: Клонирование git-репозитория
git clone https://github.com/SystemRage/py-kms.git /home/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/sqlite_web && \
pip install peewee tzlocal && \
# EN: Change permissions
# RU: Меняем права доступа
chmod a+x /usr/bin/start.sh && \
# EN: Clear after install software
# RU: Очистка после установки программного обеспечения
apk del git py2-pip
# Set Workdir
WORKDIR /home/py-kms/py2-kms
# Expose ports
EXPOSE ${PORT}/tcp
# Entry point
ENTRYPOINT ["/usr/bin/start.sh"]

View file

@ -0,0 +1,4 @@
docker stop py2-kms
docker rm py2-kms
docker image rm pykms/pykms:py2-kms
docker build -t pykms/pykms:py2-kms .

12
docker-py2-kms/run-py2-kms.sh Executable file
View file

@ -0,0 +1,12 @@
docker run -d --name py2-kms \
-p 8080:8080 \
-p 1688:1688 \
-e IP=0.0.0.0 \
-e PORT=1688 \
-e SQLITE=true \
-e HWID=random \
-e LOGLEVEL=INFO \
-e LOGFILE=/var/log/py2-kms.log \
-v /etc/localtime:/etc/localtime:ro \
-v /var/log:/var/log:rw \
--restart unless-stopped pykms/pykms:py2-kms

20
docker-py2-kms/start.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/bash
# EN: Start daemons
# RU: Запуск демонов
cd /home/py-kms/py2-kms
if [ "$SQLITE" == false ];
then
if [ "$EPID" == "" ];
then
/usr/bin/python server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -v ${LOGLEVEL} -f ${LOGFILE}
else
/usr/bin/python server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s ${SQLITE} -w ${HWID} -v ${LOGLEVEL} -f ${LOGFILE}
fi
else
if [ "$EPID" == "" ];
then
/bin/bash -c "/usr/bin/python server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -v ${LOGLEVEL} -f ${LOGFILE} &" && /usr/bin/python client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db
else
/bin/bash -c "/usr/bin/python server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -v ${LOGLEVEL} -f ${LOGFILE} &" && /usr/bin/python client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db
fi
fi

111
docker-py3-kms/Dockerfile Normal file
View file

@ -0,0 +1,111 @@
# Use Alpine Linux
FROM alpine:3.8
# Maintainer
#MAINTAINER Artur Petrov <artur@phpchain.ru>
# EN: Variables
# RU: Переменные
# EN: IP-address
# RU: IP-адрес
ENV IP 0.0.0.0
# The IP address to listen on. The default is "0.0.0.0" (all interfaces).
# EN: TCP-port
# RU: TCP-порт
ENV PORT 1688
# The network port to listen on. The default is "1688".
# EN: ePID
# RU: ePID
ENV EPID ""
# Use this flag to manually specify an ePID to use. If no ePID is specified, a random ePID will be generated.
# EN: lcid
# RU: lcid
ENV LCID 1033
# Use this flag to manually specify an LCID for use with randomly generated ePIDs. Default is 1033 (en-us).
# EN: the current client count
# RU: текущий счётчик запросов на активацию продуктов от Microsoft
ENV CLIENT_COUNT 26
# Use this flag to specify the current client count. Default is 26.
# A number >=25 is required to enable activation of client OSes; for server OSes and Office >=5.
# EN: the activation interval (in minutes)
# RU: интервал активации (в минутах)
ENV ACTIVATION_INTERVAL 120
# Use this flag to specify the activation interval (in minutes). Default is 120 minutes (2 hours).
# EN: the renewal interval (in minutes)
# RU: интервал обновления (в минутах)
ENV RENEWAL_INTERVAL 10080
# Use this flag to specify the renewal interval (in minutes). Default is 10080 minutes (7 days).
# EN: Use SQLITE
# RU: Использовать РСУБД SQLITE
ENV SQLITE false
# Use this flag to store request information from unique clients in an SQLite database.
# EN: hwid
# RU: hwid
ENV HWID 364F463A8863D35F
# Use this flag 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.
# EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
# RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
ENV LOGLEVEL ERROR
# Use this flag to set a Loglevel. The default is "ERROR".
# EN: log file
# RU: Лог-файл
ENV LOGFILE /var/log/pykms_server.log
# Use this flag to set an output Logfile. The default is "/var/log/pykms_server.log".
# EN: Startup script
# RU: Скрипт автозапуска
COPY start.sh /usr/bin/start.sh
# EN: Software installation
# RU: Установка программного обеспечения
RUN echo "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --update \
bash \
git \
python3 \
py3-argparse \
py3-tz \
py3-flask \
py3-pygments \
sqlite-libs \
py3-pip && \
# EN: Clone git-repo
# RU: Клонирование git-репозитория
git clone https://github.com/SystemRage/py-kms.git /home/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/sqlite_web && \
pip3 install peewee tzlocal && \
# EN: Change permissions
# RU: Меняем права доступа
chmod a+x /usr/bin/start.sh && \
# EN: Clear after install software
# RU: Очистка после установки программного обеспечения
apk del git py3-pip
# Set Workdir
WORKDIR /home/py-kms/py3-kms
# Expose ports
EXPOSE ${PORT}/tcp
# Entry point
ENTRYPOINT ["/usr/bin/start.sh"]

112
docker-py3-kms/README.md Normal file
View file

@ -0,0 +1,112 @@
# History
_py-kms_ is a port of node-kms created by [cyrozap](http://forums.mydigitallife.info/members/183074-markedsword), which is a port of either the C#, C++, or .NET implementations of KMS Emulator. The original version was written by [CODYQX4](http://forums.mydigitallife.info/members/89933-CODYQX4) and is derived from the reverse-engineered code of Microsoft's official KMS.
# Features
- Responds to V4, V5, and V6 KMS requests.
- Supports activating:
- Windows Vista
- Windows 7
- Windows 8
- Windows 8.1
- Windows 10 ( 1511 / 1607 / 1703 / 1709 / 1803 / 1809 )
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows Server 2019
- Microsoft Office 2010 ( Volume License )
- Microsoft Office 2013 ( Volume License )
- Microsoft Office 2016 ( Volume License )
- Microsoft Office 2019 ( Volume License )
- It's written in Python:
- _py3-kms_ tested with Python 3.5.2
# Usage
```
docker run -d --name py3-kms \
-p 8080:8080 \
-p 1688:1688 \
-e IP=0.0.0.0 \
-e PORT=1688 \
-e SQLITE=true \
-e HWID=random \
-e LOGLEVEL=INFO \
-e LOGFILE=/var/log/py3-kms.log \
-v /etc/localtime:/etc/localtime:ro \
-v /var/log:/var/log:rw \
--restart unless-stopped ekonprof18/pykms:py3-kms
```
# Sqlite-web
A web-based SQLite database browser written in Python.
Start on http://example.com:8080/ in read-only mode for clients.db.
# Options
```
# EN: Variables
# RU: Переменные
# EN: IP-address
# RU: IP-адрес
ENV IP 0.0.0.0
# The IP address to listen on. The default is "0.0.0.0" (all interfaces).
# EN: TCP-port
# RU: TCP-порт
ENV PORT 1688
# The network port to listen on. The default is "1688".
# EN: ePID
# RU: ePID
ENV EPID ""
# Use this flag to manually specify an ePID to use. If no ePID is specified, a random ePID will be generated.
# EN: lcid
# RU: lcid
ENV LCID 1033
# Use this flag to manually specify an LCID for use with randomly generated ePIDs. Default is 1033 (en-us).
# EN: the current client count
# RU: текущий счётчик запросов на активацию продуктов от Microsoft
ENV CLIENT_COUNT 26
# Use this flag to specify the current client count. Default is 26.
# A number >=25 is required to enable activation of client OSes; for server OSes and Office >=5.
# EN: the activation interval (in minutes)
# RU: интервал активации (в минутах)
ENV ACTIVATION_INTERVAL 120
# Use this flag to specify the activation interval (in minutes). Default is 120 minutes (2 hours).
# EN: the renewal interval (in minutes)
# RU: интервал обновления (в минутах)
ENV RENEWAL_INTERVAL 10080
# Use this flag to specify the renewal interval (in minutes). Default is 10080 minutes (7 days).
# EN: Use SQLITE
# RU: Использовать РСУБД SQLITE
ENV SQLITE false
# Use this flag to store request information from unique clients in an SQLite database.
# EN: hwid
# RU: hwid
ENV HWID 364F463A8863D35F
# Use this flag 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.
# EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
# RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
ENV LOGLEVEL ERROR
# Use this flag to set a Loglevel. The default is "ERROR".
# EN: log file
# RU: Лог-файл
ENV LOGFILE /var/log/pykms_server.log
# Use this flag to set an output Logfile. The default is "/var/log/pykms_server.log".
```
# Other Important Stuff
Consult the [Wiki](https://github.com/SystemRage/py-kms/wiki) for more informations about activation with _py-kms_ and to get GVLK keys.
# License
[![License](https://img.shields.io/badge/license-unlicense-lightgray.svg)](https://github.com/SystemRage/py-kms/blob/master/LICENSE)

View file

@ -0,0 +1,4 @@
docker stop py3-kms
docker rm py3-kms
docker image rm pykms/pykms:py3-kms
docker build -t pykms/pykms:py3-kms .

12
docker-py3-kms/run-py3-kms.sh Executable file
View file

@ -0,0 +1,12 @@
docker run -d --name py3-kms \
-p 8080:8080 \
-p 1688:1688 \
-e IP=0.0.0.0 \
-e PORT=1688 \
-e SQLITE=true \
-e HWID=random \
-e LOGLEVEL=INFO \
-e LOGFILE=/var/log/py3-kms.log \
-v /etc/localtime:/etc/localtime:ro \
-v /var/log:/var/log:rw \
--restart unless-stopped pykms/pykms:py3-kms

20
docker-py3-kms/start.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/bash
# EN: Start daemons
# RU: Запуск демонов
cd /home/py-kms/py3-kms
if [ "$SQLITE" == false ];
then
if [ "$EPID" == "" ];
then
/usr/bin/python3 server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -v ${LOGLEVEL} -f ${LOGFILE}
else
/usr/bin/python3 server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s ${SQLITE} -w ${HWID} -v ${LOGLEVEL} -f ${LOGFILE}
fi
else
if [ "$EPID" == "" ];
then
/bin/bash -c "/usr/bin/python3 server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -v ${LOGLEVEL} -f ${LOGFILE} &" && /usr/bin/python3 client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only
else
/bin/bash -c "/usr/bin/python3 server.py ${IP} ${PORT} -e ${EPID} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -s -w ${HWID} -v ${LOGLEVEL} -f ${LOGFILE} &" && /usr/bin/python3 client.py ${IP} ${PORT} -m Windows10 && /usr/bin/python3 /home/sqlite_web/sqlite_web.py -H ${IP} -x ${PWD}/clients.db --read-only
fi
fi