Python VNC 身份验证中的 DES 算法

问题描述 投票:0回答:1

我正在尝试使用 VNC 身份验证连接 VNC 服务器 (Vino)。阅读 RFC 6143 - 远程帧缓冲协议,我们可以了解 VNC 身份验证的工作原理。

它使用质询-响应协议,其中服务器发送 16 字节的质询,客户端使用用其密钥加密的质询进行应答。加密使用DES算法。

我使用 TigerVNC 和 Wireshark 嗅探了此过程,以便使用 Python 执行此过程。

例如

这是我用 Wireshark 嗅探到的 Vino 和 TigerVNC 之间的流量。它有效。

Server                                                                 Client
|------------------   Server protocol version: 003.007  ----------------->|
|<-----------------   Client protocol version: 003.007      --------------|
|------------------        Security types: 2        --------------------->|
|<-----------------    Security type selected: VNC (2)  ------------------|
|-------------------        Authentication result: OK           --------->|
|-----  Authentication challenge: b4a7257a443426527dd9d987fa6b099f  ----->|
|<----  Authentication response: 4838c102d8cbb1decd38ecdbec533bc7   ------|

挑战和响应是字节,而不是十六进制字符串。

但是当我使用 Python 加密身份验证质询时,我得到了不同的结果。我尝试过使用不同的分组密码操作模式,但没有成功。

例如

>>> from pydes import des
>>> challenge = "\xb4\xa7\x25\x7a\x44\x34\x26\x52\x7d\xd9\xd9\x87\xfa\x6b\x09\x9f"
>>> key = "testingg"
>>> d = des()
>>> ciphered = d.encrypt(key,challenge,padding=True)
>>> import binascii
>>> ciphered = d.encrypt(key,challenge)
>>> binascii.hexlify(ciphered)
'4f16bc072bf34903e753b3f968b1aa56'

或者使用另一个 Python 模块:

>>> import pyDes
>>> des = pyDes.des("testingg")
>>> challenge = "\xb4\xa7\x25\x7a\x44\x34\x26\x52\x7d\xd9\xd9\x87\xfa\x6b\x09\x9f"
>>> e = des.encrypt(challenge)
>>> binascii.hexlify(e)
'4f16bc072bf34903e753b3f968b1aa56'
>>> binascii.hexlify(des.decrypt(e))
'b4a7257a443426527dd9d987fa6b099f'

我错过了什么吗? RFC 没有显示任何有关加密模式或 IV 向量的信息..

此外,我还展示了TigerVNC的源代码,它是用Java编写的,并且似乎没有关于挑战加密的任何特殊之处。

python encryption vnc des vnc-server
1个回答
0
投票

在为 x11vnc 服务器编写客户端时,我也遇到了同样的问题。 所以我使用的服务器不需要密码: 当使用命令“x11vnc -nopw -display :0”启动vnc服务器时, “-nopw”将导致服务器不请求密码。

这显然不是一个安全连接,但它可以工作。

© www.soinside.com 2019 - 2024. All rights reserved.