在这里原谅我的无知。我没有很好地阅读Python,我根本不会写它。
我正在尝试审核 CVE-2013-1445 的 python 项目。我相信找到了一个可能需要注意的源文件(以及其他改进机会)。该文件是util.py,它有以下行:
import base64
from Crypto.Hash import HMAC
from Crypto import Random
...
当我查看Python crypto docs时,我没有看到提到一个Random
类。只有hashlib
和hmac
:
The modules described in this chapter implement various algorithms of a
cryptographic nature. They are available at the discretion of the
installation. On Unix systems, the crypt module may also be available.
Here’s an overview:
15.1. hashlib — Secure hashes and message digests
15.2. hmac — Keyed-Hashing for Message Authentication
...
究竟是Random
从哪里来的?是本地的还是第三方的?
或者我的问题应该是,从哪里来Crypto
?如果Crypto
是第三方,我如何确定第三方库和类的包含方式/位置(相对于本机库和类)?
为了完整起见,我试图理解 Python 的作用域和命名空间,但目前对我来说毫无意义(正如这个问题可能表明的那样)。例如, or 没有明显的范围或命名空间Crypto
(Random
除了Random
是 的一部分Crypto
)。
提前致谢。