SystemRage / py-kms

KMS Server Emulator written in Python
The Unlicense
2.07k stars 634 forks source link

Client error with python 2.7.15 #42

Closed ghost closed 4 years ago

ghost commented 5 years ago
            Client generating RPC Bind Request...,
,
,
                                Client sending,
Server received RPC Bind Request !!!                <===============,
 * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit),
No handlers could be found for logger "root",
Traceback (most recent call last):,
  File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock,
    self.process_request(request, client_address),
  File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request,
    self.finish_request(request, client_address),
  File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request,
    self.RequestHandlerClass(request, client_address, self),
  File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__,
    self.handle(),
  File "pykms_Server.py", line 242, in handle,
    res = enco(str(handler.populate()), 'latin-1'),
  File "/home/py-kms/pykms_RpcBase.py", line 42, in populate,
    return self.generateResponse(self.parseRequest()),
  File "/home/py-kms/pykms_RpcRequest.py", line 26, in generateResponse,
    responseData = pykms_Base.generateKmsResponseData(request['pduData'], self.srv_config),
  File "/home/py-kms/pykms_Base.py", line 257, in generateKmsResponseData,
    return messagehandler.executeRequestLogic(),
  File "/home/py-kms/pykms_RequestV5.py", line 75, in executeRequestLogic,
    responseBuffer = self.serverLogic(decrypted['request']),
  File "/home/py-kms/pykms_Base.py", line 208, in serverLogic,
    sql_update(self.dbName, infoDict),
  File "/home/py-kms/pykms_Sql.py", line 68, in sql_update,
    sys.exit(1),
NameError: global name 'sys' is not defined,
,
Server receiving,
<===============    Client sending RPC Bind Request...,
,
,
,
Server sending,
===============>    Client received RPC Bind Response !!!,
,
            RPC Bind acknowledged !!!,
,
,
            Client generating Activation Request dictionary...,
,
            Client generating Activation Request data...,
,
            Client generating RPC Activation Request...,
,
Server receiving,
<===============    Client sending RPC Activation Request...,
,
,
,
,
,
Server sending,
===============>    Client received Response !!!,
,
Traceback (most recent call last):,
  File "pykms_Client.py", line 268, in <module>,
    clt_main(with_gui = False),
  File "pykms_Client.py", line 190, in clt_main,
    client_create(),
  File "pykms_Client.py", line 151, in client_create,
    parsed = MSRPCRespHeader(response),
  File "/home/py-kms/pykms_Dcerpc.py", line 641, in __init__,
    MSRPCHeader.__init__(self, aBuffer, alignment),
  File "/home/py-kms/pykms_Dcerpc.py", line 588, in __init__,
    Structure.__init__(self,data, alignment),
  File "/home/py-kms/pykms_Structure.py", line 110, in __init__,
    self.fromString(data),
  File "/home/py-kms/pykms_Structure.py", line 167, in fromString,
    self[field[0]] = self.unpack(field[1], data[:size], dataClassOrCode = dataClassOrCode, field = field[0]),
  File "/home/py-kms/pykms_Structure.py", line 329, in unpack,
    return self.unpack(two[0],data),
  File "/home/py-kms/pykms_Structure.py", line 385, in unpack,
    return unpack(format, b(data))[0],
struct.error: ('unpack requires a string argument of length 1', "When unpacking field 'ver_major | B=5 | ''[:1]'"),

How can I fix this?

syserr0r commented 5 years ago

New release seems broken, pulling an older, known-good release fixed it for me:

docker stop py3-kms
docker rm py3-kms
docker pull ekonprof18/pykms@sha256:1deca36a2f3ecabc1902f90475fcf9490135f03a03f0fb8e2dd0a9ca03b4f5f0

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
ghost commented 5 years ago

New release seems broken, pulling an older, known-good release fixed it for me:

docker stop py3-kms
docker rm py3-kms
docker pull ekonprof18/pykms@sha256:1deca36a2f3ecabc1902f90475fcf9490135f03a03f0fb8e2dd0a9ca03b4f5f0

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

I maked new release on ekonprof18/pykms:py3-kms 15 days a go, and it's work great with python version 3.6. Now, i want make it work with python version 2.X.

syserr0r commented 5 years ago

I believe there might be an issue with this release that is affecting some users (like us) but not all, as you aren't having any problems.

When I reverted the release as I described above, it started working again.

This was a clean Debian 10 install, with the latest version of docker and then this image (with the arguments above). A single Server 2012 R2 was attempting to connect.

SystemRage commented 5 years ago

@6ec123321 In pykms_Sql.py an import sys should be enough. Can you try if it's so ?

SystemRage commented 4 years ago

Fixed with c1fa144